aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2020-09-23 16:48:35 +0200
committerAndreas K. Hüttel <dilfridge@gentoo.org>2021-01-23 20:19:50 +0200
commit06051d5fe4bd3e27d2de1d54aabae4457f319a64 (patch)
tree4d7cab46aa2251f89329eb18050e4d5ecf5c894e
parentSync libiberty and include with GCC for get_DW_UT_name. (diff)
downloadbinutils-gdb-06051d5fe4bd3e27d2de1d54aabae4457f319a64.tar.gz
binutils-gdb-06051d5fe4bd3e27d2de1d54aabae4457f319a64.tar.bz2
binutils-gdb-06051d5fe4bd3e27d2de1d54aabae4457f319a64.zip
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. (cherry picked from commit debd1a62c4d250a6257e9018d9f9c7355edcdf8b) (cherry picked from commit b0ee5cba0726ba5c9698c301fdf86e651fd9c3f6)
-rw-r--r--binutils/ChangeLog9
-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
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/testsuite/gas/elf/dwarf-5-cu.d1
6 files changed, 23 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 255fe9510a..5e048dbf34 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -3,6 +3,15 @@
Backport from the mainline:
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-11-15 Mark Wielaard <mark@klomp.org>
+
+ Backport from the mainline:
+ 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 ca6758cd0d..b163c5b64f 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 2eccb03c5a..cb949ad49c 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 3a4e740988..4e8386ae88 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\)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 417923ca11..377fbf752e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+2020-11-15 Mark Wielaard <mark@klomp.org>
+
+ Backport from the mainline:
+ 2020-09-23 Mark Wielaard <mark@klomp.org>
+
+ * testsuite/gas/elf/dwarf-5-cu.d: Adjust expected output.
+
2020-11-05 Alex Coplan <alex.coplan@arm.com>
* config/tc-aarch64.c (aarch64_cpus): Add neoverse-n2.
diff --git a/gas/testsuite/gas/elf/dwarf-5-cu.d b/gas/testsuite/gas/elf/dwarf-5-cu.d
index 839b4b7c77..7db20a330b 100644
--- a/gas/testsuite/gas/elf/dwarf-5-cu.d
+++ b/gas/testsuite/gas/elf/dwarf-5-cu.d
@@ -6,6 +6,7 @@
Compilation Unit @ offset 0x0:
Length: 0x.*
Version: 5
+ Unit Type: DW_UT_compile \(1\)
Abbrev Offset: 0x0
Pointer Size: .
#pass