From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14397 invoked by alias); 18 Dec 2010 02:19:43 -0000 Received: (qmail 14389 invoked by uid 22791); 18 Dec 2010 02:19:43 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from imr3.ericy.com (HELO imr3.ericy.com) (198.24.6.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 18 Dec 2010 02:19:36 +0000 Received: from eusaamw0707.eamcs.ericsson.se ([147.117.20.32]) by imr3.ericy.com (8.13.8/8.13.8) with ESMTP id oBI2JDpG012752 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Fri, 17 Dec 2010 20:19:14 -0600 Received: from EUSAACMS0703.eamcs.ericsson.se ([169.254.1.63]) by eusaamw0707.eamcs.ericsson.se ([147.117.20.32]) with mapi; Fri, 17 Dec 2010 21:19:13 -0500 From: Marc Khouzam To: Tom Tromey , "brobecker@adacore.com" CC: "gdb-patches@sourceware.org" Date: Sat, 18 Dec 2010 02:19:00 -0000 Subject: RE: Assertion failure because of missing inferior Message-ID: References: , In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: 2010-12/txt/msg00352.txt.bz2 From: Tom Tromey [tromey@redhat.com] >>>>> "Marc" =3D=3D Marc Khouzam writes: Marc> What do you think of the below for 7_2? Marc> 2010-12-10 Marc Khouzam Marc> * mi/mi-main.c (mi_cmd_remove_inferior): Don't delete current infe= rior. Marc> (get_other_inferior): New. > I think this is ok for the 7.2 branch, assuming Joel didn't do the > release already :) Now that all issues seem to be fixed when removing an inferior using CLI, I committed the below to HEAD and 7_2. Thanks for delaying 7.2.1 to wait for these fixes. It will be really usefu= l for Eclipse. I'm gonna submit another patch for http://sourceware.org/ml/gdb/2010-12/msg00039.html (missing check to prevent removing a running inferior) but that is not important for 7_2 (unless you guys want it there), so, from my side, there are no more issues for 7.2.1. Thanks again. Marc 2010-12-17 Marc Khouzam =20 * mi/mi-main.c (mi_cmd_remove_inferior): Don't delete current inferi= or. (get_other_inferior): New. ### Eclipse Workspace Patch 1.0 #P src Index: gdb/mi/mi-main.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/mi/mi-main.c,v retrieving revision 1.178.2.4 diff -u -r1.178.2.4 mi-main.c --- gdb/mi/mi-main.c 9 Dec 2010 19:22:59 -0000 1.178.2.4 +++ gdb/mi/mi-main.c 18 Dec 2010 01:54:10 -0000 @@ -1623,6 +1623,18 @@ ui_out_field_fmt (uiout, "inferior", "i%d", inf->num); } =20 +/* Callback used to find the first inferior other than the + current one. */ +=20=20=20 +static int +get_other_inferior (struct inferior *inf, void *arg) +{ + if (inf =3D=3D current_inferior ()) + return 0; + + return 1; +} + void mi_cmd_remove_inferior (char *command, char **argv, int argc) { @@ -1639,6 +1651,22 @@ if (!inf) error ("the specified thread group does not exist"); =20 + if (inf =3D=3D current_inferior ()) + { + struct thread_info *tp =3D 0; + struct inferior *new_inferior=20 + =3D iterate_over_inferiors (get_other_inferior, NULL); + + if (new_inferior =3D=3D NULL) + error (_("Cannot remove last inferior")); + + set_current_inferior (new_inferior); + if (new_inferior->pid !=3D 0) + tp =3D any_thread_of_process (new_inferior->pid); + switch_to_thread (tp ? tp->ptid : null_ptid); + set_current_program_space (new_inferior->pspace); + } + delete_inferior_1 (inf, 1 /* silent */); }