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: Roland McGrath <roland at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Fri, 24 Jul 2009 16:19:35 -0700
- Subject: Re: supporting DW_OP_{implicit,stack}_value
Hmm, binutils readelf dumps all blocks with no size limit.
Maybe we want to change our "%x byte block" too?
diff --git a/src/readelf.c b/src/readelf.c
index 69d9aa5..0000000 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -3723,6 +3723,21 @@ dwarf_discr_list_string (unsigned int co
static void
+print_block (size_t n, const void *block)
+{
+ if (n == 0)
+ puts (_("empty block"));
+ else
+ {
+ printf (_("%zu byte block:"), n);
+ const unsigned char *data = block;
+ while (n--)
+ printf (" %02x", *data++);
+ putchar ('\n');
+ }
+}
+
+static void
print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
unsigned int addrsize, Dwarf_Word len, const unsigned char *data)
{
@@ -4097,12 +4112,11 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *
case DW_OP_implicit_value:
start = data;
get_uleb128 (uleb, data); /* XXX check overrun */
- printf ("%*s[%4" PRIuMAX "] %s %u (",
- indent, "", (uintmax_t) offset, known[op], uleb);
+ printf ("%*s[%4" PRIuMAX "] %s: ",
+ indent, "", (uintmax_t) offset, known[op]);
NEED (uleb);
- while (uleb-- > 0)
- printf ("%02x ", *data++);
- fputs (")\n", stdout);
+ print_block (uleb, data);
+ data += uleb;
len -= data - start;
offset += 1 + (data - start);
break;
@@ -5244,9 +5258,9 @@ attr_callback (Dwarf_Attribute *attrp, v
if (unlikely (dwarf_formblock (attrp, &block) != 0))
goto attrval_out;
- printf (" %*s%-20s %" PRIxMAX " byte block\n",
- (int) (level * 2), "", dwarf_attr_string (attr),
- (uintmax_t) block.length);
+ printf (" %*s%-20s ",
+ (int) (level * 2), "", dwarf_attr_string (attr));
+ print_block (block.length, block.data);
switch (attr)
{