From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15311 invoked by alias); 20 May 2009 20:43:10 -0000 Received: (qmail 15298 invoked by uid 22791); 20 May 2009 20:43:09 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_32,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 May 2009 20:43:04 +0000 Received: (qmail 7202 invoked from network); 20 May 2009 20:43:02 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 20 May 2009 20:43:02 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch] Fix gdb.mi internal_error on killing inferior Date: Wed, 20 May 2009 20:43:00 -0000 User-Agent: KMail/1.9.10 Cc: Jan Kratochvil References: <20090520202749.GA17984@host0.dyn.jankratochvil.net> In-Reply-To: <20090520202749.GA17984@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905202143.17772.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00435.txt.bz2 On Wednesday 20 May 2009 21:27:49, Jan Kratochvil wrote: > Hi, > > currently GDB crashes on killing multithreaded inferior. Just it will happen > only on quitting GDB because dejagnu already closed the communication with > GDB. > > With the included testcase without the fix it will print: > > (gdb) ^M > PASS: gdb.mi/mi-console.exp: finished step over hello > 998-target-attach^M > ~"A program is being debugged already. Kill it? (y or n) "y^M > ^M > &"Recursive internal problem.\n"^M > ERROR: Error testminating GDB. > testcase ../.././gdb/testsuite/gdb.mi/mi-console.exp completed in 1 seconds > Weird, I don't see this happening. Why is it that we reach terminal_ours with null_ptid? And I think that if this legitimate, we should still restore our process group, terminal settings and signal handlers. > > > Thanks, > Jan > > > gdb/ > 2009-05-20 Jan Kratochvil > > * inflow.c (terminal_ours_1): Return if INFERIOR_PTID is NULL_PTID. > > Gdb/testsuite/ > 2009-05-20 Jan Kratochvil > > * lib/mi-support.exp (mi_uncatched_gdb_exit): Explicitly terminate the > inferior. > > --- gdb/inflow.c 19 May 2009 10:08:19 -0000 1.50 > +++ gdb/inflow.c 20 May 2009 20:00:30 -0000 > @@ -361,6 +361,9 @@ terminal_ours_1 (int output_only) > if (terminal_is_ours) > return; > > + if (ptid_equal (inferior_ptid, null_ptid)) > + return; > + > /* Checking inferior->run_terminal is necessary so that > if GDB is running in the background, it won't block trying > to do the ioctl()'s below. Checking gdb_has_a_terminal > --- gdb/testsuite/lib/mi-support.exp 2 Apr 2009 15:43:10 -0000 1.83 > +++ gdb/testsuite/lib/mi-support.exp 20 May 2009 20:00:31 -0000 > @@ -61,6 +61,28 @@ proc mi_uncatched_gdb_exit {} { > > verbose "Quitting $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $MIFLAGS" > > + # Test successful termination of the inferior. It is an optional check, > + # inferior would get also terminated by -gdb-exit or remote_close below. > + > + if { [board_info host exists fileid] } { > + send_gdb "998-target-attach\n"; > + gdb_expect 10 { > + -re "y or n" { > + send_gdb "y\n"; > + exp_continue; > + } > + -re "Undefined command.*$gdb_prompt $" { > + send_gdb "quit\n" > + exp_continue; > + } > + -re "998\\^error,msg=\"Argument required \\(process-id to attach\\).\".*$gdb_prompt \r\n$" { > + } > + default { > + perror "Error terminating the inferior." > + } > + } > + } > + > if { [is_remote host] && [board_info host exists fileid] } { > send_gdb "999-gdb-exit\n"; > gdb_expect 10 { > -- Pedro Alves