* [RFA] testsuite/gdb.base/bang.exp: Allow trailing text after "Program exited normally"
@ 2003-09-08 11:42 Corinna Vinschen
2003-09-08 13:27 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2003-09-08 11:42 UTC (permalink / raw)
To: gdb-patches
Hi,
while testing I found that a test for ending the program in
gdb.base/bang.exp failed, even though the target had actually
exited normally. The cause of the FAIL is that bang.exp doesn't
expect anything after the string "Program exited normally.".
On the sh target at least, the output after exiting contains a
bit more text:
Program exited normally.
[Switching to process 0]
Since that trailing output after a normal exit doesn't change
anything with respect to the testresult, I propose to allow
trailing characters:
* testsuite/gdb.base/bang.exp: Allow trailing text after
"Program exited normally." string.
Index: testsuite/gdb.base/bang.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/bang.exp,v
retrieving revision 1.1
diff -u -p -r1.1 bang.exp
--- testsuite/gdb.base/bang.exp 24 Jun 2003 22:04:06 -0000 1.1
+++ testsuite/gdb.base/bang.exp 8 Sep 2003 11:29:38 -0000
@@ -36,6 +36,6 @@ gdb_load ${binfile}
# Verify that we can run the program and that it terminates normally.
gdb_test "run" \
- ".*Program exited normally\." \
+ ".*Program exited normally\..*" \
"run program"
Corinna
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [RFA] testsuite/gdb.base/bang.exp: Allow trailing text after "Program exited normally" 2003-09-08 11:42 [RFA] testsuite/gdb.base/bang.exp: Allow trailing text after "Program exited normally" Corinna Vinschen @ 2003-09-08 13:27 ` Daniel Jacobowitz 2003-09-08 14:30 ` Corinna Vinschen 2003-09-08 18:52 ` Andrew Cagney 0 siblings, 2 replies; 7+ messages in thread From: Daniel Jacobowitz @ 2003-09-08 13:27 UTC (permalink / raw) To: gdb-patches On Mon, Sep 08, 2003 at 01:42:01PM +0200, Corinna Vinschen wrote: > Hi, > > while testing I found that a test for ending the program in > gdb.base/bang.exp failed, even though the target had actually > exited normally. The cause of the FAIL is that bang.exp doesn't > expect anything after the string "Program exited normally.". > On the sh target at least, the output after exiting contains a > bit more text: > > Program exited normally. > [Switching to process 0] > > Since that trailing output after a normal exit doesn't change > anything with respect to the testresult, I propose to allow > trailing characters: But isn't the [Switching to process 0] a bug? We aren't switching processes, the inferior is dead. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] testsuite/gdb.base/bang.exp: Allow trailing text after "Program exited normally" 2003-09-08 13:27 ` Daniel Jacobowitz @ 2003-09-08 14:30 ` Corinna Vinschen 2003-09-08 14:52 ` Daniel Jacobowitz 2003-09-08 18:52 ` Andrew Cagney 1 sibling, 1 reply; 7+ messages in thread From: Corinna Vinschen @ 2003-09-08 14:30 UTC (permalink / raw) To: gdb-patches On Mon, Sep 08, 2003 at 09:27:17AM -0400, Daniel Jacobowitz wrote: > On Mon, Sep 08, 2003 at 01:42:01PM +0200, Corinna Vinschen wrote: > > Hi, > > > > while testing I found that a test for ending the program in > > gdb.base/bang.exp failed, even though the target had actually > > exited normally. The cause of the FAIL is that bang.exp doesn't > > expect anything after the string "Program exited normally.". > > On the sh target at least, the output after exiting contains a > > bit more text: > > > > Program exited normally. > > [Switching to process 0] > > > > Since that trailing output after a normal exit doesn't change > > anything with respect to the testresult, I propose to allow > > trailing characters: > > But isn't the [Switching to process 0] a bug? We aren't switching > processes, the inferior is dead. Actually I don't understand where's the bug. The above string is printed if previous_inferior_ptid != inferior_ptid in normal_stop(). previous_inferior_ptid is reproducible == {pid = 42, lwp = 0, tid = 0} while inferior_pid is set to all zero. The pid 42 is coming from remote-sim.c, function gdbsim_create_inferior, which always generates a pid 42. What's the exact problem with this? Corinna -- Corinna Vinschen Cygwin Developer Red Hat, Inc. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] testsuite/gdb.base/bang.exp: Allow trailing text after "Program exited normally" 2003-09-08 14:30 ` Corinna Vinschen @ 2003-09-08 14:52 ` Daniel Jacobowitz 2003-09-08 15:39 ` Corinna Vinschen 0 siblings, 1 reply; 7+ messages in thread From: Daniel Jacobowitz @ 2003-09-08 14:52 UTC (permalink / raw) To: gdb-patches On Mon, Sep 08, 2003 at 04:29:59PM +0200, Corinna Vinschen wrote: > On Mon, Sep 08, 2003 at 09:27:17AM -0400, Daniel Jacobowitz wrote: > > On Mon, Sep 08, 2003 at 01:42:01PM +0200, Corinna Vinschen wrote: > > > Hi, > > > > > > while testing I found that a test for ending the program in > > > gdb.base/bang.exp failed, even though the target had actually > > > exited normally. The cause of the FAIL is that bang.exp doesn't > > > expect anything after the string "Program exited normally.". > > > On the sh target at least, the output after exiting contains a > > > bit more text: > > > > > > Program exited normally. > > > [Switching to process 0] > > > > > > Since that trailing output after a normal exit doesn't change > > > anything with respect to the testresult, I propose to allow > > > trailing characters: > > > > But isn't the [Switching to process 0] a bug? We aren't switching > > processes, the inferior is dead. > > Actually I don't understand where's the bug. The above string is > printed if previous_inferior_ptid != inferior_ptid in normal_stop(). > previous_inferior_ptid is reproducible == {pid = 42, lwp = 0, tid = 0} > while inferior_pid is set to all zero. The pid 42 is coming from > remote-sim.c, function gdbsim_create_inferior, which always generates > a pid 42. What's the exact problem with this? Haven't we exited at this point? I'd think we should skip the Switching message in that case. If you take a look at normal_stop, it is trying to, but target_has_execution is still true for the sim at this point. I was thinking of this patch. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2003-09-08 Daniel Jacobowitz <drow@mvista.com> * infrun.c (normal_stop): Don't print a message if the inferior has exited. Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.111 diff -u -p -r1.111 infrun.c --- infrun.c 7 Sep 2003 15:15:01 -0000 1.111 +++ infrun.c 8 Sep 2003 14:50:59 -0000 @@ -3054,14 +3054,21 @@ print_stop_reason (enum inferior_stop_re void normal_stop (void) { + struct target_waitstatus last; + ptid_t last_ptid; + + get_last_target_status (&last_ptid, &last); + /* As with the notification of thread events, we want to delay notifying the user that we've switched thread context until the inferior actually stops. (Note that there's no point in saying anything if the inferior - has exited!) */ + has exited!) */ if (!ptid_equal (previous_inferior_ptid, inferior_ptid) - && target_has_execution) + && target_has_execution + && last.kind != TARGET_WAITKIND_SIGNALLED + && last.kind != TARGET_WAITKIND_EXITED) { target_terminal_ours_for_output (); printf_filtered ("[Switching to %s]\n", ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] testsuite/gdb.base/bang.exp: Allow trailing text after "Program exited normally" 2003-09-08 14:52 ` Daniel Jacobowitz @ 2003-09-08 15:39 ` Corinna Vinschen 0 siblings, 0 replies; 7+ messages in thread From: Corinna Vinschen @ 2003-09-08 15:39 UTC (permalink / raw) To: gdb-patches On Mon, Sep 08, 2003 at 10:52:13AM -0400, Daniel Jacobowitz wrote: > I was thinking of this patch. Looks good. Do you check this in? Corinna > 2003-09-08 Daniel Jacobowitz <drow@mvista.com> > > * infrun.c (normal_stop): Don't print a message if the inferior > has exited. > > Index: infrun.c > =================================================================== > RCS file: /cvs/src/src/gdb/infrun.c,v > retrieving revision 1.111 > diff -u -p -r1.111 infrun.c > --- infrun.c 7 Sep 2003 15:15:01 -0000 1.111 > +++ infrun.c 8 Sep 2003 14:50:59 -0000 > @@ -3054,14 +3054,21 @@ print_stop_reason (enum inferior_stop_re > void > normal_stop (void) > { > + struct target_waitstatus last; > + ptid_t last_ptid; > + > + get_last_target_status (&last_ptid, &last); > + > /* As with the notification of thread events, we want to delay > notifying the user that we've switched thread context until > the inferior actually stops. > > (Note that there's no point in saying anything if the inferior > - has exited!) */ > + has exited!) */ > if (!ptid_equal (previous_inferior_ptid, inferior_ptid) > - && target_has_execution) > + && target_has_execution > + && last.kind != TARGET_WAITKIND_SIGNALLED > + && last.kind != TARGET_WAITKIND_EXITED) > { > target_terminal_ours_for_output (); > printf_filtered ("[Switching to %s]\n", -- Corinna Vinschen Cygwin Developer Red Hat, Inc. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] testsuite/gdb.base/bang.exp: Allow trailing text after "Program exited normally" 2003-09-08 13:27 ` Daniel Jacobowitz 2003-09-08 14:30 ` Corinna Vinschen @ 2003-09-08 18:52 ` Andrew Cagney 2003-09-08 20:14 ` Daniel Jacobowitz 1 sibling, 1 reply; 7+ messages in thread From: Andrew Cagney @ 2003-09-08 18:52 UTC (permalink / raw) To: Daniel Jacobowitz, Corinna Vinschen; +Cc: gdb-patches > On Mon, Sep 08, 2003 at 01:42:01PM +0200, Corinna Vinschen wrote: > >> Hi, >> >> while testing I found that a test for ending the program in >> gdb.base/bang.exp failed, even though the target had actually >> exited normally. The cause of the FAIL is that bang.exp doesn't >> expect anything after the string "Program exited normally.". >> On the sh target at least, the output after exiting contains a >> bit more text: >> >> Program exited normally. >> [Switching to process 0] >> >> Since that trailing output after a normal exit doesn't change >> anything with respect to the testresult, I propose to allow >> trailing characters: > > > But isn't the [Switching to process 0] a bug? We aren't switching > processes, the inferior is dead. Yes. The message is both a bug and a very long standing regression. Andrew PS: Suggest a reminder comment that SIGNALED is really "terminated with signal" :-) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] testsuite/gdb.base/bang.exp: Allow trailing text after "Program exited normally" 2003-09-08 18:52 ` Andrew Cagney @ 2003-09-08 20:14 ` Daniel Jacobowitz 0 siblings, 0 replies; 7+ messages in thread From: Daniel Jacobowitz @ 2003-09-08 20:14 UTC (permalink / raw) To: gdb-patches On Mon, Sep 08, 2003 at 02:52:28PM -0400, Andrew Cagney wrote: > >On Mon, Sep 08, 2003 at 01:42:01PM +0200, Corinna Vinschen wrote: > > > >>Hi, > >> > >>while testing I found that a test for ending the program in > >>gdb.base/bang.exp failed, even though the target had actually > >>exited normally. The cause of the FAIL is that bang.exp doesn't > >>expect anything after the string "Program exited normally.". > >>On the sh target at least, the output after exiting contains a > >>bit more text: > >> > >> Program exited normally. > >> [Switching to process 0] > >> > >>Since that trailing output after a normal exit doesn't change > >>anything with respect to the testresult, I propose to allow > >>trailing characters: > > > > > >But isn't the [Switching to process 0] a bug? We aren't switching > >processes, the inferior is dead. > > Yes. The message is both a bug and a very long standing regression. > > Andrew > > PS: Suggest a reminder comment that SIGNALED is really "terminated with > signal" :-) Good idea. WIFSIGNALLED confuses me every time. Checked in to HEAD. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2003-09-08 Daniel Jacobowitz <drow@mvista.com> * infrun.c (normal_stop): Don't print a message if the inferior has exited. Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.111 diff -u -p -r1.111 infrun.c --- infrun.c 7 Sep 2003 15:15:01 -0000 1.111 +++ infrun.c 8 Sep 2003 20:12:29 -0000 @@ -3054,14 +3054,22 @@ print_stop_reason (enum inferior_stop_re void normal_stop (void) { + struct target_waitstatus last; + ptid_t last_ptid; + + get_last_target_status (&last_ptid, &last); + /* As with the notification of thread events, we want to delay notifying the user that we've switched thread context until the inferior actually stops. - (Note that there's no point in saying anything if the inferior - has exited!) */ + There's no point in saying anything if the inferior has exited. + Note that SIGNALLED here means "exited with a signal", not + "received a signal". */ if (!ptid_equal (previous_inferior_ptid, inferior_ptid) - && target_has_execution) + && target_has_execution + && last.kind != TARGET_WAITKIND_SIGNALLED + && last.kind != TARGET_WAITKIND_EXITED) { target_terminal_ours_for_output (); printf_filtered ("[Switching to %s]\n", ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-09-08 20:14 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-09-08 11:42 [RFA] testsuite/gdb.base/bang.exp: Allow trailing text after "Program exited normally" Corinna Vinschen 2003-09-08 13:27 ` Daniel Jacobowitz 2003-09-08 14:30 ` Corinna Vinschen 2003-09-08 14:52 ` Daniel Jacobowitz 2003-09-08 15:39 ` Corinna Vinschen 2003-09-08 18:52 ` Andrew Cagney 2003-09-08 20:14 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox