This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [MI] Segfault using 'interpreter-exec mi'
- From: Tom Tromey <tromey at redhat dot com>
- To: Marc Khouzam <marc dot khouzam at ericsson dot com>
- Cc: "'gdb-patches\ at sourceware dot org'" <gdb-patches at sourceware dot org>
- Date: Thu, 02 Dec 2010 09:35:09 -0700
- Subject: Re: [MI] Segfault using 'interpreter-exec mi'
- References: <F7CE05678329534C957159168FA70DEC572E7598F1@EUSAACMS0703.eamcs.ericsson.se>
>>>>> "Marc" == Marc Khouzam <marc.khouzam@ericsson.com> writes:
Marc> I got a segfault when using 'interpreter-exec mi' and getting an
Marc> error result. I believe I tracked it down to mi_parse(). From
Marc> what I can see, we cannot call error() from mi_parse() because it
Marc> does not catch exceptions.
Marc> Note that the segfault does not happen in full MI mode, I think because
Marc> we are in the correct interpreter for output, however, the MI command
Marc> does not get the proper ^error and requires the user to enter a new line
Marc> to get the ^done.
Thanks for the patch.
Marc> The below patch removes the calls to error() and uses fprintf_unfiltered.
Marc> Because of the comment
Marc> /* FIXME: This should be a function call. */
Marc> I took the opportunity to make a method mi_parse_error().
I don't mind this approach, but I think it is probably better to just
change mi_parse to use exceptions like the rest of gdb. Then the caller
can handle them, just like it does for exceptions occurring in the
actual MI command.
The reason I think this is better is that a rule like "this code cannot
call error" is reasonably difficult to enforce in gdb.
What do you think of that?
A quick nit about the patch itself.
Marc> +void
Marc> +vmi_parse_error (struct mi_parse *parse, const char *format, va_list args)
The new functions need introductory comments.
I would have made them both static.
Tom