[@option{-r}|@option{--reloc}]
[@option{-R}|@option{--dynamic-reloc}]
[@option{-s}|@option{--full-contents}]
- [@option{-W[lLiaprmfFsoRtUuTgAckK]}|
- @option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]]
+ [@option{-W[lLiaprmfFsoORtUuTgAckK]}|
+ @option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]]
[@option{--ctf=}@var{section}]
[@option{-G}|@option{--stabs}]
[@option{-t}|@option{--syms}]
after it has previously been enabled then use
@option{visualize-jumps=off}.
-@item -W[lLiaprmfFsoRtUuTgAckK]
-@itemx --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]
+@item -W[lLiaprmfFsoORtUuTgAckK]
+@itemx --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]
@include debug.options.texi
@item --dwarf-check
[@option{-R} <number or name>|@option{--relocated-dump=}<number or name>]
[@option{-z}|@option{--decompress}]
[@option{-c}|@option{--archive-index}]
- [@option{-w[lLiaprmfFsoRtUuTgAckK]}|
- @option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]]
+ [@option{-w[lLiaprmfFsoORtUuTgAckK]}|
+ @option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]]
[@option{--dwarf-depth=@var{n}}]
[@option{--dwarf-start=@var{n}}]
[@option{--ctf=}@var{section}]
of binary archives. Performs the same function as the @option{t}
command to @command{ar}, but without using the BFD library. @xref{ar}.
-@item -w[lLiaprmfFsoRtUuTgAckK]
-@itemx --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]
+@item -w[lLiaprmfFsOoRtUuTgAckK]
+@itemx --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]
@include debug.options.texi
@include ctf.options.texi
int do_debug_frames_interp;
int do_debug_macinfo;
int do_debug_str;
+int do_debug_str_offsets;
int do_debug_loc;
int do_gdb_index;
int do_trace_info;
enum dwarf_section_display_enum idx_sec_idx = dwo ? str_index_dwo : str_index;
struct dwarf_section *index_section = &debug_displays [idx_sec_idx].section;
struct dwarf_section *str_section = &debug_displays [str_sec_idx].section;
- dwarf_vma index_offset = idx * offset_size;
+ dwarf_vma index_offset;
dwarf_vma str_offset;
const char * ret;
+ unsigned char *curr = index_section->start;
+ const unsigned char *end = curr + index_section->size;
+ dwarf_vma length;
if (index_section->start == NULL)
return (dwo ? _("<no .debug_str_offsets.dwo section>")
: _("<no .debug_str_offsets section>"));
+ if (str_section->start == NULL)
+ return (dwo ? _("<no .debug_str.dwo section>")
+ : _("<no .debug_str section>"));
+
+ /* FIXME: We should cache the length... */
+ SAFE_BYTE_GET_AND_INC (length, curr, 4, end);
+ if (length == 0xffffffff)
+ {
+ if (offset_size != 8)
+ warn (_("UGG"));
+ SAFE_BYTE_GET_AND_INC (length, curr, 8, end);
+ }
+ else if (offset_size != 4)
+ {
+ warn (_("ugg"));
+ }
+
+ /* Skip the version and padding bytes.
+ We assume that they are correct. */
+ curr += 4;
+
+ /* FIXME: The code below assumes that there is only one table
+ in the .debug_str_offsets section, so check that now. */
+ if ((offset_size == 4 && curr + length < (end - 8))
+ || (offset_size == 8 && curr + length < (end - 16)))
+ {
+ warn (_("index table size is too small %s vs %s\n"),
+ dwarf_vmatoa ("x", length),
+ dwarf_vmatoa ("x", index_section->size));
+ return _("<table too small");
+ }
+
+ index_offset = idx * offset_size;
+
if (this_set != NULL)
index_offset += this_set->section_offsets [DW_SECT_STR_OFFSETS];
- if (index_offset >= index_section->size)
+
+ if (index_offset >= length)
{
- warn (_("DW_FORM_GNU_str_index offset too big: %s\n"),
- dwarf_vmatoa ("x", index_offset));
+ warn (_("DW_FORM_GNU_str_index offset too big: %s vs %s\n"),
+ dwarf_vmatoa ("x", index_offset),
+ dwarf_vmatoa ("x", length));
return _("<index offset is too big>");
}
- if (str_section->start == NULL)
- return (dwo ? _("<no .debug_str.dwo section>")
- : _("<no .debug_str section>"));
-
- str_offset = byte_get (index_section->start + index_offset, offset_size);
+ str_offset = byte_get (curr + index_offset, offset_size);
str_offset -= str_section->address;
if (str_offset >= str_section->size)
{
load_debug_section_with_follow (str_index_dwo, file);
load_debug_section_with_follow (debug_addr, file);
}
-
+
load_debug_section_with_follow (abbrev_sec, file);
if (debug_displays [abbrev_sec].section.start == NULL)
{
load_debug_section_with_follow (str, file);
load_debug_section_with_follow (line, file);
+ load_debug_section_with_follow (str_index, file);
introduce (section, FALSE);
switch (op)
{
+ case DW_MACRO_define:
+ READ_ULEB (lineno, curr, end);
+ string = curr;
+ curr += strnlen ((char *) string, end - string) + 1;
+ printf (_(" DW_MACRO_define - lineno : %d macro : %s\n"),
+ lineno, string);
+ break;
+
+ case DW_MACRO_undef:
+ READ_ULEB (lineno, curr, end);
+ string = curr;
+ curr += strnlen ((char *) string, end - string) + 1;
+ printf (_(" DW_MACRO_undef - lineno : %d macro : %s\n"),
+ lineno, string);
+ break;
+
case DW_MACRO_start_file:
{
unsigned int filenum;
printf (_(" DW_MACRO_end_file\n"));
break;
- case DW_MACRO_define:
- READ_ULEB (lineno, curr, end);
- string = curr;
- curr += strnlen ((char *) string, end - string) + 1;
- printf (_(" DW_MACRO_define - lineno : %d macro : %s\n"),
- lineno, string);
- break;
-
- case DW_MACRO_undef:
- READ_ULEB (lineno, curr, end);
- string = curr;
- curr += strnlen ((char *) string, end - string) + 1;
- printf (_(" DW_MACRO_undef - lineno : %d macro : %s\n"),
- lineno, string);
- break;
-
case DW_MACRO_define_strp:
READ_ULEB (lineno, curr, end);
SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
(unsigned long) offset);
break;
+ case DW_MACRO_define_strx:
+ case DW_MACRO_undef_strx:
+ READ_ULEB (lineno, curr, end);
+ READ_ULEB (offset, curr, end);
+ string = (const unsigned char *)
+ fetch_indexed_string (offset, NULL, offset_size, FALSE);
+ if (op == DW_MACRO_define_strx)
+ printf (" DW_MACRO_define_strx ");
+ else
+ printf (" DW_MACRO_undef_strx ");
+ if (do_wide)
+ printf (_("(with offset %s) "), dwarf_vmatoa (NULL, offset));
+ printf (_("lineno : %d macro : %s\n"),
+ lineno, string);
+ break;
+
default:
+ if (op >= DW_MACRO_lo_user && op <= DW_MACRO_hi_user)
+ {
+ printf (_(" <Target Specific macro op: %#x - UNHANDLED"), op);
+ break;
+ }
+
if (extended_ops == NULL || extended_ops[op] == NULL)
{
error (_(" Unknown macro opcode %02x seen\n"), op);
printf (_("\nThe %s section is empty.\n"), section->name);
return 0;
}
+
+ unsigned char *start = section->start;
+ unsigned char *end = start + section->size;
+ unsigned char *curr = start;
+
+ load_debug_section_with_follow (str, file);
+
+ introduce (section, FALSE);
+
+ while (curr < end)
+ {
+ dwarf_vma length;
+ dwarf_vma entry_length;
+
+ SAFE_BYTE_GET_AND_INC (length, curr, 4, end);
+ /* FIXME: We assume that this means 64-bit DWARF is being used. */
+ if (length == 0xffffffff)
+ {
+ SAFE_BYTE_GET (length, curr, 8, end);
+ entry_length = 8;
+ }
+ else
+ entry_length = 4;
+
+ int version;
+ SAFE_BYTE_GET_AND_INC (version, curr, 2, end);
+ if (version != 5)
+ warn (_("Unexpected version number in str_offset header: %#x\n"), version);
+
+ int padding;
+ SAFE_BYTE_GET_AND_INC (padding, curr, 2, end);
+ if (padding != 0)
+ warn (_("Unexpected value in str_offset header's padding field: %#x\n"), padding);
+
+ printf (_(" Length: %#lx\n"), (unsigned long) length);
+ printf (_(" Version: %#lx\n"), (unsigned long) version);
+ printf (_(" Index Offset [String]\n"));
+
+ unsigned long index;
+ for (index = 0; length >= entry_length && curr < end; index ++)
+ {
+ dwarf_vma offset;
+ const unsigned char * string;
+
+ SAFE_BYTE_GET_AND_INC (offset, curr, entry_length, end);
+ string = fetch_indirect_string (offset);
+ printf (" %8lu %s %s\n", index,
+ dwarf_vmatoa (NULL, offset),
+ string);
+ }
+ }
/* TODO: Dump the contents. This is made somewhat difficult by not knowing
what the offset size is for this section. */
return 1;
{ "ranges", & do_debug_aranges, 1 },
{ "rawline", & do_debug_lines, FLAG_DEBUG_LINES_RAW },
{ "str", & do_debug_str, 1 },
+ { "str-offsets", & do_debug_str_offsets, 1 },
/* These trace_* sections are used by Itanium VMS. */
{ "trace_abbrev", & do_trace_abbrevs, 1 },
{ "trace_aranges", & do_trace_aranges, 1 },
case 'l': do_debug_lines |= FLAG_DEBUG_LINES_RAW; break;
case 'L': do_debug_lines |= FLAG_DEBUG_LINES_DECODED; break;
case 'm': do_debug_macinfo = 1; break;
+ case 'O': do_debug_str_offsets = 1; break;
case 'o': do_debug_loc = 1; break;
case 'p': do_debug_pubnames = 1; break;
case 'R': do_debug_ranges = 1; break;
do_debug_cu_index = 1;
do_follow_links = 1;
do_debug_links = 1;
+ do_debug_str_offsets = 1;
}
#define NO_ABBREVS NULL, NULL, NULL, 0, 0, 0, NULL, 0, NULL
{ { ".debug_macro.dwo", ".zdebug_macro.dwo", NO_ABBREVS }, display_debug_macro, &do_debug_macinfo, TRUE },
{ { ".debug_macinfo.dwo", ".zdebug_macinfo.dwo", NO_ABBREVS }, display_debug_macinfo, &do_debug_macinfo, FALSE },
{ { ".debug_str.dwo", ".zdebug_str.dwo", NO_ABBREVS }, display_debug_str, &do_debug_str, TRUE },
- { { ".debug_str_offsets", ".zdebug_str_offsets", NO_ABBREVS }, display_debug_str_offsets, NULL, FALSE },
- { { ".debug_str_offsets.dwo", ".zdebug_str_offsets.dwo", NO_ABBREVS }, display_debug_str_offsets, NULL, FALSE },
+ { { ".debug_str_offsets", ".zdebug_str_offsets", NO_ABBREVS }, display_debug_str_offsets, &do_debug_str_offsets, TRUE },
+ { { ".debug_str_offsets.dwo", ".zdebug_str_offsets.dwo", NO_ABBREVS }, display_debug_str_offsets, &do_debug_str_offsets, TRUE },
{ { ".debug_addr", ".zdebug_addr", NO_ABBREVS }, display_debug_addr, &do_debug_addr, TRUE },
{ { ".debug_cu_index", "", NO_ABBREVS }, display_cu_index, &do_debug_cu_index, FALSE },
{ { ".debug_tu_index", "", NO_ABBREVS }, display_cu_index, &do_debug_cu_index, FALSE },