Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Marc Khouzam <marc.khouzam@ericsson.com>
To: Tom Tromey <tromey@redhat.com>,
	       "brobecker@adacore.com"	<brobecker@adacore.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: Assertion failure because of missing inferior
Date: Sat, 18 Dec 2010 02:19:00 -0000	[thread overview]
Message-ID: <F7CE05678329534C957159168FA70DEC572E0C0E30@EUSAACMS0703.eamcs.ericsson.se> (raw)
In-Reply-To: <m3zks8tnmg.fsf@fleche.redhat.com>

From: Tom Tromey [tromey@redhat.com]

>>>>> "Marc" == Marc Khouzam <marc.khouzam@ericsson.com> writes:

Marc> What do you think of the below for 7_2?

Marc> 2010-12-10  Marc Khouzam  <marc.khouzam@ericsson.com>
Marc>    * mi/mi-main.c (mi_cmd_remove_inferior): Don't delete current inferior.
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 useful 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  <marc.khouzam@ericsson.com>
 
       * mi/mi-main.c (mi_cmd_remove_inferior): Don't delete current inferior.
       (get_other_inferior): New.

### Eclipse Workspace Patch 1.0
#P src
Index: gdb/mi/mi-main.c
===================================================================
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);
 }
 
+/* Callback used to find the first inferior other than the
+   current one. */
+   
+static int
+get_other_inferior (struct inferior *inf, void *arg)
+{
+  if (inf == 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");
 
+  if (inf == current_inferior ())
+    {
+      struct thread_info *tp = 0;
+      struct inferior *new_inferior 
+       = iterate_over_inferiors (get_other_inferior, NULL);
+
+      if (new_inferior == NULL)
+       error (_("Cannot remove last inferior"));
+
+      set_current_inferior (new_inferior);
+      if (new_inferior->pid != 0)
+       tp = 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 */);
 }


  parent reply	other threads:[~2010-12-18  2:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-04 19:11 Marc Khouzam
2010-12-07 18:54 ` Tom Tromey
2010-12-08  1:38   ` Marc Khouzam
2010-12-10 19:59     ` Tom Tromey
2010-12-10 20:21       ` Marc Khouzam
2010-12-10 21:01         ` Marc Khouzam
2010-12-10 21:38           ` Marc Khouzam
2010-12-14 14:50             ` Tom Tromey
2010-12-14 15:04               ` Joel Brobecker
2010-12-14 15:31                 ` Pedro Alves
2010-12-15  5:12                   ` Joel Brobecker
2010-12-14 20:00                 ` Marc Khouzam
2010-12-15 15:57                   ` [Python] Segfault when clearing pspace (was: RE: Assertion failure because of missing inferior) Marc Khouzam
2010-12-16 21:26                     ` [Python] Segfault when clearing pspace Tom Tromey
2010-12-18  2:13                       ` Marc Khouzam
2010-12-18  2:19               ` Marc Khouzam [this message]
2010-12-14 14:49           ` Assertion failure because of missing inferior Tom Tromey

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=F7CE05678329534C957159168FA70DEC572E0C0E30@EUSAACMS0703.eamcs.ericsson.se \
    --to=marc.khouzam@ericsson.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --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