public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: binutils@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH 3/3] readelf: Show Unit Type for DWARF5
Date: Wed, 23 Sep 2020 16:51:52 +0200	[thread overview]
Message-ID: <20200923145152.27111-3-mark@klomp.org> (raw)
In-Reply-To: <20200923145152.27111-1-mark@klomp.org>

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                                 | 6 ++++++
 binutils/dwarf.c                                   | 4 ++++
 binutils/testsuite/binutils-all/dw5.W              | 1 +
 binutils/testsuite/binutils-all/dwarf-attributes.W | 1 +
 gas/ChangeLog                                      | 3 +++
 gas/testsuite/gas/elf/dwarf-5-cu.d                 | 1 +
 6 files changed, 16 insertions(+)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 21162ad5e6c..f5d060df4e4 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 bb177d1f175..4300b66ad5f 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 c04b90afd4f..e1ad5db9d01 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,6 @@
+2020-09-23  Mark Wielaard  <mark@klomp.org>
+
+	* testsuite/gas/elf/dwarf-5-cu.d: Adjust expected output.
 
 2020-09-23  Lili Cui  <lili.cui@intel.com>
 
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
-- 
2.18.4


  parent reply	other threads:[~2020-09-23 14:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 14:51 [PATCH 1/3] binutils: Handle DWARF5 DW_FORM_ref_addr and DW_UT_partial Mark Wielaard
2020-09-23 14:51 ` [PATCH 2/3] Sync libiberty and include with GCC for get_DW_UT_name Mark Wielaard
2020-09-24 10:26   ` Nick Clifton
2020-09-24 21:12     ` Mark Wielaard
2020-09-25  2:23       ` Alan Modra
2020-09-25  9:38         ` Mark Wielaard
2020-09-23 14:51 ` Mark Wielaard [this message]
2020-09-24 10:27   ` [PATCH 3/3] readelf: Show Unit Type for DWARF5 Nick Clifton
2020-09-24 10:23 ` [PATCH 1/3] binutils: Handle DWARF5 DW_FORM_ref_addr and DW_UT_partial Nick Clifton
2020-09-24 20:55   ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200923145152.27111-3-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).