From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9332 invoked by alias); 10 Feb 2012 14:41:02 -0000 Received: (qmail 8996 invoked by uid 22791); 10 Feb 2012 14:40:59 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Feb 2012 14:40:45 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1AEej96003279 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 10 Feb 2012 09:40:45 -0500 Received: from host2.jankratochvil.net (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1AEefgN024841 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 10 Feb 2012 09:40:43 -0500 Date: Fri, 10 Feb 2012 14:41:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: RFC: fix crash when inferior exits during "continue" Message-ID: <20120210144040.GA28038@host2.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2012-02/txt/msg00196.txt.bz2 On Tue, 07 Feb 2012 20:13:54 +0100, Tom Tromey wrote: > Built and regtested on x86-64 Fedora 15. It does crash for me on F-15 but it does not crash on either F-16 or F-17. > b/gdb/ChangeLog: Missing testsuite/ ChangeLog. > --- /dev/null > +++ b/gdb/testsuite/gdb.base/inferior-died.exp > @@ -0,0 +1,56 @@ > +# Copyright 2012 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > + > +if { [is_remote target] || ![isnative] } then { "isnative" is excessive"; but linux-nat cannot be cross-target anyway. > + unsupported "inferior-died.exp" > + continue > +} > + > +# Until "set follow-fork-mode" and "catch fork" are implemented on > +# other targets... > +# > +if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-*-linux*"]} then { > + unsupported "inferior-died.exp" > + continue > +} > + > +if { ![support_displaced_stepping] } { > + unsupported "inferior-died.exp" > + return -1 > +} > + [...] > --- a/gdb/thread.c > +++ b/gdb/thread.c [...] > @@ -1091,8 +1101,15 @@ do_restore_current_thread_cleanup (void *arg) > restore_current_thread (old->inferior_ptid); > else > { > + struct inferior *inf = find_inferior_id (old->inf_id); > + > restore_current_thread (null_ptid); > - set_current_inferior (find_inferior_id (old->inf_id)); > + > + /* If the inferior was deleted, choose some other inferior. */ Maybe during make_cleanup_restore_current_thread temporarily remember + clear inferior->removable instead. > + if (inf == NULL) > + inf = iterate_over_inferiors (choose_first_inferior, NULL); > + > + set_current_inferior (inf); > } > > /* The running state of the originally selected thread may have Thanks, Jan