From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23734 invoked by alias); 18 Dec 2010 02:47:04 -0000 Received: (qmail 23724 invoked by uid 22791); 18 Dec 2010 02:47:03 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from imr4.ericy.com (HELO imr4.ericy.com) (198.24.6.8) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 18 Dec 2010 02:46:58 +0000 Received: from eusaamw0707.eamcs.ericsson.se ([147.117.20.32]) by imr4.ericy.com (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id oBI3Ia9j032728; Fri, 17 Dec 2010 21:18:37 -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:46:39 -0500 From: Marc Khouzam To: Pedro Alves , Tom Tromey CC: "gdb-patches@sourceware.org" Date: Sat, 18 Dec 2010 02:47:00 -0000 Subject: RE: segfault: what should happen when I remove an inferior that is running? Message-ID: References: ,<201012141523.51109.pedro@codesourcery.com> In-Reply-To: <201012141523.51109.pedro@codesourcery.com> 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/msg00354.txt.bz2 From: Pedro Alves [pedro@codesourcery.com] Sent: December 14, 2010 10:23 AM > On Tuesday 14 December 2010 15:08:31, Tom Tromey wrote: > > Removes the inferior INFNO. It is not possible to remove an > > inferior that is running with this command. > > > > I think this means we are missing an error check somewhere. >=20 > Yeah. I guess we could also offer to kill it or some such, > but I guess I must have thought that it'd be simpler to > just error out. (either way, the user needs to take further > action, so erroring out is simpler.) This patch errors out for 'remove-inferior' and '-remove-inferior' if the inferior still has a pid. No regressions. If it is ok, please let me know if you want it only in HEAD or also in 7_2. Thanks Marc 2010-12-17 Marc Khouzam * inferior.c (remove_inferior_command): Don't remove a running infe= rior. * mi/mi-main.c (mi_cmd_remove_inferior): Ditto. ### Eclipse Workspace Patch 1.0 #P src Index: gdb/inferior.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/inferior.c,v retrieving revision 1.20 diff -u -r1.20 inferior.c --- gdb/inferior.c 28 Nov 2010 04:31:24 -0000 1.20 +++ gdb/inferior.c 18 Dec 2010 02:39:50 -0000 @@ -755,6 +755,9 @@ if (inf =3D=3D current_inferior ()) error (_("Can not remove current symbol inferior.")); =20 + if (inf->pid !=3D 0) + error (_("Can not remove a running inferior.")); + delete_inferior_1 (inf, 1); } =20 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.184 diff -u -r1.184 mi-main.c --- gdb/mi/mi-main.c 18 Dec 2010 02:10:05 -0000 1.184 +++ gdb/mi/mi-main.c 18 Dec 2010 02:39:50 -0000 @@ -1772,6 +1772,9 @@ if (!inf) error ("the specified thread group does not exist"); =20 + if (inf->pid !=3D 0) + error ("can not remove a running inferior"); + if (inf =3D=3D current_inferior ()) { struct thread_info *tp =3D 0;