This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [gdb6.6/6.7] undefined/not implemented MI command causes gdb crash (windows/linux)
- From: Daniel Jacobowitz <drow at false dot org>
- To: Bogdan Slusarczyk <bodzio131 at op dot pl>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 16 Oct 2007 07:57:29 -0400
- Subject: Re: [gdb6.6/6.7] undefined/not implemented MI command causes gdb crash (windows/linux)
- References: <4713758E.6040807@op.pl> <20071015145956.GA21761@caradoc.them.org> <4714656F.4040008@op.pl>
On Tue, Oct 16, 2007 at 09:17:03AM +0200, Bogdan Slusarczyk wrote:
> linux:
> dummy
> &"dummy\n"
> &"Undefined command: \"dummy\". Try \"help\".\n"
> ^error,msg="Undefined command: \"dummy\". Try \"help\"."
> (gdb)
> -target-attach
> ^error,msg="Undefined mi command: target-attach (missing implementation)"
> ^error,msg=""
> (gdb)
> dummy
> &"dummy\n"
> Segmentation fault
Thanks for the test case. It really makes me happy when people can
supply exact test cases and we've been getting a lot of them lately :-)
I checked in this patch to trunk and the 6.7 branch to fix the
crash.
--
Daniel Jacobowitz
CodeSourcery
2007-10-16 Daniel Jacobowitz <dan@codesourcery.com>
* mi/mi-main.c (captured_mi_execute_command): Clear mi_error_message
after freeing it.
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.104
diff -u -p -r1.104 mi-main.c
--- mi/mi-main.c 16 Sep 2007 14:59:31 -0000 1.104
+++ mi/mi-main.c 16 Oct 2007 11:53:23 -0000
@@ -1161,6 +1161,7 @@ captured_mi_execute_command (struct ui_o
fputs_unfiltered ("^error,msg=\"", raw_stdout);
fputstr_unfiltered (mi_error_message, '"', raw_stdout);
xfree (mi_error_message);
+ mi_error_message = NULL;
fputs_unfiltered ("\"\n", raw_stdout);
}
mi_out_rewind (uiout);
@@ -1213,6 +1214,7 @@ captured_mi_execute_command (struct ui_o
fputs_unfiltered ("^error,msg=\"", raw_stdout);
fputstr_unfiltered (mi_error_message, '"', raw_stdout);
xfree (mi_error_message);
+ mi_error_message = NULL;
fputs_unfiltered ("\"\n", raw_stdout);
}
mi_out_rewind (uiout);