From: Tom Tromey Date: Tue, 27 Jul 2010 16:58:22 +0000 (+0000) Subject: * gdb.stabs/gdb11479.c (hack): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e992ef7345b6ff291c424cac2a056ba09102e64a;p=binutils-gdb.git * gdb.stabs/gdb11479.c (hack): New function. (test): Use it. (test2): Use it. * gdb.python/py-inferior.c (int8_search_buf, int16_search_buf) (int32_search_buf, int64_search_buf): No longer static. (x): Remove. * gdb.base/relocate.c (hack): New function. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1e2ecd6982e..29904879748 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2010-07-27 Tom Tromey + + * gdb.stabs/gdb11479.c (hack): New function. + (test): Use it. + (test2): Use it. + * gdb.python/py-inferior.c (int8_search_buf, int16_search_buf) + (int32_search_buf, int64_search_buf): No longer static. + (x): Remove. + * gdb.base/relocate.c (hack): New function. + 2010-07-27 Phil Muldoon * gdb.python/py-value.exp (test_inferior_function_call): New function. diff --git a/gdb/testsuite/gdb.base/relocate.c b/gdb/testsuite/gdb.base/relocate.c index edf0191a067..4415b539f16 100644 --- a/gdb/testsuite/gdb.base/relocate.c +++ b/gdb/testsuite/gdb.base/relocate.c @@ -33,3 +33,10 @@ function_bar () { return 6; } + +/* Make sure the statics are not optimized away. */ +int * +hack (int arg) +{ + return arg ? &static_foo : &static_bar; +} diff --git a/gdb/testsuite/gdb.python/py-inferior.c b/gdb/testsuite/gdb.python/py-inferior.c index 0b48299a60e..dd83ffc4767 100644 --- a/gdb/testsuite/gdb.python/py-inferior.c +++ b/gdb/testsuite/gdb.python/py-inferior.c @@ -6,16 +6,14 @@ #define CHUNK_SIZE 16000 /* same as findcmd.c's */ #define BUF_SIZE (2 * CHUNK_SIZE) /* at least two chunks */ -static int8_t int8_search_buf[100]; -static int16_t int16_search_buf[100]; -static int32_t int32_search_buf[100]; -static int64_t int64_search_buf[100]; +int8_t int8_search_buf[100]; +int16_t int16_search_buf[100]; +int32_t int32_search_buf[100]; +int64_t int64_search_buf[100]; static char *search_buf; static int search_buf_size; -static int x; - int f2 (int a) { diff --git a/gdb/testsuite/gdb.stabs/gdb11479.c b/gdb/testsuite/gdb.stabs/gdb11479.c index 257be5e360a..70ab5d901a3 100644 --- a/gdb/testsuite/gdb.stabs/gdb11479.c +++ b/gdb/testsuite/gdb.stabs/gdb11479.c @@ -23,13 +23,17 @@ struct dummy; enum dummy_enum; +/* This function prevents the compiler from dropping local variables + we need for the test. */ +void *hack (const struct dummy *t, const enum dummy_enum *e); + const void * test (const struct dummy *t) { const struct dummy *tt; enum dummy_enum *e; tt = t; - return t; + return hack (t, e); } void * @@ -38,7 +42,7 @@ test2 (struct dummy *t) struct dummy *tt; const enum dummy_enum *e; tt = t; - return t; + return hack (t, e); } @@ -53,6 +57,12 @@ enum dummy_enum { enum2 }; +void * +hack (const struct dummy *t, const enum dummy_enum *e) +{ + return (void *) t; +} + int main () {