This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: segfault: what should happen when I remove an inferior that is running?


> -----Original Message-----
> From: Pedro Alves [mailto:pedro@codesourcery.com] 
> Sent: Wednesday, December 22, 2010 1:17 PM
> To: gdb-patches@sourceware.org
> Cc: Marc Khouzam; 'Tom Tromey'
> Subject: Re: segfault: what should happen when I remove an 
> inferior that is running?
> 
> On Wednesday 22 December 2010 18:11:45, Marc Khouzam wrote:
> > > > 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).
> > 
> > Would "Can not remove a an active inferior." be better?
> 
> Fine with me.

I committed the following to 7_2 and HEAD. 

Thanks

Marc

2010-12-22  Marc Khouzam  <marc.khouzam@ericsson.com>

       * inferior.c (remove_inferior_command): Don't remove an active 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.18
diff -u -r1.18 inferior.c
--- gdb/inferior.c      14 May 2010 21:25:51 -0000      1.18
+++ gdb/inferior.c      22 Dec 2010 18:18:55 -0000
@@ -741,6 +741,9 @@
 
   if (inf == current_inferior ())
     error (_("Can not remove current symbol inferior."));
+    
+  if (inf->pid != 0)
+    error (_("Can not remove an active 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.178.2.5
diff -u -r1.178.2.5 mi-main.c
--- gdb/mi/mi-main.c    18 Dec 2010 01:56:07 -0000      1.178.2.5
+++ gdb/mi/mi-main.c    22 Dec 2010 18:18:55 -0000
@@ -1651,6 +1651,9 @@
   if (!inf)
     error ("the specified thread group does not exist");
 
+  if (inf->pid != 0)
+    error ("can not remove an active inferior");
+
   if (inf == current_inferior ())
     {
       struct thread_info *tp = 0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]