gdb/testuite/
* gdb.trace/unavailable.cc (a, b, c): New globals. (main): Set and clear them. * gdb.trace/unavailable.exp (gdb_collect_globals_test): Collect `a' and `c', and check that `b' isn't collected, although `a' and `c' are. gdb/ * tracepoint.c (memrange_sortmerge): Don't merge ranges that are almost but not quite adjacent.
This commit is contained in:
parent
ec0a52e162
commit
1b28d0b3be
5 changed files with 52 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2011-02-14 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* tracepoint.c (memrange_sortmerge): Don't merge ranges that are
|
||||||
|
almost but not quite adjacent.
|
||||||
|
|
||||||
2011-02-14 Pedro Alves <pedro@codesourcery.com>
|
2011-02-14 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
* value.h (value_entirely_available): Declare.
|
* value.h (value_entirely_available): Declare.
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2011-02-14 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* gdb.trace/unavailable.cc (a, b, c): New globals.
|
||||||
|
(main): Set and clear them.
|
||||||
|
* gdb.trace/unavailable.exp (gdb_collect_globals_test): Collect
|
||||||
|
`a' and `c', and check that `b' isn't collected, although `a' and
|
||||||
|
`c' are.
|
||||||
|
|
||||||
2011-02-14 Pedro Alves <pedro@codesourcery.com>
|
2011-02-14 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
* gdb.trace/unavailable.cc (struct Virtual): New.
|
* gdb.trace/unavailable.cc (struct Virtual): New.
|
||||||
|
|
|
@ -71,6 +71,25 @@ struct tuple
|
||||||
|
|
||||||
struct tuple tarray[8];
|
struct tuple tarray[8];
|
||||||
|
|
||||||
|
/* Test for overcollection. GDB used to merge memory ranges to
|
||||||
|
collect if they were close enough --- say, collect `a' and 'c'
|
||||||
|
below, and you'd get 'b' as well. This had been presumably done to
|
||||||
|
cater for some target's inefficient trace buffer layout, but it is
|
||||||
|
really not GDB's business to assume how the target manages its
|
||||||
|
buffer. If the target wants to overcollect, that's okay, since it
|
||||||
|
knows what is and what isn't safe to touch (think memory mapped
|
||||||
|
registers), and knows it's buffer layout.
|
||||||
|
|
||||||
|
The test assumes these three variables are laid out consecutively
|
||||||
|
in memory. Unfortunately, we can't use an array instead, since the
|
||||||
|
agent expression generator does not even do constant folding,
|
||||||
|
meaning that anything that's more complicated than collecting a
|
||||||
|
global will generate an agent expression action to evaluate on the
|
||||||
|
target, instead of a simple "collect memory" action. */
|
||||||
|
int a;
|
||||||
|
int b;
|
||||||
|
int c;
|
||||||
|
|
||||||
/* Random tests. */
|
/* Random tests. */
|
||||||
|
|
||||||
struct StructA
|
struct StructA
|
||||||
|
@ -185,6 +204,7 @@ main (int argc, char **argv, char **envp)
|
||||||
memcpy (g_string_unavail, g_const_string, sizeof (g_const_string));
|
memcpy (g_string_unavail, g_const_string, sizeof (g_const_string));
|
||||||
memcpy (g_string_partial, g_const_string, sizeof (g_const_string));
|
memcpy (g_string_partial, g_const_string, sizeof (g_const_string));
|
||||||
g_string_p = g_const_string;
|
g_string_p = g_const_string;
|
||||||
|
a = 1; b = 2; c = 3;
|
||||||
|
|
||||||
/* Call test functions, so they can be traced and data collected. */
|
/* Call test functions, so they can be traced and data collected. */
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -212,6 +232,8 @@ main (int argc, char **argv, char **envp)
|
||||||
memset (g_string_partial, 0, sizeof (g_string_partial));
|
memset (g_string_partial, 0, sizeof (g_string_partial));
|
||||||
g_string_p = NULL;
|
g_string_p = NULL;
|
||||||
|
|
||||||
|
a = b = c = 0;
|
||||||
|
|
||||||
g_int = 0;
|
g_int = 0;
|
||||||
|
|
||||||
g_structref.clear ();
|
g_structref.clear ();
|
||||||
|
|
|
@ -92,6 +92,9 @@ proc gdb_collect_globals_test { } {
|
||||||
"collect struct_b.struct_a.array\[2\]" "^$" \
|
"collect struct_b.struct_a.array\[2\]" "^$" \
|
||||||
"collect struct_b.struct_a.array\[100\]" "^$" \
|
"collect struct_b.struct_a.array\[100\]" "^$" \
|
||||||
\
|
\
|
||||||
|
"collect a" "^$" \
|
||||||
|
"collect c" "^$" \
|
||||||
|
\
|
||||||
"collect tarray\[0\].a" "^$" \
|
"collect tarray\[0\].a" "^$" \
|
||||||
"collect tarray\[1\].a" "^$" \
|
"collect tarray\[1\].a" "^$" \
|
||||||
"collect tarray\[3\].a" "^$" \
|
"collect tarray\[3\].a" "^$" \
|
||||||
|
@ -145,6 +148,15 @@ proc gdb_collect_globals_test { } {
|
||||||
|
|
||||||
gdb_test "print /x struct_b.struct_a.array\[2\]" " = 0xaaaaaaaa"
|
gdb_test "print /x struct_b.struct_a.array\[2\]" " = 0xaaaaaaaa"
|
||||||
|
|
||||||
|
# Check the target doesn't overcollect. GDB used to merge memory
|
||||||
|
# ranges to collect if they were close enough (collecting the hole
|
||||||
|
# as well), but does not do that anymore. It's plausible that a
|
||||||
|
# target may do this on its end, but as of this writing, no known
|
||||||
|
# target does it.
|
||||||
|
gdb_test "print {a, b, c}" \
|
||||||
|
" = \\{1, <unavailable>, 3\\}" \
|
||||||
|
"No overcollect of almost but not quite adjacent memory ranges"
|
||||||
|
|
||||||
# Check <unavailable> isn't confused with 0 in array element repetitions
|
# Check <unavailable> isn't confused with 0 in array element repetitions
|
||||||
|
|
||||||
gdb_test_no_output "set print repeat 1"
|
gdb_test_no_output "set print repeat 1"
|
||||||
|
|
|
@ -841,13 +841,12 @@ memrange_sortmerge (struct collection_list *memranges)
|
||||||
{
|
{
|
||||||
for (a = 0, b = 1; b < memranges->next_memrange; b++)
|
for (a = 0, b = 1; b < memranges->next_memrange; b++)
|
||||||
{
|
{
|
||||||
if (memranges->list[a].type == memranges->list[b].type &&
|
/* If memrange b overlaps or is adjacent to memrange a,
|
||||||
memranges->list[b].start - memranges->list[a].end <=
|
merge them. */
|
||||||
MAX_REGISTER_SIZE)
|
if (memranges->list[a].type == memranges->list[b].type
|
||||||
|
&& memranges->list[b].start <= memranges->list[a].end)
|
||||||
{
|
{
|
||||||
/* memrange b starts before memrange a ends; merge them. */
|
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