readelf: Show Unit Type for DWARF5
authorMark Wielaard <mark@klomp.org>
Wed, 23 Sep 2020 14:48:35 +0000 (16:48 +0200)
committerMark Wielaard <mark@klomp.org>
Thu, 24 Sep 2020 21:13:13 +0000 (23:13 +0200)
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.

binutils/ChangeLog
binutils/dwarf.c
binutils/testsuite/binutils-all/dw5.W
binutils/testsuite/binutils-all/dwarf-attributes.W
gas/ChangeLog
gas/testsuite/gas/elf/dwarf-5-cu.d

index 8cd0fe0820f983dfab9ac198fbba5dab26095ef6..c1e78305edc82a1706bf08190fa10cdb1f0a693e 100644 (file)
@@ -1,3 +1,9 @@
+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
index 9e98794ad66c08f5fd3b9086247f0dcec0488029..5f32e957a04576cf8a9f17d4a4aa517b16975f3f 100644 (file)
@@ -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);
index ebeda6575d718cfcebdc883aa224d2af7cd8d3a7..562b64fe2209fca50a85036ace8a8888465008f0 100644 (file)
@@ -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\)
index 3a4e7409889a91f9fc7a5b77b0581bc54dc75ee7..4e8386ae8807a7b10eb088903245a0e85243c8a6 100644 (file)
@@ -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\)
index 9f224b5dd3f4d291baef14708dc53ca0493f2eda..113a7cfc25047877fb636c4b82215c8cb9650e3e 100644 (file)
@@ -1,3 +1,7 @@
+2020-09-23  Mark Wielaard  <mark@klomp.org>
+
+       * testsuite/gas/elf/dwarf-5-cu.d: Adjust expected output.
+
 2020-09-24  Alex Coplan  <alex.coplan@arm.com>
 
        * config/tc-arm.c (arm_cpus): Add Neoverse V1.
index 839b4b7c77b46705bea0b9dde8c9a09f836f4166..7db20a330b86c2ebcbeeef2502188abea1b4d9f9 100644 (file)
@@ -6,6 +6,7 @@
   Compilation Unit @ offset 0x0:
    Length:        0x.*
    Version:       5
+   Unit Type:     DW_UT_compile \(1\)
    Abbrev Offset: 0x0
    Pointer Size:  .
 #pass