Make readelf more helpful when it cannot find a comp unit
Nick Clifton
nickc@redhat.com
Wed Dec 22 11:03:00 GMT 2004
Hi Guys,
Whilst looking at GCC bug 19124 I realised that readelf is not being
very helpful when it encounters a .debug_loc section which has more
comp_units than the .debug_info section. It really should issue a
warning message and then carry on to display the rest of the
section, rather than just stopping with an error message.
So I have written the attached patch to do just this. With this
patch applied the test case in gcc/19124 now produces this output
when run through "readelf -wo":
Contents of the .debug_loc section:
Offset Begin End Expression
00000000 00000000 0000000b (DW_OP_fbreg: 8)
00000000 0000000b 00000023 (DW_OP_reg3)
00000000 00000023 00000025 (DW_OP_fbreg: 8)
readelf: Warning: .debug_loc section has more comp units than .debug_info section
readelf: Warning: assuming that the pointer size is 4, from the last comp unit in .debug_info
0000002b 00000010 00000010 (DW_OP_reg1)
0000002b 0000001a 00000025 (DW_OP_reg1)
I will be committing this patch shortly.
Cheers
Nick
binutils/ChangeLog
2004-12-22 Nick Clifton <nickc@redhat.com>
* readelf.c (last_pointer_size, warned_about_missing_comp_units):
New variables associated with obtaining the pointer size for a
comp_unit.
(get_pointer_size_of_comp_unit): Add an extra parameter - the name
of the section requesting the pointer size. Use this name in
error messages. If there are not enough comp_units available
produce a warning message, but return the last known pointer size
so that section dumping can continue.
(get_debug_info): Reset the new variables.
(display_debug_lines): Add extra parameter to invocation of
get_pointer_size_of_comp_unit and remove error message when it
returns 0.
(display_debug_loc): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: readelf.c.patch
Type: text/x-patch
Size: 3916 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20041222/823e66e7/attachment.bin>
More information about the Binutils
mailing list