From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12912 invoked by alias); 8 Sep 2003 14:52:14 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 12904 invoked from network); 8 Sep 2003 14:52:13 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 8 Sep 2003 14:52:13 -0000 Received: from drow by nevyn.them.org with local (Exim 4.22 #1 (Debian)) id 19wNNF-0005nD-I3 for ; Mon, 08 Sep 2003 10:52:13 -0400 Date: Mon, 08 Sep 2003 14:52:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: [RFA] testsuite/gdb.base/bang.exp: Allow trailing text after "Program exited normally" Message-ID: <20030908145213.GA21898@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20030908114200.GG1859@cygbert.vinschen.de> <20030908132716.GA17563@nevyn.them.org> <20030908142959.GH1859@cygbert.vinschen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030908142959.GH1859@cygbert.vinschen.de> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-09/txt/msg00117.txt.bz2 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 * 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",