Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH RFA] gdb.base/signals.exp: explicitly set count = 0
@ 2001-03-15  5:54 Orjan Friberg
  2001-03-15  6:32 ` Fernando Nasser
  0 siblings, 1 reply; 3+ messages in thread
From: Orjan Friberg @ 2001-03-15  5:54 UTC (permalink / raw)
  To: gdb-patches

gdb.base/signals.exp runs the main function in signals.c twice. 
signal.c contains a static variable count which is initialized to 0. 
The second time the main function is run, the test case relies on count
being 0, which depends on how runto_main is implemented for the target. 
My target does a simple "jump *main", which obviously doesn't
re-initialize count to 0.  This patch sets count to 0 explicitly.

Ok to commit?

2001-03-15  Orjan Friberg  <orjanf@axis.com>

	* gdb.base/signals.exp: Set count to 0 explicitly.


Index: signals.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/signals.exp,v
retrieving revision 1.2
diff -c -3 -p -r1.2 signals.exp
*** signals.exp 2001/03/06 08:21:51     1.2
--- signals.exp 2001/03/15 13:35:40
*************** gdb_expect {
*** 370,375 ****
--- 370,378 ----
  }
  
  if [runto_main] then {
+     # Since count is a static variable outside main, runto_main
+     # is no guarantee that count will be 0 at this point.
+     gdb_test "set variable count = 0" ""
      gdb_test "break handler if 0" "Breakpoint \[0-9\]+ .*"
      gdb_test "set \$handler_breakpoint_number = \$bpnum" ""
  

-- 
Orjan Friberg              E-mail: orjan.friberg@axis.com
Axis Communications AB     Phone:  +46 46 272 17 68


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RFA] gdb.base/signals.exp: explicitly set count = 0
  2001-03-15  5:54 [PATCH RFA] gdb.base/signals.exp: explicitly set count = 0 Orjan Friberg
@ 2001-03-15  6:32 ` Fernando Nasser
  2001-03-16  1:08   ` Orjan Friberg
  0 siblings, 1 reply; 3+ messages in thread
From: Fernando Nasser @ 2001-03-15  6:32 UTC (permalink / raw)
  To: Orjan Friberg; +Cc: gdb-patches

Orjan Friberg wrote:
> 
> gdb.base/signals.exp runs the main function in signals.c twice.
> signal.c contains a static variable count which is initialized to 0.
> The second time the main function is run, the test case relies on count
> being 0, which depends on how runto_main is implemented for the target.
> My target does a simple "jump *main", which obviously doesn't
> re-initialize count to 0.  This patch sets count to 0 explicitly.
> 
> Ok to commit?
> 

Yes.  

The way it is implemented now also depends on the effect of rerunning a
program in static variables.  For some remote targets this can also
imply that count is not zero if one does not "load" again (in case
someone did not specify "do_reload_on_run" for the target  --  although
this would be a mistake IMO).

Fernando


> 2001-03-15  Orjan Friberg  <orjanf@axis.com>
> 
>         * gdb.base/signals.exp: Set count to 0 explicitly.
> 
> Index: signals.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/signals.exp,v
> retrieving revision 1.2
> diff -c -3 -p -r1.2 signals.exp
> *** signals.exp 2001/03/06 08:21:51     1.2
> --- signals.exp 2001/03/15 13:35:40
> *************** gdb_expect {
> *** 370,375 ****
> --- 370,378 ----
>   }
> 
>   if [runto_main] then {
> +     # Since count is a static variable outside main, runto_main
> +     # is no guarantee that count will be 0 at this point.
> +     gdb_test "set variable count = 0" ""
>       gdb_test "break handler if 0" "Breakpoint \[0-9\]+ .*"
>       gdb_test "set \$handler_breakpoint_number = \$bpnum" ""
> 
> 
> --
> Orjan Friberg              E-mail: orjan.friberg@axis.com
> Axis Communications AB     Phone:  +46 46 272 17 68

-- 
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] 3+ messages in thread

* Re: [PATCH RFA] gdb.base/signals.exp: explicitly set count = 0
  2001-03-15  6:32 ` Fernando Nasser
@ 2001-03-16  1:08   ` Orjan Friberg
  0 siblings, 0 replies; 3+ messages in thread
From: Orjan Friberg @ 2001-03-16  1:08 UTC (permalink / raw)
  To: gdb-patches

Fernando Nasser wrote:
> 
> Orjan Friberg wrote:
> >
> > gdb.base/signals.exp runs the main function in signals.c twice.
> > signal.c contains a static variable count which is initialized to 0.
> > The second time the main function is run, the test case relies on count
> > being 0, which depends on how runto_main is implemented for the target.
> > My target does a simple "jump *main", which obviously doesn't
> > re-initialize count to 0.  This patch sets count to 0 explicitly.
> >
> > Ok to commit?
> >
> 
> Yes.
> 

Committed.  Thanks.

-- 
Orjan Friberg              E-mail: orjan.friberg@axis.com
Axis Communications AB     Phone:  +46 46 272 17 68


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-03-16  1:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-15  5:54 [PATCH RFA] gdb.base/signals.exp: explicitly set count = 0 Orjan Friberg
2001-03-15  6:32 ` Fernando Nasser
2001-03-16  1:08   ` Orjan Friberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox