Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Marc Khouzam <marc.khouzam@ericsson.com>
Cc: Tom Tromey <tromey@redhat.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: segfault: what should happen when I remove an inferior that is running?
Date: Wed, 22 Dec 2010 12:10:00 -0000	[thread overview]
Message-ID: <201012221210.30198.pedro@codesourcery.com> (raw)
In-Reply-To: <F7CE05678329534C957159168FA70DEC572E0C0E31@EUSAACMS0703.eamcs.ericsson.se>

On Saturday 18 December 2010 02:46:39, Marc Khouzam wrote:
> 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.
> > 
> > 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.

"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).

> 
> Thanks
> 
> Marc
> 
> 2010-12-17  Marc Khouzam  <marc.khouzam@ericsson.com>
> 
>         * inferior.c (remove_inferior_command): Don't remove a running inferior.
> 	* mi/mi-main.c (mi_cmd_remove_inferior): Ditto.
> 
> ### Eclipse Workspace Patch 1.0
> #P src
> Index: gdb/inferior.c
> ===================================================================
> 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 == current_inferior ())
>      error (_("Can not remove current symbol inferior."));
>  
> +  if (inf->pid != 0)
> +    error (_("Can not remove a running inferior."));
> +
>    delete_inferior_1 (inf, 1);
>  }
>  
> Index: gdb/mi/mi-main.c
> ===================================================================
> 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");
>  
> +  if (inf->pid != 0)
> +    error ("can not remove a running inferior");
> +
>    if (inf == current_inferior ())
>      {
>        struct thread_info *tp = 0;
> 


  reply	other threads:[~2010-12-22 12:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <F7CE05678329534C957159168FA70DEC572E0C0E1A@EUSAACMS0703.eamcs.ericsson.se>
     [not found] ` <m3oc8otms0.fsf@fleche.redhat.com>
     [not found]   ` <201012141523.51109.pedro@codesourcery.com>
2010-12-18  2:47     ` Marc Khouzam
2010-12-22 12:10       ` Pedro Alves [this message]
2010-12-22 18:32         ` Marc Khouzam
2010-12-22 18:45           ` Pedro Alves
2010-12-22 22:02             ` Marc Khouzam
2010-12-23  4:02               ` Joel Brobecker
2010-12-23  5:27                 ` Joel Brobecker
2011-01-06 18:57                   ` Marc Khouzam
2011-01-06 20:17                     ` Tom Tromey
2011-01-06 20:37                       ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201012221210.30198.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=marc.khouzam@ericsson.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox