This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] use error, not internal_error, in dwarf2-frame.c
- From: Doug Evans <xdje42 at gmail dot com>
- To: Andrew Burgess <aburgess at broadcom dot com>
- Cc: gdb-patches at sourceware dot org, Tom Tromey <tromey at redhat dot com>
- Date: Thu, 14 Nov 2013 09:58:09 -0800
- Subject: Re: [PATCH] use error, not internal_error, in dwarf2-frame.c
- Authentication-results: sourceware.org; auth=none
- References: <1384375392-32110-1-git-send-email-tromey at redhat dot com> <5284B2BB dot 3090800 at broadcom dot com>
On Thu, Nov 14, 2013 at 3:23 AM, Andrew Burgess <aburgess@broadcom.com> wrote:
> On 13/11/2013 8:43 PM, Tom Tromey wrote:
>>
>> I think that gdb should not call internal_error for bad DWARF.
>> Instead, it should simply throw an ordinary exception.
>
> Sounds reasonable.
>
>>
>> diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
>> index e05236f..8f55e9f 100644
>> --- a/gdb/dwarf2-frame.c
>> +++ b/gdb/dwarf2-frame.c
>> @@ -680,8 +680,7 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
>> break;
>>
>> default:
>> - internal_error (__FILE__, __LINE__,
>> - _("Unknown CFI encountered."));
>> + error (_("Unknown CFI encountered."));
>
> I wonder if we could make this error message clearer? Will an "average"
> user understand what a CFI is? How about something like:
>
> "Invalid DWARF debugging information: Unknown CFI encountered"
>
> This might give a better idea what is going on. If you agree then the
> same applies to the rest of these errors too.
>
> Just a thought.
There's a convention for the style of these kinds of messages in dwarf2read.c.
IWBN to use the same convention here.
"Dwarf Error: blah [in module %s]"
E.g.,
if (header->version != 2 && header->version != 3 && header->version != 4)
error (_("Dwarf Error: wrong version in compilation unit header "
"(is %d, should be 2, 3, or 4) [in module %s]"), header->version,
filename);
I didn't check to see whether the file name is available in any of the
instances in dwarf2-frame.c, but if available IWBN to print it.