aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2020-09-23 16:48:35 +0200
committerMark Wielaard <mark@klomp.org>2020-09-24 23:13:13 +0200
commitdebd1a62c4d250a6257e9018d9f9c7355edcdf8b (patch)
tree58b3c683d7c21e0a50f568a3a7920af96d9a49da /binutils
parentd7b477c541bd31045483f37345727bd8335a052a (diff)
downloadgdb-debd1a62c4d250a6257e9018d9f9c7355edcdf8b.zip
gdb-debd1a62c4d250a6257e9018d9f9c7355edcdf8b.tar.gz
gdb-debd1a62c4d250a6257e9018d9f9c7355edcdf8b.tar.bz2
readelf: Show Unit Type for DWARF5
binutils/ChangeLog: * dwarf.c (process_debug_info): Print Unit Type for DWARF5. * testsuite/binutils-all/dw5.W: Adjust expected output. * testsuite/binutils-all/dwarf-attributes.W: Likewise. gas/ChangeLog: * testsuite/gas/elf/dwarf-5-cu.d: Adjust expected output.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/dwarf.c4
-rw-r--r--binutils/testsuite/binutils-all/dw5.W1
-rw-r--r--binutils/testsuite/binutils-all/dwarf-attributes.W1
4 files changed, 12 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 8cd0fe0..c1e7830 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,11 @@
2020-09-23 Mark Wielaard <mark@klomp.org>
+ * dwarf.c (process_debug_info): Print Unit Type for DWARF5.
+ * testsuite/binutils-all/dw5.W: Adjust expected output.
+ * testsuite/binutils-all/dwarf-attributes.W: Likewise.
+
+2020-09-23 Mark Wielaard <mark@klomp.org>
+
* dwarf.c (read_and_display_attr_value): Handle DW_FORM_ref_addr
for dwarf_version 5 just as version 3 and 4 (only 2 is
different).
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 9e98794..5f32e95 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -3361,6 +3361,10 @@ process_debug_info (struct dwarf_section * section,
dwarf_vmatoa ("x", compunit.cu_length),
offset_size == 8 ? "64-bit" : "32-bit");
printf (_(" Version: %d\n"), compunit.cu_version);
+ if (compunit.cu_version >= 5)
+ printf (_(" Unit Type: %s (%x)\n"),
+ get_DW_UT_name (compunit.cu_unit_type) ?: "???",
+ compunit.cu_unit_type);
printf (_(" Abbrev Offset: 0x%s\n"),
dwarf_vmatoa ("x", compunit.cu_abbrev_offset));
printf (_(" Pointer Size: %d\n"), compunit.cu_pointer_size);
diff --git a/binutils/testsuite/binutils-all/dw5.W b/binutils/testsuite/binutils-all/dw5.W
index ebeda65..562b64f 100644
--- a/binutils/testsuite/binutils-all/dw5.W
+++ b/binutils/testsuite/binutils-all/dw5.W
@@ -3,6 +3,7 @@ Contents of the .debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x160 \(32-bit\)
Version: 5
+ Unit Type: DW_UT_compile \(1\)
Abbrev Offset: 0x0
Pointer Size: 8
<0><c>: Abbrev Number: 6 \(DW_TAG_compile_unit\)
diff --git a/binutils/testsuite/binutils-all/dwarf-attributes.W b/binutils/testsuite/binutils-all/dwarf-attributes.W
index 3a4e740..4e8386a 100644
--- a/binutils/testsuite/binutils-all/dwarf-attributes.W
+++ b/binutils/testsuite/binutils-all/dwarf-attributes.W
@@ -3,6 +3,7 @@ Contents of the .debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x40 \(32-bit\)
Version: 5
+ Unit Type: DW_UT_compile \(1\)
Abbrev Offset: 0x0
Pointer Size: 4
<0><c>: Abbrev Number: 1 \(User TAG value: 0x5555\)