diff options
| author | Roland McGrath <[email protected]> | 2009-07-24 16:23:12 -0700 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2009-07-24 16:24:41 -0700 |
| commit | be4589d94fec9907f390018a886c34b9ad8bf4ea (patch) | |
| tree | 2fd83c695a117c81ad531b0b69d0d6db5dda1812 /src/readelf.c | |
| parent | 91dd75082d1c981a75a1fac36d981fa602c53b5b (diff) | |
Make readelf dump all block forms in hex.
Diffstat (limited to 'src/readelf.c')
| -rw-r--r-- | src/readelf.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/readelf.c b/src/readelf.c index 69d9aa52..b0f8fb02 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -3723,6 +3723,22 @@ dwarf_discr_list_string (unsigned int code) 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; + do + printf (" %02x", *data++); + while (--n > 0); + 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 +4113,11 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, 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 +5259,9 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) 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) { |
