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: [gdb6.6/6.7] undefined/not implemented MI command causes gdb crash (windows/linux)


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);


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