public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/3] readelf: Handle DW_OP_GNU_variable_value.
@ 2017-11-04 23:31 Mark Wielaard
  2017-11-04 23:31 ` [PATCH 2/3] libdw: Update acceptable forms and attributes for dwarf_getlocation Mark Wielaard
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mark Wielaard @ 2017-11-04 23:31 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

Also format both DW_OP_call_ref and DW_OP_GNU_variable_value argument
as a normal DIE reference.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 libdw/ChangeLog | 4 ++++
 libdw/dwarf.h   | 1 +
 src/ChangeLog   | 5 +++++
 src/readelf.c   | 5 +++--
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index e6e7f3b..7085649 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2017-11-03  Mark Wielaard  <mark@klomp.org>
+
+	* dwarf.h: Add DW_OP_GNU_variable_value.
+
 2017-10-03  Mark Wielaard  <mark@klomp.org>
 
 	* libdw.h: Define LIBDW_CIE_ID and use it in dwarf_cfi_cie_p.
diff --git a/libdw/dwarf.h b/libdw/dwarf.h
index 902d261..8edf719 100644
--- a/libdw/dwarf.h
+++ b/libdw/dwarf.h
@@ -545,6 +545,7 @@ enum
     DW_OP_GNU_convert = 0xf7,
     DW_OP_GNU_reinterpret = 0xf9,
     DW_OP_GNU_parameter_ref = 0xfa,
+    DW_OP_GNU_variable_value = 0xfd,
 
     DW_OP_lo_user = 0xe0,	/* Implementation-defined range start.  */
     DW_OP_hi_user = 0xff	/* Implementation-defined range end.  */
diff --git a/src/ChangeLog b/src/ChangeLog
index 0d3bfc1..3b886a7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-03  Mark Wielaard  <mark@klomp.org>
+
+	* readelf.c (print_ops): Handle DW_OP_GNU_variable_value. Print
+	referenced DIE as offset.
+
 2017-09-10  Mark Wielaard  <mark@klomp.org>
 
 	* ar.c (do_oper_delete): Remove DEBUG conditional check.
diff --git a/src/readelf.c b/src/readelf.c
index 5e2f3fc..833884b 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -4160,6 +4160,7 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
 	  break;
 
 	case DW_OP_call_ref:
+	case DW_OP_GNU_variable_value:
 	  /* Offset operand.  */
 	  if (ref_size != 4 && ref_size != 8)
 	    goto invalid; /* Cannot be used in CFA.  */
@@ -4170,8 +4171,8 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
 	    addr = read_8ubyte_unaligned (dbg, data);
 	  data += ref_size;
 	  CONSUME (ref_size);
-
-	  printf ("%*s[%4" PRIuMAX "] %s %#" PRIxMAX "\n",
+	  /* addr is a DIE offset, so format it as one.  */
+	  printf ("%*s[%4" PRIuMAX "] %s [%6" PRIxMAX "]\n",
 		  indent, "", (uintmax_t) offset,
 		  op_name, (uintmax_t) addr);
 	  offset += 1 + ref_size;
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-10 15:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-04 23:31 [PATCH 1/3] readelf: Handle DW_OP_GNU_variable_value Mark Wielaard
2017-11-04 23:31 ` [PATCH 2/3] libdw: Update acceptable forms and attributes for dwarf_getlocation Mark Wielaard
2017-11-10 15:38   ` Mark Wielaard
2017-11-04 23:31 ` [PATCH 3/3] libdw: Handle DW_OP_GNU_variable_value Mark Wielaard
2017-11-10 15:38   ` Mark Wielaard
2017-11-10 15:38 ` [PATCH 1/3] readelf: " Mark Wielaard

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).