* [RFA]: testsuite/gdb.base/miscexprs.*
@ 2001-10-31 8:53 Corinna Vinschen
2001-10-31 11:39 ` Michael Snyder
2001-10-31 12:27 ` Fernando Nasser
0 siblings, 2 replies; 7+ messages in thread
From: Corinna Vinschen @ 2001-10-31 8:53 UTC (permalink / raw)
To: gdb-patches
Hi,
on my target I have the same problem with the very small (2K) stack
when running miscexprs.exp as I already had with call-ar-st.exp.
I would like to propose the following patch, which adds the ability
to extend miscexprs.exp for targets, which also suffer from the
small stack. I added a compiler switch to define the preprocessor
symbol `STORAGE', which by default is set to empty. A target
specific conditional can be used for setting it to "static", to
allow running the tests with the datastructures allocated in the
global data area instead of on the stack. Obviously, miscexprs.exp
in the below incarantion just contains such a conditional only for
the target I'm just working on...
Corinna
2001-10-31 Corinna Vinschen <vinschen@redhat.com>
* 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.
Index: miscexprs.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/miscexprs.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 miscexprs.c
--- miscexprs.c 1999/04/26 18:27:11 1.1.1.2
+++ miscexprs.c 2001/10/31 16:43:01
@@ -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;
Index: miscexprs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/miscexprs.exp,v
retrieving revision 1.5
diff -u -p -r1.5 miscexprs.exp
--- miscexprs.exp 2001/03/06 08:21:50 1.5
+++ miscexprs.exp 2001/10/31 16:43:01
@@ -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 [istarget "stormy16-*-*"] then {
+ 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."
}
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [RFA]: testsuite/gdb.base/miscexprs.* 2001-10-31 8:53 [RFA]: testsuite/gdb.base/miscexprs.* Corinna Vinschen @ 2001-10-31 11:39 ` Michael Snyder 2001-10-31 12:20 ` Corinna Vinschen 2001-10-31 12:32 ` Fernando Nasser 2001-10-31 12:27 ` Fernando Nasser 1 sibling, 2 replies; 7+ messages in thread From: Michael Snyder @ 2001-10-31 11:39 UTC (permalink / raw) To: gdb-patches Corinna Vinschen wrote: > > Hi, > > on my target I have the same problem with the very small (2K) stack > when running miscexprs.exp as I already had with call-ar-st.exp. > > I would like to propose the following patch, which adds the ability > to extend miscexprs.exp for targets, which also suffer from the > small stack. I added a compiler switch to define the preprocessor > symbol `STORAGE', which by default is set to empty. A target > specific conditional can be used for setting it to "static", to > allow running the tests with the datastructures allocated in the > global data area instead of on the stack. Obviously, miscexprs.exp > in the below incarantion just contains such a conditional only for > the target I'm just working on... This is a good step, and I'm in favor of accepting it. I'd just like to suggest that an even better approach might be to add a dejagnu variable that could be defined in the baseboard file, rather than put a target ifdef in the testsuite script. Something like this: baseboard file: set_board_info gdb, small_stack_section, 1 set_board_info gdb, small_data_section, 1 // future extension testsuite file: if [target_info exists gdb,small_stack_section] { set storage "-DSTORAGE=static" } > > Corinna > > 2001-10-31 Corinna Vinschen <vinschen@redhat.com> > > * 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. > > Index: miscexprs.c > =================================================================== > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/miscexprs.c,v > retrieving revision 1.1.1.2 > diff -u -p -r1.1.1.2 miscexprs.c > --- miscexprs.c 1999/04/26 18:27:11 1.1.1.2 > +++ miscexprs.c 2001/10/31 16:43:01 > @@ -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; > > Index: miscexprs.exp > =================================================================== > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/miscexprs.exp,v > retrieving revision 1.5 > diff -u -p -r1.5 miscexprs.exp > --- miscexprs.exp 2001/03/06 08:21:50 1.5 > +++ miscexprs.exp 2001/10/31 16:43:01 > @@ -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 [istarget "stormy16-*-*"] then { > + 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." > } > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA]: testsuite/gdb.base/miscexprs.* 2001-10-31 11:39 ` Michael Snyder @ 2001-10-31 12:20 ` Corinna Vinschen 2001-10-31 12:33 ` Fernando Nasser 2001-10-31 12:32 ` Fernando Nasser 1 sibling, 1 reply; 7+ messages in thread From: Corinna Vinschen @ 2001-10-31 12:20 UTC (permalink / raw) To: gdb-patches On Wed, Oct 31, 2001 at 11:40:08AM -0800, Michael Snyder wrote: > Corinna Vinschen wrote: > > on my target I have the same problem with the very small (2K) stack > > when running miscexprs.exp as I already had with call-ar-st.exp. > > > > I would like to propose the following patch, which adds the ability > > to extend miscexprs.exp for targets, which also suffer from the > > small stack. I added a compiler switch to define the preprocessor > > symbol `STORAGE', which by default is set to empty. A target > > specific conditional can be used for setting it to "static", to > > allow running the tests with the datastructures allocated in the > > global data area instead of on the stack. Obviously, miscexprs.exp > > in the below incarantion just contains such a conditional only for > > the target I'm just working on... > > This is a good step, and I'm in favor of accepting it. > I'd just like to suggest that an even better approach > might be to add a dejagnu variable that could be defined > in the baseboard file, rather than put a target ifdef in > the testsuite script. > > Something like this: > baseboard file: > set_board_info gdb, small_stack_section, 1 > set_board_info gdb, small_data_section, 1 // future extension > testsuite file: > if [target_info exists gdb,small_stack_section] { > set storage "-DSTORAGE=static" > } Thanks for the suggestion! I like it so much that I immediately changed my patch. The new patch is below. Corinna 2001-10-31 Corinna Vinschen <vinschen@redhat.com> * 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. Index: miscexprs.c =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/miscexprs.c,v retrieving revision 1.1.1.2 diff -u -p -r1.1.1.2 miscexprs.c --- miscexprs.c 1999/04/26 18:27:11 1.1.1.2 +++ miscexprs.c 2001/10/31 20:18:04 @@ -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; Index: miscexprs.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/miscexprs.exp,v retrieving revision 1.5 diff -u -p -r1.5 miscexprs.exp --- miscexprs.exp 2001/03/06 08:21:50 1.5 +++ miscexprs.exp 2001/10/31 20:18:04 @@ -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." } ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA]: testsuite/gdb.base/miscexprs.* 2001-10-31 12:20 ` Corinna Vinschen @ 2001-10-31 12:33 ` Fernando Nasser 2001-10-31 13:00 ` Corinna Vinschen 0 siblings, 1 reply; 7+ messages in thread From: Fernando Nasser @ 2001-10-31 12:33 UTC (permalink / raw) To: gdb-patches And it is already done!!! Yes, it is OK with me. Regards, Fernando Corinna Vinschen wrote: > > On Wed, Oct 31, 2001 at 11:40:08AM -0800, Michael Snyder wrote: > > Corinna Vinschen wrote: > > > on my target I have the same problem with the very small (2K) stack > > > when running miscexprs.exp as I already had with call-ar-st.exp. > > > > > > I would like to propose the following patch, which adds the ability > > > to extend miscexprs.exp for targets, which also suffer from the > > > small stack. I added a compiler switch to define the preprocessor > > > symbol `STORAGE', which by default is set to empty. A target > > > specific conditional can be used for setting it to "static", to > > > allow running the tests with the datastructures allocated in the > > > global data area instead of on the stack. Obviously, miscexprs.exp > > > in the below incarantion just contains such a conditional only for > > > the target I'm just working on... > > > > This is a good step, and I'm in favor of accepting it. > > I'd just like to suggest that an even better approach > > might be to add a dejagnu variable that could be defined > > in the baseboard file, rather than put a target ifdef in > > the testsuite script. > > > > Something like this: > > baseboard file: > > set_board_info gdb, small_stack_section, 1 > > set_board_info gdb, small_data_section, 1 // future extension > > testsuite file: > > if [target_info exists gdb,small_stack_section] { > > set storage "-DSTORAGE=static" > > } > > Thanks for the suggestion! I like it so much that I immediately > changed my patch. The new patch is below. > > Corinna > > 2001-10-31 Corinna Vinschen <vinschen@redhat.com> > > * 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. > > Index: miscexprs.c > =================================================================== > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/miscexprs.c,v > retrieving revision 1.1.1.2 > diff -u -p -r1.1.1.2 miscexprs.c > --- miscexprs.c 1999/04/26 18:27:11 1.1.1.2 > +++ miscexprs.c 2001/10/31 20:18:04 > @@ -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; > > Index: miscexprs.exp > =================================================================== > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/miscexprs.exp,v > retrieving revision 1.5 > diff -u -p -r1.5 miscexprs.exp > --- miscexprs.exp 2001/03/06 08:21:50 1.5 > +++ miscexprs.exp 2001/10/31 20:18:04 > @@ -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." > } > -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA]: testsuite/gdb.base/miscexprs.* 2001-10-31 12:33 ` Fernando Nasser @ 2001-10-31 13:00 ` Corinna Vinschen 0 siblings, 0 replies; 7+ messages in thread From: Corinna Vinschen @ 2001-10-31 13:00 UTC (permalink / raw) To: gdb-patches On Wed, Oct 31, 2001 at 03:33:09PM -0500, Fernando Nasser wrote: > And it is already done!!! > > Yes, it is OK with me. > > > Regards, > Fernando Applied. Thanks for the quick approval! Corinna ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA]: testsuite/gdb.base/miscexprs.* 2001-10-31 11:39 ` Michael Snyder 2001-10-31 12:20 ` Corinna Vinschen @ 2001-10-31 12:32 ` Fernando Nasser 1 sibling, 0 replies; 7+ messages in thread From: Fernando Nasser @ 2001-10-31 12:32 UTC (permalink / raw) To: Michael Snyder; +Cc: gdb-patches Michael Snyder wrote: > > Corinna Vinschen wrote: > > > > Hi, > > > > on my target I have the same problem with the very small (2K) stack > > when running miscexprs.exp as I already had with call-ar-st.exp. > > > > I would like to propose the following patch, which adds the ability > > to extend miscexprs.exp for targets, which also suffer from the > > small stack. I added a compiler switch to define the preprocessor > > symbol `STORAGE', which by default is set to empty. A target > > specific conditional can be used for setting it to "static", to > > allow running the tests with the datastructures allocated in the > > global data area instead of on the stack. Obviously, miscexprs.exp > > in the below incarantion just contains such a conditional only for > > the target I'm just working on... > > This is a good step, and I'm in favor of accepting it. > I'd just like to suggest that an even better approach > might be to add a dejagnu variable that could be defined > in the baseboard file, rather than put a target ifdef in > the testsuite script. > > Something like this: > baseboard file: > set_board_info gdb, small_stack_section, 1 > set_board_info gdb, small_data_section, 1 // future extension > testsuite file: > if [target_info exists gdb,small_stack_section] { > set storage "-DSTORAGE=static" > } > I was simultaneously writting the same thing. Thanks Michael, small_stack_section is better than smallstack. -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA]: testsuite/gdb.base/miscexprs.* 2001-10-31 8:53 [RFA]: testsuite/gdb.base/miscexprs.* Corinna Vinschen 2001-10-31 11:39 ` Michael Snyder @ 2001-10-31 12:27 ` Fernando Nasser 1 sibling, 0 replies; 7+ messages in thread From: Fernando Nasser @ 2001-10-31 12:27 UTC (permalink / raw) To: gdb-patches Corinna Vinschen wrote: > > Hi, > > on my target I have the same problem with the very small (2K) stack > when running miscexprs.exp as I already had with call-ar-st.exp. > > I would like to propose the following patch, which adds the ability > to extend miscexprs.exp for targets, which also suffer from the > small stack. I added a compiler switch to define the preprocessor > symbol `STORAGE', which by default is set to empty. A target > specific conditional can be used for setting it to "static", to > allow running the tests with the datastructures allocated in the > global data area instead of on the stack. Hmm, I would have just set a, lets say, 'flag' variable and added it to the gdb_compile statement "additional_flags= $flag -w" (see long_long.exp). But don't bother, some other places even forgot the -w. > Obviously, miscexprs.exp > in the below incarantion just contains such a conditional only for > the target I'm just working on... > Well, this one gets me a little bit more concerned. It is very possible that other targets have the same problem as yours. And, most important of all, this is more of a board limitation than an architecture (which is what the target triple defines) limitation. Or isn't it possible that someone uses this chip to create a board with a larger stack memory? In this cases, we create an entry in the board info and set it (in the boards file) with set_board_info gdb,smallstack 1; And test it (in the tests file) with if [target_info exists gdb,smallstack] { > Corinna > > 2001-10-31 Corinna Vinschen <vinschen@redhat.com> > > * 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. > > Index: miscexprs.c > =================================================================== > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/miscexprs.c,v > retrieving revision 1.1.1.2 > diff -u -p -r1.1.1.2 miscexprs.c > --- miscexprs.c 1999/04/26 18:27:11 1.1.1.2 > +++ miscexprs.c 2001/10/31 16:43:01 > @@ -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; > > Index: miscexprs.exp > =================================================================== > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/miscexprs.exp,v > retrieving revision 1.5 > diff -u -p -r1.5 miscexprs.exp > --- miscexprs.exp 2001/03/06 08:21:50 1.5 > +++ miscexprs.exp 2001/10/31 16:43:01 > @@ -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 [istarget "stormy16-*-*"] then { > + 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." > } > -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-10-31 13:00 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2001-10-31 8:53 [RFA]: testsuite/gdb.base/miscexprs.* Corinna Vinschen 2001-10-31 11:39 ` Michael Snyder 2001-10-31 12:20 ` Corinna Vinschen 2001-10-31 12:33 ` Fernando Nasser 2001-10-31 13:00 ` Corinna Vinschen 2001-10-31 12:32 ` Fernando Nasser 2001-10-31 12:27 ` Fernando Nasser
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox