This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
readelf patch
- From: Dean Luick <luick at cray dot com>
- To: binutils at sources dot redhat dot com
- Date: Wed, 31 Mar 2004 13:57:49 -0600
- Subject: readelf patch
Hi,
I have been using readelf recently, and have found some problems with it.
Included with this email are the following changes:
Changes (in order of the diff):
o In display_debug_pubnames(), explicitly size the the offset so it
matches the column header so we have aligned output.
o In read_and_display_attr_value(), add a missing break for the DW_FORM_addr
case.
o In debug_displays[], call display_debug_pubnames() when printing
.debug_pubtypes. Both pubnames and pubtypes have the same format.
Problems noted but not fixed are:
o There are many places in readelf where the upper 32 bits of a 64 bit value
are lost because the holder is a "long". This only happens when reading
DWARF64 on a 32-bit machine.
o Printing a 64-bit value by using two successive 32-bit read/print pairs
(e.g. when printing DW_FORM_ref8) doesn't produce a correct/good looking
result unless the target is big-endian.
The above items were not fixed because of the lack of a known 64-bit value.
E.g. uint64_t. Is there a "correct" one to use? bfd_vma doesn't seem like
the right thing because it can be 32 bits. Plus, the code is organized in
such a manner as to imply that 64 bit support may not be present.
Dean
*** readelf.c.orig 2004-03-29 13:23:57.000000000 -0600
--- readelf.c 2004-03-29 13:28:18.000000000 -0600
***************
*** 6767,6773 ****
if (offset != 0)
{
data += offset_size;
! printf (" %ld\t\t%s\n", offset, data);
data += strlen ((char *) data) + 1;
}
}
--- 6767,6773 ----
if (offset != 0)
{
data += offset_size;
! printf (" %-6ld\t%s\n", offset, data);
data += strlen ((char *) data) + 1;
}
}
***************
*** 7941,7946 ****
--- 7941,7947 ----
case DW_FORM_addr:
printf (" %#lx", uvalue);
+ break;
case DW_FORM_flag:
case DW_FORM_data1:
***************
*** 9321,9327 ****
{ ".debug_macinfo", display_debug_macinfo },
{ ".debug_str", display_debug_str },
{ ".debug_loc", display_debug_loc },
! { ".debug_pubtypes", display_debug_not_supported },
{ ".debug_ranges", display_debug_not_supported },
{ ".debug_static_func", display_debug_not_supported },
{ ".debug_static_vars", display_debug_not_supported },
--- 9322,9328 ----
{ ".debug_macinfo", display_debug_macinfo },
{ ".debug_str", display_debug_str },
{ ".debug_loc", display_debug_loc },
! { ".debug_pubtypes", display_debug_pubnames },
{ ".debug_ranges", display_debug_not_supported },
{ ".debug_static_func", display_debug_not_supported },
{ ".debug_static_vars", display_debug_not_supported },