This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: supporting DW_OP_{implicit,stack}_value
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Sat, 25 Jul 2009 00:33:26 +0200
- Subject: Re: supporting DW_OP_{implicit,stack}_value
Buried in this giant thread was also this small patch:
On Mon, 2009-07-20 at 23:29 +0200, Mark Wielaard wrote:
> Here is an updated patch for readelf -w support, that doesn't try to be
> clever and that just outputs the value bytes as is in hex. e.g.
> "implicit_value 4 (ef be ad de)"
>
> 2009-07-20 Mark Wielaard <mjw@redhat.com>
>
> * readelf.c (print_ops): Add handling of DW_OP_implicit_value
> and DW_OP_stack_value.
It is handy for looking at the debuginfo output from for example the gcc
vta branch. What do you think?
Thanks,
Mark
>From 6d762e6effbff170bdad35d29c564c6fff1896b6 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Mon, 20 Jul 2009 23:11:08 +0200
Subject: [PATCH] Add handling of DW_OP_implicit_value and DW_OP_stack_value to readelf -w.
---
src/ChangeLog | 5 +++++
src/readelf.c | 18 ++++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 69f9a65..84e4f54 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-20 Mark Wielaard <mjw@redhat.com>
+
+ * readelf.c (print_ops): Add handling of DW_OP_implicit_value
+ and DW_OP_stack_value.
+
2009-07-14 Ulrich Drepper <drepper@redhat.com>
* elflint.c (check_elf_header): Allow Linux ABI.
diff --git a/src/readelf.c b/src/readelf.c
index 2e8257f..772e897 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -3880,6 +3880,8 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
[DW_OP_form_tls_address] = "form_tls_address",
[DW_OP_call_frame_cfa] = "call_frame_cfa",
[DW_OP_bit_piece] = "bit_piece",
+ [DW_OP_implicit_value] = "implicit_value",
+ [DW_OP_stack_value] = "stack_value",
};
if (len == 0)
@@ -4092,6 +4094,22 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
offset += 3;
break;
+ case DW_OP_implicit_value:
+ {
+ const unsigned char *start_op = data;
+ unsigned int ulen;
+ get_uleb128 (ulen, data); /* XXX check overrun */
+ printf ("%*s[%4" PRIuMAX "] %s %u (",
+ indent, "", (uintmax_t) offset, known[op], ulen);
+ NEED (ulen);
+ while (ulen-- > 1)
+ printf("%02x ", *data++);
+ printf("%02x)\n", *data++);
+ len -= (data - start_op);
+ offset += 1 + (data - start_op);
+ break;
+ }
+
default:
/* No Operand. */
if (op < sizeof known / sizeof known[0] && known[op] != NULL)
--
1.6.2.5