From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 374 invoked by alias); 22 Dec 2010 18:12:15 -0000 Received: (qmail 364 invoked by uid 22791); 22 Dec 2010 18:12:12 -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; Wed, 22 Dec 2010 18:12:06 +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 oBMIikMH030723; Wed, 22 Dec 2010 12:44:48 -0600 Received: from EUSAACMS0703.eamcs.ericsson.se ([169.254.1.66]) by eusaamw0707.eamcs.ericsson.se ([147.117.20.32]) with mapi; Wed, 22 Dec 2010 13:11:48 -0500 From: Marc Khouzam To: "'Pedro Alves'" CC: "'Tom Tromey'" , "'gdb-patches@sourceware.org'" Date: Wed, 22 Dec 2010 18:32:00 -0000 Subject: RE: segfault: what should happen when I remove an inferior that is running? Message-ID: References: <201012141523.51109.pedro@codesourcery.com> <201012221210.30198.pedro@codesourcery.com> In-Reply-To: <201012221210.30198.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/msg00409.txt.bz2 =20 > -----Original Message----- > From: Pedro Alves [mailto:pedro@codesourcery.com]=20 > Sent: Wednesday, December 22, 2010 7:10 AM > To: Marc Khouzam > Cc: Tom Tromey; gdb-patches@sourceware.org > Subject: Re: segfault: what should happen when I remove an=20 > inferior that is running? >=20 > On Saturday 18 December 2010 02:46:39, Marc Khouzam wrote: > > From: Pedro Alves [pedro@codesourcery.com] > > Sent: December 14, 2010 10:23 AM > >=20 > > > On Tuesday 14 December 2010 15:08:31, Tom Tromey wrote: > > > > Removes the inferior INFNO. It is not possible to=20 > 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.) > >=20 > > This patch errors out for 'remove-inferior' and '-remove-inferior' > > if the inferior still has a pid. > >=20 > > No regressions. > >=20 > > If it is ok, please let me know if you want it only in HEAD or > > also in 7_2. >=20 > "running inferior" will sound a bit odd for cores, but, > since I don't have a better suggestion that wouldn't involve > more coding, this is okay with me (HEAD and 7_2). Would "Can not remove a an active inferior." be better? Marc > >=20 > > 2010-12-17 Marc Khouzam > >=20 > > * inferior.c (remove_inferior_command): Don't=20 > remove a running inferior. > > * mi/mi-main.c (mi_cmd_remove_inferior): Ditto. > >=20 > > ### 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=20 > > + if (inf->pid !=3D 0) > > + error (_("Can not remove a running inferior.")); > > + > > delete_inferior_1 (inf, 1); > > } > >=20=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=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; > >=20 >=20