From: Corinna Vinschen Date: Wed, 31 Oct 2001 20:59:22 +0000 (+0000) Subject: * gdb.base/miscexprs.c (main): Add usage of preprocessor X-Git-Tag: cygnus_cvs_20020108_pre~871 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aaa68313b8a2c635670eb03130a4d06f195c93c5;hp=b433d00bbcd022648dc2dc07f12a4adad7940fce;p=external%2Fbinutils.git * 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. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b61965b..d29216a 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 41bd29f..580255d 100644 --- a/gdb/testsuite/gdb.base/miscexprs.c +++ b/gdb/testsuite/gdb.base/miscexprs.c @@ -7,27 +7,27 @@ marker1 () int main () { - struct { + STORAGE struct { char c[100]; } cbig; - struct { + STORAGE struct { int i[800]; } ibig; - struct { + STORAGE struct { long l[900]; } lbig; - struct { + STORAGE struct { float f[200]; } fbig; - struct { + STORAGE struct { double d[300]; } dbig; - struct { + STORAGE struct { short s[400]; } sbig; diff --git a/gdb/testsuite/gdb.base/miscexprs.exp b/gdb/testsuite/gdb.base/miscexprs.exp index 795fc3e..ad8e11d 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." }