2011-02-16 Pedro Alves <pedro@codesourcery.com>
Jan Kratochvil <jan.kratochvil@redhat.com> gdb/ * tracepoint.c (memrange_sortmerge): Fix list A's end calculation. 2011-02-16 Pedro Alves <pedro@codesourcery.com> gdb/testsuite/ * collection.c (globalarr2): New global. (main): Initialize it before collecting, and and clear it afterwards. * collection.exp (gdb_collect_globals_test): Test collecting overlapping memory ranges.
This commit is contained in:
parent
fb68ae733b
commit
08807d5afd
5 changed files with 45 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2011-02-16 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
gdb/
|
||||||
|
* tracepoint.c (memrange_sortmerge): Fix list A's end calculation.
|
||||||
|
|
||||||
2011-02-16 Pedro Alves <pedro@codesourcery.com>
|
2011-02-16 Pedro Alves <pedro@codesourcery.com>
|
||||||
Jan Kratochvil <jan.kratochvil@redhat.com>
|
Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2011-02-16 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* collection.c (globalarr2): New global.
|
||||||
|
(main): Initialize it before collecting, and and clear it
|
||||||
|
afterwards.
|
||||||
|
* collection.exp (gdb_collect_globals_test): Test collecting
|
||||||
|
overlapping memory ranges.
|
||||||
|
|
||||||
2011-02-15 Michael Snyder <msnyder@vmware.com>
|
2011-02-15 Michael Snyder <msnyder@vmware.com>
|
||||||
|
|
||||||
* gdb.base/default.exp: Add tests for thread commands.
|
* gdb.base/default.exp: Add tests for thread commands.
|
||||||
|
|
|
@ -26,6 +26,7 @@ double globald;
|
||||||
test_struct globalstruct;
|
test_struct globalstruct;
|
||||||
test_struct *globalp;
|
test_struct *globalp;
|
||||||
int globalarr[16];
|
int globalarr[16];
|
||||||
|
int globalarr2[4];
|
||||||
|
|
||||||
struct global_pieces {
|
struct global_pieces {
|
||||||
unsigned int a;
|
unsigned int a;
|
||||||
|
@ -237,6 +238,9 @@ main (argc, argv, envp)
|
||||||
for (i = 0; i < 15; i++)
|
for (i = 0; i < 15; i++)
|
||||||
globalarr[i] = i;
|
globalarr[i] = i;
|
||||||
|
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
globalarr2[i] = i;
|
||||||
|
|
||||||
mystruct.memberc = 101;
|
mystruct.memberc = 101;
|
||||||
mystruct.memberi = 102;
|
mystruct.memberi = 102;
|
||||||
mystruct.memberf = 103.3;
|
mystruct.memberf = 103.3;
|
||||||
|
@ -283,6 +287,8 @@ main (argc, argv, envp)
|
||||||
globalp = 0;
|
globalp = 0;
|
||||||
for (i = 0; i < 15; i++)
|
for (i = 0; i < 15; i++)
|
||||||
globalarr[i] = 0;
|
globalarr[i] = 0;
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
globalarr2[i] = 0;
|
||||||
|
|
||||||
end ();
|
end ();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -457,13 +457,29 @@ proc gdb_collect_globals_test { } {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Use use this to test collecting overlapping memory ranges
|
||||||
|
# (making use of UNOP_MEMVAL, as objects don't usually overlap
|
||||||
|
# other objects). Note that globalarr2 should not be collected in
|
||||||
|
# any other way so that a regression test below can be effective.
|
||||||
|
|
||||||
|
set globalarr2_addr ""
|
||||||
|
set test "get address of globalarr2"
|
||||||
|
gdb_test_multiple "p /x &globalarr2" $test {
|
||||||
|
-re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
|
||||||
|
set globalarr2_addr $expect_out(1,string)
|
||||||
|
pass $test
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gdb_test "trace $testline" \
|
gdb_test "trace $testline" \
|
||||||
"Tracepoint \[0-9\]+ at .*" \
|
"Tracepoint \[0-9\]+ at .*" \
|
||||||
"collect globals: set tracepoint"
|
"collect globals: set tracepoint"
|
||||||
gdb_trace_setactions "collect globals: define actions" \
|
gdb_trace_setactions "collect globals: define actions" \
|
||||||
"" \
|
"" \
|
||||||
"collect globalc, globali, globalf, globald" "^$" \
|
"collect globalc, globali, globalf, globald" "^$" \
|
||||||
"collect globalstruct, globalp, globalarr" "^$"
|
"collect globalstruct, globalp, globalarr" "^$" \
|
||||||
|
"collect \{int \[4\]\}$globalarr2_addr" "^$" \
|
||||||
|
"collect \{int \[2\]\}$globalarr2_addr" "^$"
|
||||||
|
|
||||||
# Begin the test.
|
# Begin the test.
|
||||||
run_trace_experiment "globals" globals_test_func
|
run_trace_experiment "globals" globals_test_func
|
||||||
|
@ -508,6 +524,12 @@ proc gdb_collect_globals_test { } {
|
||||||
"\\$\[0-9\]+ = 3$cr" \
|
"\\$\[0-9\]+ = 3$cr" \
|
||||||
"collect globals: collected global array element #3"
|
"collect globals: collected global array element #3"
|
||||||
|
|
||||||
|
# Check that we didn't mess up sort&merging memory ranges to
|
||||||
|
# collect.
|
||||||
|
gdb_test "print globalarr2" \
|
||||||
|
"\\$\[0-9\]+ = \\{0, 1, 2, 3\\}$cr" \
|
||||||
|
"collect globals: collected global array 2"
|
||||||
|
|
||||||
gdb_test "tfind none" \
|
gdb_test "tfind none" \
|
||||||
"#0 end .*" \
|
"#0 end .*" \
|
||||||
"collect globals: cease trace debugging"
|
"collect globals: cease trace debugging"
|
||||||
|
|
|
@ -846,7 +846,8 @@ memrange_sortmerge (struct collection_list *memranges)
|
||||||
if (memranges->list[a].type == memranges->list[b].type
|
if (memranges->list[a].type == memranges->list[b].type
|
||||||
&& memranges->list[b].start <= memranges->list[a].end)
|
&& memranges->list[b].start <= memranges->list[a].end)
|
||||||
{
|
{
|
||||||
memranges->list[a].end = memranges->list[b].end;
|
if (memranges->list[b].end > memranges->list[a].end)
|
||||||
|
memranges->list[a].end = memranges->list[b].end;
|
||||||
continue; /* next b, same a */
|
continue; /* next b, same a */
|
||||||
}
|
}
|
||||||
a++; /* next a */
|
a++; /* next a */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue