Re: gdb crash with -i=mi2

Elena Zannoni
2003-08-08T18:13:14Z

Try this as a workaround, seems to work for me:

Index: mi-interp.c
===================================================================
RCS file: /cvs/uberbaum/gdb/mi/mi-interp.c,v
retrieving revision 1.5
diff -u -p -r1.5 mi-interp.c
--- mi-interp.c 7 Aug 2003 17:47:42 -0000 1.5
+++ mi-interp.c 8 Aug 2003 18:12:49 -0000
@@ -409,7 +409,7 @@ _initialize_mi_interp (void)

/* The various interpreter levels. */
interp_add (interp_new (INTERP_MI1, NULL, mi_out_new (1), &procs));
- interp_add (interp_new (INTERP_MI2, NULL, mi_out_new (2), &procs));
+ /*interp_add (interp_new (INTERP_MI2, NULL, mi_out_new (2), &procs));*/
interp_add (interp_new (INTERP_MI3, NULL, mi_out_new (3), &procs));

/* "mi" selects the most recent released version. "mi2" was

Michael Elizabeth Chastain writes:
> The new mi2 tests are bombing out big time for me!
>
> % gdb -i=mi2
> Segmentation fault (core dumped)
>
> Here is a backtrace.
>
> #0 0x080c6e2a in interp_set (interp=0x0)
> at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/interps.c:160
> #1 0x080c6ee5 in interp_set (interp=0x82a1bc8)
> at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/interps.c:186
> #2 0x08077d69 in captured_main (data=0x0)
> at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/main.c:582
> #3 0x0810cd91 in do_catch_errors (uiout=0x8261fa0, data=0x1)
> at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/top.c:497
> #4 0x0810ccc0 in catcher (func=0x810cd80 <do_catch_errors>,
> func_uiout=0x8261fa0, func_args=0xbffff7d0, func_val=0xbffff7c8,
> func_caught=0xbffff7cc, errstring=0x1 <Address 0x1 out of bounds>, mask=6)
> at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/top.c:429
> #5 0x0810cdea in catch_errors (func=0x1, func_args=0x1,
> errstring=0x1 <Address 0x1 out of bounds>, mask=1)
> at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/top.c:509
> #6 0x08078591 in gdb_main (args=0x829b5c0)
> at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/main.c:820
> #7 0x0807772e in main (argc=1, argv=0x1)
> at /berman/fsf/_today_/source/gdb/HEAD/src/gdb/gdb.c:35
> #8 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
>
> This happens with:
>
> gdb HEAD 2003-08-07 20:28:13 UTC
>
> It also happens with:
>
> gdb HEAD 2003-08-07 20:31:55 UTC
>
> native i686-pc-linux-gnu, red hat linux 8.
> gdb built with gcc 3.3, binutils 2.14.
>
> It's happening in this code:
>
> 180 /* Clear out any installed interpreter hooks/event handlers. */
> 181 clear_interpreter_hooks ();
> 182
> 183 if (interp->procs->resume_proc != NULL
> 184 && (!interp->procs->resume_proc (interp->data)))
> 185 {
> 186 if (!interp_set (old_interp))
> 187 internal_error (__FILE__, __LINE__,
> 188 "Failed to initialize new interp \"%s\" %s",
> 189 interp->name, "and could not restore old interp!
> \n");
>
> This is calling interp_set recursively with old_interp=0x0
> (as shown in the stack trace).
>
> Michael C