When examining DWARF, it is sometimes useful to see the DWARF form for attributes. It would be handy if readelf and objdump could display this. Note that eu-readelf does: [ 2e] variable abbrev: 2 name (strp) "ada_main__gnat_argc" The "(strp)" indicates the form.
Created attachment 12943 [details] Proposed patch Hi Tom, Something like this patch ? With it applied the output looks like this: [...] <0><b>: Abbrev Number: 2 (DW_TAG_partial_unit) <c> DW_AT_stmt_list : (sec_offset) 0x0 <10> DW_AT_comp_dir : (strp) (offset: 0x4a2146): /usr/src/debug/gcc-10.2.1-6.fc32.x86_64/obj-x86_64-redhat-linux/x86_64-r edhat-linux/libgcc <1><14>: Abbrev Number: 111 (DW_TAG_base_type) <15> DW_AT_byte_size : (data1) 4 <16> DW_AT_encoding : (data1) 5 (signed) [...] There is one caveat with this patch: the form name is only displayed when --wide is enabled. This meant that I did not have to fix up all the binutils tests that run regexps over readelf's output, and it seemed to me to be a reasonable compromise. Cheers Nick
I didn't try it, but it looks like exactly what I'd like :) Thank you!
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=521d4b194f89ca8f7d5d3cce1ecdc4fc7559205c commit 521d4b194f89ca8f7d5d3cce1ecdc4fc7559205c Author: Nick Clifton <nickc@redhat.com> Date: Mon Nov 9 10:37:51 2020 +0000 Extend the DWARF decoder to display FORM names when operating in wide mode. PR 26847 * dwarf.c (read_and_display_attr_value): In wide mode, display the name of the form.
Okey dokey - patch applied.