This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
display dwarf abbrev offset
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 17 May 2012 19:31:41 +0930
- Subject: display dwarf abbrev offset
I found it useful recently to be able to match up .debug_info comp
unit abbrev offset with readelf -wa output. To do that, I made
readelf display each abbrev offset in readelf -wa output. Then, since
most other offsets are displayed in hex, including errors about abbrev
offsets being out of range, I changed the readelf -wi output to
display abbrev offset in hex too.
binutils/
* dwarf.c (process_debug_info): Display abbrev offset in hex.
(display_debug_abbrev): Show offset of abbrev.
binutils/testsuite/
* binutils-all/objdump.W: Update.
* binutils-all/readelf.wa: Update.
* binutils-all/i386/compressed-1a.d: Update.
* binutils-all/x86-64/compressed-1a.d: Update.
gas/testsuite/
* gas/elf/dwarf2-1.d: Update.
* gas/elf/dwarf2-2.d: Update.
* gas/i386/dw2-compress-1.d: Update.
Index: binutils/dwarf.c
===================================================================
RCS file: /cvs/src/src/binutils/dwarf.c,v
retrieving revision 1.114
diff -u -p -r1.114 dwarf.c
--- binutils/dwarf.c 17 May 2012 07:19:35 -0000 1.114
+++ binutils/dwarf.c 17 May 2012 08:52:40 -0000
@@ -2061,8 +2061,8 @@ process_debug_info (struct dwarf_section
dwarf_vmatoa ("x", compunit.cu_length),
offset_size == 8 ? "64-bit" : "32-bit");
printf (_(" Version: %d\n"), compunit.cu_version);
- printf (_(" Abbrev Offset: %s\n"),
- dwarf_vmatoa ("d", compunit.cu_abbrev_offset));
+ printf (_(" Abbrev Offset: 0x%s\n"),
+ dwarf_vmatoa ("x", compunit.cu_abbrev_offset));
printf (_(" Pointer Size: %d\n"), compunit.cu_pointer_size);
if (do_types)
{
@@ -3681,14 +3681,17 @@ display_debug_abbrev (struct dwarf_secti
do
{
+ unsigned char *last;
+
free_abbrevs ();
+ last = start;
start = process_abbrev_section (start, end);
if (first_abbrev == NULL)
continue;
- printf (_(" Number TAG\n"));
+ printf (_(" Number TAG (0x%lx)\n"), (long) (last - section->start));
for (entry = first_abbrev; entry; entry = entry->next)
{
Index: binutils/testsuite/binutils-all/objdump.W
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/binutils-all/objdump.W,v
retrieving revision 1.9
diff -u -p -r1.9 objdump.W
--- binutils/testsuite/binutils-all/objdump.W 28 Apr 2011 17:23:17 -0000 1.9
+++ binutils/testsuite/binutils-all/objdump.W 17 May 2012 08:52:41 -0000
@@ -6,7 +6,7 @@ Contents of the .debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x4e \(32-bit\)
Version: 2
- Abbrev Offset: 0
+ Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_stmt_list : 0x0
@@ -75,7 +75,7 @@ Raw dump of debug contents of section .d
Contents of the .debug_abbrev section:
- Number TAG
+ Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_stmt_list DW_FORM_data4
DW_AT_high_pc DW_FORM_addr
Index: binutils/testsuite/binutils-all/readelf.wa
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/binutils-all/readelf.wa,v
retrieving revision 1.1
diff -u -p -r1.1 readelf.wa
--- binutils/testsuite/binutils-all/readelf.wa 10 Jul 2008 01:32:23 -0000 1.1
+++ binutils/testsuite/binutils-all/readelf.wa 17 May 2012 08:52:41 -0000
@@ -1,6 +1,6 @@
Contents of the .zdebug_abbrev section:
- Number TAG
+ Number TAG (0x0)
1 DW_TAG_compile_unit [has children]
DW_AT_stmt_list DW_FORM_data4
DW_AT_high_pc DW_FORM_addr
Index: binutils/testsuite/binutils-all/i386/compressed-1a.d
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/binutils-all/i386/compressed-1a.d,v
retrieving revision 1.3
diff -u -p -r1.3 compressed-1a.d
--- binutils/testsuite/binutils-all/i386/compressed-1a.d 29 Apr 2011 01:45:51 -0000 1.3
+++ binutils/testsuite/binutils-all/i386/compressed-1a.d 17 May 2012 08:52:41 -0000
@@ -7,7 +7,7 @@
Contents of the .[z]?debug_abbrev section:
- Number TAG
+ Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_producer DW_FORM_strp
DW_AT_language DW_FORM_data1
@@ -30,7 +30,7 @@ Contents of the .[z]?debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x46 \(32-bit\)
Version: 3
- Abbrev Offset: 0
+ Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_producer : \(indirect string, offset: 0x0\): GNU C 4.4.4
Index: binutils/testsuite/binutils-all/x86-64/compressed-1a.d
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/binutils-all/x86-64/compressed-1a.d,v
retrieving revision 1.3
diff -u -p -r1.3 compressed-1a.d
--- binutils/testsuite/binutils-all/x86-64/compressed-1a.d 30 Apr 2011 13:17:19 -0000 1.3
+++ binutils/testsuite/binutils-all/x86-64/compressed-1a.d 17 May 2012 08:52:41 -0000
@@ -7,7 +7,7 @@
Contents of the .[z]?debug_abbrev section:
- Number TAG
+ Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_producer DW_FORM_strp
DW_AT_language DW_FORM_data1
@@ -30,7 +30,7 @@ Contents of the .[z]?debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x5e \(32-bit\)
Version: 3
- Abbrev Offset: 0
+ Abbrev Offset: 0x0
Pointer Size: 8
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_producer : \(indirect string, offset: 0x0\): GNU C 4.4.4
Index: gas/testsuite/gas/elf/dwarf2-1.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/elf/dwarf2-1.d,v
retrieving revision 1.5
diff -u -p -r1.5 dwarf2-1.d
--- gas/testsuite/gas/elf/dwarf2-1.d 15 May 2012 12:55:37 -0000 1.5
+++ gas/testsuite/gas/elf/dwarf2-1.d 17 May 2012 08:52:54 -0000
@@ -8,7 +8,7 @@ Contents of the .[z]?debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x4e \(32-bit\)
Version: 2
- Abbrev Offset: 0
+ Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_stmt_list : 0x0
@@ -77,7 +77,7 @@ Raw dump of debug contents of section .[
Contents of the .[z]?debug_abbrev section:
- Number TAG
+ Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_stmt_list DW_FORM_data4
DW_AT_high_pc DW_FORM_addr
Index: gas/testsuite/gas/elf/dwarf2-2.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/elf/dwarf2-2.d,v
retrieving revision 1.5
diff -u -p -r1.5 dwarf2-2.d
--- gas/testsuite/gas/elf/dwarf2-2.d 15 May 2012 12:55:37 -0000 1.5
+++ gas/testsuite/gas/elf/dwarf2-2.d 17 May 2012 08:52:54 -0000
@@ -8,7 +8,7 @@ Contents of the .[z]?debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x4e \(32-bit\)
Version: 2
- Abbrev Offset: 0
+ Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_stmt_list : 0x0
@@ -77,7 +77,7 @@ Raw dump of debug contents of section .[
Contents of the .[z]?debug_abbrev section:
- Number TAG
+ Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_stmt_list DW_FORM_data4
DW_AT_high_pc DW_FORM_addr
Index: gas/testsuite/gas/i386/dw2-compress-1.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/dw2-compress-1.d,v
retrieving revision 1.4
diff -u -p -r1.4 dw2-compress-1.d
--- gas/testsuite/gas/i386/dw2-compress-1.d 29 Apr 2011 01:45:06 -0000 1.4
+++ gas/testsuite/gas/i386/dw2-compress-1.d 17 May 2012 08:52:54 -0000
@@ -7,7 +7,7 @@ Contents of the .zdebug_info section:
Compilation Unit @ offset 0x0:
Length: 0x4e \(32-bit\)
Version: 2
- Abbrev Offset: 0
+ Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_stmt_list : 0x0
@@ -32,7 +32,7 @@ Contents of the .zdebug_info section:
Contents of the .zdebug_abbrev section:
- Number TAG
+ Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_stmt_list DW_FORM_data4
DW_AT_high_pc DW_FORM_addr
--
Alan Modra
Australia Development Lab, IBM