[binutils-gdb] readelf: Show Unit Type for DWARF5

Mark Wielaard mark@sourceware.org
Thu Sep 24 21:20:34 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=debd1a62c4d250a6257e9018d9f9c7355edcdf8b

commit debd1a62c4d250a6257e9018d9f9c7355edcdf8b
Author: Mark Wielaard <mark@klomp.org>
Date:   Wed Sep 23 16:48:35 2020 +0200

    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.

Diff:
---
 binutils/ChangeLog                                 | 6 ++++++
 binutils/dwarf.c                                   | 4 ++++
 binutils/testsuite/binutils-all/dw5.W              | 1 +
 binutils/testsuite/binutils-all/dwarf-attributes.W | 1 +
 gas/ChangeLog                                      | 4 ++++
 gas/testsuite/gas/elf/dwarf-5-cu.d                 | 1 +
 6 files changed, 17 insertions(+)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 8cd0fe0820f..c1e78305edc 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 9e98794ad66..5f32e957a04 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 ebeda6575d7..562b64fe220 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 3a4e7409889..4e8386ae880 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 9f224b5dd3f..113a7cfc250 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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.
diff --git a/gas/testsuite/gas/elf/dwarf-5-cu.d b/gas/testsuite/gas/elf/dwarf-5-cu.d
index 839b4b7c77b..7db20a330b8 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


More information about the Binutils-cvs mailing list