-*- text -*-
+* Objdump has a new command line option --show-all-symbols which will make it
+ display all symbols that match a given address when disassembling. (Normally
+ only the first symbol that matches an address is shown).
+
* Add --enable-colored-disassembly configure time option to enable colored
disassembly output by default, if the output device is a terminal. Note,
this configure option is disabled by default.
[@option{--prefix-addresses}]
[@option{--[no-]show-raw-insn}]
[@option{--adjust-vma=}@var{offset}]
+ [@option{--show-all-symbols}]
[@option{--dwarf-depth=@var{n}}]
[@option{--dwarf-start=@var{n}}]
[@option{--ctf-parent=}@var{section}]
Display source code intermixed with disassembly, if possible. Implies
@option{-d}.
+@item --show-all-symbols
+When disassembling, show all the symbols that match a given address,
+not just the first one.
+
@item --source-comment[=@var{txt}]
@cindex source disassembly
@cindex disassembly, with source
if (end < entry)
{
warn (_("Corrupt %s section header: length field (%lx) is too small\n"),
- section->name, length);
+ section->name, (long) length);
return 0;
}
SAFE_BYTE_GET_AND_INC (version, curr_header, 2, entry);
{
warn (_("Corrupt %s section: address base of entry %u (%lx) is less than entry %u (%lx)\n"),
section->name,
- i, debug_addr_info [i]->addr_base,
- i + 1, debug_addr_info [i + 1]->addr_base);
+ i, (long) debug_addr_info [i]->addr_base,
+ i + 1, (long) debug_addr_info [i + 1]->addr_base);
return 0;
}
}
static bool color_output = false; /* --visualize-jumps=color. */
static bool extended_color_output = false; /* --visualize-jumps=extended-color. */
static int process_links = false; /* --process-links. */
+static int show_all_symbols; /* --show-all-symbols. */
static enum color_selection
{
fprintf (stream, _("\
--adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n"));
fprintf (stream, _("\
+ --show-all-symbols When disassembling, display all symbols at a given address\n"));
+ fprintf (stream, _("\
--special-syms Include special symbols in symbol dumps\n"));
fprintf (stream, _("\
--inlines Print all inlines for source line (with -l)\n"));
{"section", required_argument, NULL, 'j'},
{"section-headers", no_argument, NULL, 'h'},
{"sframe", optional_argument, NULL, OPTION_SFRAME},
+ {"show-all-symbols", no_argument, &show_all_symbols, 1},
{"show-raw-insn", no_argument, &show_raw_insn, 1},
{"source", no_argument, NULL, 'S'},
{"source-comment", optional_argument, NULL, OPTION_SOURCE_COMMENT},
objdump_print_addr_with_sym (abfd, section, sym, addr,
pinfo, false);
pinfo->fprintf_func (pinfo->stream, ":\n");
+
+ if (sym != NULL && show_all_symbols)
+ {
+ for (++place; place < sorted_symcount; place++)
+ {
+ sym = sorted_syms[place];
+
+ if (bfd_asymbol_value (sym) != addr)
+ break;
+ if (! pinfo->symbol_is_valid (sym, pinfo))
+ continue;
+ if (strcmp (bfd_section_name (sym->section), bfd_section_name (section)) != 0)
+ break;
+
+ objdump_print_addr_with_sym (abfd, section, sym, addr, pinfo, false);
+ pinfo->fprintf_func (pinfo->stream, ":\n");
+ }
+ }
}
if (sym != NULL && bfd_asymbol_value (sym) > addr)
}
}
+proc test_objdump_d_show_all_symbols { testfile dumpfile } {
+ global OBJDUMP
+ global OBJDUMPFLAGS
+
+ set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -d --show-all-symbols $testfile"]
+
+ set want "${dumpfile}.*:.*00+0 <text_symbol>"
+ if ![regexp $want $got] then {
+ fail "objdump -d --show-all-symbols $testfile: Missing 'text_symbol'"
+ return
+ }
+
+ set want "${dumpfile}.*:.*00+0 <static_text_symbol>"
+ if ![regexp $want $got] then {
+ fail "objdump -d --show-all-symbols $testfile: Missing 'static_text_symbol'"
+ return
+ }
+
+ pass "objdump -d --show-all-symbols $testfile"
+}
+
+# The AIX and ECOFF assemblers default to makeing symbols local, not global.
+# So they do not show up in this test.
+setup_xfail "*-*-*aix*"
+setup_xfail "*-*-*ecoff"
+test_objdump_d_show_all_symbols $testfile $testfile
# Test objdump -s