This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Don't crash if parse_definition_macro's 'body' is NULL
- From: Tom Tromey <tom at tromey dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Mon, 13 May 2019 08:01:07 -0600
- Subject: Re: [PATCH] Don't crash if parse_definition_macro's 'body' is NULL
- References: <20190510210425.2750-1-sergiodj@redhat.com>
>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:
Sergio> This very simple patch is just a safeguard against this scenario; it
Sergio> is not a fix for the problem (which actually happens on "debugedit",
Sergio> and which Mark Wielaard is already working on), but at least it makes
Sergio> GDB not crash on invalid DWARF, which is a plus IMO.
I don't really get why read_direct_string (and the other functions like
it) returns NULL when it sees an empty string. How is something like
"#define X" represented such that this doesn't return NULL?
Other complaints in the caller of parse_macro_definition provide a bit
more context, like the macro name, source file, and line number:
complaint (_("debug info gives %s macro %s with %s line %d: %s"),
at_commandline ? _("command-line") : _("in-file"),
is_define ? _("definition") : _("undefinition"),
line == 0 ? _("zero") : _("non-zero"), line, body);
... so maybe the new complaint could as well.
Tom