This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: gdb crash with -i=mi2
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: Michael Elizabeth Chastain <mec at shout dot net>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Fri, 08 Aug 2003 14:28:34 -0400
- Subject: Re: gdb crash with -i=mi2
- References: <200308081712.h78HCqKM015964@duracef.shout.net>
The new mi2 tests are bombing out big time for me!
% gdb -i=mi2
Segmentation fault (core dumped)
Here is a backtrace.
Sorry (this goes into the "how did I miss it category"). Fix attached.
Still testing it though.
Andrew
2003-08-08 Andrew Cagney <cagney@redhat.com>
* interps.c (interp_set): Check for a NULL "old_interp".
Index: mi/ChangeLog
2003-08-08 Andrew Cagney <cagney@redhat.com>
* mi-main.c (captured_mi_execute_command): Add "mi2" and "mi3" to
interpreters that hack around CLI.
* mi-interp.c (mi3_command_loop): New function.
(mi_interpreter_resume): Check for "mi3", default to "mi2".
Index: interps.c
===================================================================
RCS file: /cvs/src/src/gdb/interps.c,v
retrieving revision 1.5
diff -u -r1.5 interps.c
--- interps.c 8 Jun 2003 18:27:13 -0000 1.5
+++ interps.c 8 Aug 2003 18:23:12 -0000
@@ -183,7 +183,7 @@
if (interp->procs->resume_proc != NULL
&& (!interp->procs->resume_proc (interp->data)))
{
- if (!interp_set (old_interp))
+ if (old_interp == NULL || !interp_set (old_interp))
internal_error (__FILE__, __LINE__,
"Failed to initialize new interp \"%s\" %s",
interp->name, "and could not restore old interp!\n");
Index: mi/mi-interp.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-interp.c,v
retrieving revision 1.4.4.1
diff -u -r1.4.4.1 mi-interp.c
--- mi/mi-interp.c 7 Aug 2003 18:09:30 -0000 1.4.4.1
+++ mi/mi-interp.c 8 Aug 2003 18:23:30 -0000
@@ -60,6 +60,7 @@
static char *mi_interp_read_one_line_hook (char *prompt, int repeat,
char *anno);
+static void mi3_command_loop (void);
static void mi2_command_loop (void);
static void mi1_command_loop (void);
@@ -133,10 +134,12 @@
/* If we're _the_ interpreter, take control. */
if (current_interp_named_p (INTERP_MI1))
command_loop_hook = mi1_command_loop;
- else if (current_interp_named_p (INTERP_MI))
+ else if (current_interp_named_p (INTERP_MI2))
command_loop_hook = mi2_command_loop;
+ else if (current_interp_named_p (INTERP_MI3))
+ command_loop_hook = mi3_command_loop;
else
- return 0;
+ command_loop_hook = mi2_command_loop;
return 1;
}
@@ -331,6 +334,12 @@
mi2_command_loop (void)
{
mi_command_loop (2);
+}
+
+static void
+mi3_command_loop (void)
+{
+ mi_command_loop (3);
}
static void
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.48
diff -u -r1.48 mi-main.c
--- mi/mi-main.c 11 Jun 2003 19:38:27 -0000 1.48
+++ mi/mi-main.c 8 Aug 2003 18:23:31 -0000
@@ -1162,7 +1162,9 @@
/* If we changed interpreters, DON'T print out anything. */
if (current_interp_named_p (INTERP_MI)
- || current_interp_named_p (INTERP_MI1))
+ || current_interp_named_p (INTERP_MI1)
+ || current_interp_named_p (INTERP_MI2)
+ || current_interp_named_p (INTERP_MI3))
{
/* print the result */
/* FIXME: Check for errors here. */