Display the assembler mnemonics for the machine instructions from the
input file. This option only disassembles those sections which are
expected to contain instructions. If the optional @var{symbol}
-argument is given, then display the assembler mnemonics starting at
-@var{symbol}. If @var{symbol} is a function name then disassembly
-will stop at the end of the function, otherwise it will stop when the
-next symbol is encountered. If there are no matches for @var{symbol}
-then nothing will be displayed.
+argument is given (perhaps multiple times), then display the assembler
+mnemonics starting at (all the) @var{symbol}. If @var{symbol} is a
+function name then disassembly will stop at the end of the function,
+otherwise it will stop when the next symbol is encountered. If there
+are no matches for any @var{symbol} then nothing will be displayed.
Note if the @option{--dwarf=follow-links} option is enabled
then any symbol tables in linked debug info files will be read in and
static int prefix_strip; /* --prefix-strip */
static size_t prefix_length;
static bool unwind_inlines; /* --inlines. */
-static const char * disasm_sym; /* Disassembly start symbol. */
static const char * source_comment; /* --source_comment. */
static bool visualize_jumps = false; /* --visualize-jumps. */
static bool color_output = false; /* --visualize-jumps=color. */
static int show_all_symbols; /* --show-all-symbols. */
static bool decompressed_dumps = false; /* -Z, --decompress. */
+static struct symbol_entry
+ {
+ const char *name;
+ struct symbol_entry *next;
+ } *disasm_sym_list; /* Disassembly start symbol(s). */
+
static enum color_selection
{
on_if_terminal_output,
bool require_sec;
disassembler_ftype disassemble_fn;
arelent *reloc;
- const char *symbol;
+ struct symbol_entry *symbol_list;
};
/* Architecture to disassemble for, or default if NULL. */
the symbol we have just found. Then print the symbol and find the
next symbol on. Repeat until we have disassembled the entire section
or we have reached the end of the address range we are interested in. */
- do_print = paux->symbol == NULL;
+ do_print = paux->symbol_list == NULL;
loop_until = stop_offset_reached;
while (addr_offset < stop_offset)
pinfo->symtab_pos = -1;
}
- /* If we are only disassembling from a specific symbol,
+ /* If we are only disassembling from specific symbols,
check to see if we should start or stop displaying. */
- if (sym && paux->symbol)
+ if (sym && paux->symbol_list)
{
if (do_print)
{
}
/* We are not currently printing. Check to see
- if the current symbol matches the requested symbol. */
- if (streq (name, paux->symbol)
+ if the current symbol matches any of the requested symbols. */
+ for (const struct symbol_entry *ent = paux->symbol_list;
+ ent;
+ ent = ent->next)
+ if (streq (name, ent->name))
+ {
+ do_print = true;
+ break;
+ }
+ if (do_print
&& bfd_asymbol_value (sym) <= addr)
{
do_print = true;
disasm_info.dynrelbuf = NULL;
disasm_info.dynrelcount = 0;
aux.reloc = NULL;
- aux.symbol = disasm_sym;
+ aux.symbol_list = disasm_sym_list;
disasm_info.print_address_func = objdump_print_address;
disasm_info.symbol_at_address_func = objdump_symbol_at_address;
case 'd':
disassemble = true;
seenflag = true;
- disasm_sym = optarg;
+ if (optarg)
+ {
+ struct symbol_entry *sym = xmalloc (sizeof (*sym));
+
+ sym->name = optarg;
+ sym->next = disasm_sym_list;
+ disasm_sym_list = sym;
+ }
break;
case 'z':
disassemble_zeroes = true;
--- /dev/null
+#name: objdump multiple --disassemble=
+#source: multi1.s
+#source: multi2.s
+#ld: -r
+#objdump: --disassemble=func --disassemble=func2 -wz
+# ECOFF disassembly omits local symbols, for whatever reason.
+#xfail: "alpha*-*-*ecoff" "alpha*-*-osf*"
+
+.*: +file format .*
+
+Disassembly of section .*:
+
+0+ <func>:
+[ ]*[0-9a-f]+: [0-9a-f][0-9a-f].*
+#?[ ]*[0-9a-f]+: [0-9a-f][0-9a-f].*
+#?[ ]*[0-9a-f]+: [0-9a-f][0-9a-f].*
+
+0+[0-1][0-9a-f] <func2>:
+[ ]*[0-9a-f]+: [0-9a-f][0-9a-f].*
+#...
+0+[0-2][0-9a-f] <func2>:
+[ ]*[0-9a-f]+: [0-9a-f][0-9a-f].*
+#?[ ]*[0-9a-f]+: [0-9a-f][0-9a-f].*
+#?[ ]*[0-9a-f]+: [0-9a-f][0-9a-f].*
+
+0+[0-3][0-9a-f] <func>:
+[ ]*[0-9a-f]+: [0-9a-f][0-9a-f].*
+#pass