From 824b25b9bd9c401e947dad6d5361deb694aa7afa Mon Sep 17 00:00:00 2001 From: corinna Date: Wed, 31 Oct 2001 20:59:21 +0000 Subject: [PATCH] * gdb.base/miscexprs.c (main): Add usage of preprocessor symbol `STORAGE' to allow to choose the storage class of the local datastructures. * gdb.base/miscexprs.exp: Handle setting a `-DSTORAGE=...' compiler directive. --- gdb/testsuite/ChangeLog | 8 ++ gdb/testsuite/gdb.base/miscexprs.c | 178 ++++++----------------------------- gdb/testsuite/gdb.base/miscexprs.exp | 13 ++- 3 files changed, 51 insertions(+), 148 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b61965bff2..d29216af13 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2001-10-31 Corinna Vinschen + + * gdb.base/miscexprs.c (main): Add usage of preprocessor + symbol `STORAGE' to allow to choose the storage class of + the local datastructures. + * gdb.base/miscexprs.exp: Handle setting a `-DSTORAGE=...' + compiler directive. + 2001-10-30 Michael Snyder * gdb.base/jump.exp: Allow it to run for all targets. diff --git a/gdb/testsuite/gdb.base/miscexprs.c b/gdb/testsuite/gdb.base/miscexprs.c index cae23d8cf3..580255d27c 100644 --- a/gdb/testsuite/gdb.base/miscexprs.c +++ b/gdb/testsuite/gdb.base/miscexprs.c @@ -1,165 +1,49 @@ -void marker1 () +void +marker1 () { - + } -/* -static struct { - char c[100]; -} cbig; - - -static struct { - int i[800]; -} ibig; - - -static struct { - long l[900]; -} lbig; - -static struct { - float f[200]; -} fbig; - -static struct { - double d[300]; -} dbig; - -static struct { - short s[400]; -} sbig;*/ -/*struct { - long l[900]; -} lbig;*/ - -int main() +int +main () { - -struct { + STORAGE struct { char c[100]; -} cbig; - + } cbig; -struct { + STORAGE struct { int i[800]; -} ibig; + } ibig; - -struct { + STORAGE struct { long l[900]; -} lbig; + } lbig; -struct { + STORAGE struct { float f[200]; -} fbig; + } fbig; -struct { + STORAGE struct { double d[300]; -} dbig; + } dbig; -struct { + STORAGE struct { short s[400]; -} sbig; - ibig.i[100] = 5; - cbig.c[100] = 'A'; - fbig.f[100] = 11.99999; - dbig.d[202] = 9.99999999; - sbig.s[90] = 255; - lbig.l[333] = 999999999; + } sbig; + + ibig.i[100] = 5; + cbig.c[0] = '\0'; + cbig.c[100] = 'A'; + fbig.f[100] = 11.99999; + dbig.d[202] = 9.99999999; + sbig.s[90] = 255; + lbig.l[333] = 999999999; - #ifdef usestubs - set_debug_traps(); - breakpoint(); - #endif - marker1(); - return 0; +#ifdef usestubs + set_debug_traps (); + breakpoint (); +#endif + marker1 (); + return 0; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/gdb/testsuite/gdb.base/miscexprs.exp b/gdb/testsuite/gdb.base/miscexprs.exp index 795fc3eb8c..ad8e11d837 100644 --- a/gdb/testsuite/gdb.base/miscexprs.exp +++ b/gdb/testsuite/gdb.base/miscexprs.exp @@ -30,6 +30,17 @@ if $tracelevel then { strace $tracelevel } +# By default, the datastructures are allocated on the stack. For targets +# with very small stack, that will not work. In that case, just set +# storage to `-DSTORAGE=static' which changes the datastructures to be +# allocated in data segment. +set storage "-DSTORAGE=" +if [target_info exists gdb,small_stack_section] { + set storage "-DSTORAGE=static" +} + +set additional_flags "additional_flags=-w ${storage}" + # # test running programs # @@ -40,7 +51,7 @@ set testfile "miscexprs" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } { +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ${additional_flags}]] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } -- 2.11.0