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: [MI] Segfault using 'interpreter-exec mi'


>>>>> "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


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