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: [PATCH] use error, not internal_error, in dwarf2-frame.c


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.


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