Add call to disasm_symaddr()

This commit is contained in:
Nick Clifton 1997-12-02 18:26:14 +00:00
parent ea16981a29
commit fd6d6c603d
2 changed files with 106 additions and 80 deletions

View File

@ -1,3 +1,8 @@
Tue Dec 2 10:23:50 1997 Nick Clifton <nickc@cygnus.com>
* objdump.c (objdump_print_addr_with_sym): Call disasm_symaddr()
to allow backend to know which symbol has just been displayed.
Tue Dec 2 13:06:46 1997 Ian Lance Taylor <ian@cygnus.com>
* windres.h (ESCAPE_*): Define standard escape sequences.

View File

@ -828,6 +828,9 @@ objdump_print_addr_with_sym (abfd, sec, sym, vma, info, skip_zeroes)
objdump_print_value (vma - bfd_asymbol_value (sym), info, true);
}
(*info->fprintf_func) (info->stream, ">");
/* Notify the disassembler of the symbol being used: */
disasm_symaddr (sym, info);
}
}
@ -845,7 +848,7 @@ objdump_print_addr (vma, info, skip_zeroes)
if (sorted_symcount < 1)
{
printf ("0x");
(*info->fprintf_func) (info->stream, "0x");
objdump_print_value (vma, info, skip_zeroes);
return;
}
@ -868,6 +871,27 @@ objdump_print_address (vma, info)
objdump_print_addr (vma, info, ! prefix_addresses);
}
/* Determine of the given address has a symbol associated with it. */
static int
objdump_symbol_at_address (vma, info)
bfd_vma vma;
struct disassemble_info * info;
{
struct objdump_disasm_info * aux;
asymbol * sym;
/* No symbols - do not bother checking. */
if (sorted_symcount < 1)
return 0;
aux = (struct objdump_disasm_info *) info->application_data;
sym = find_symbol_for_address (aux->abfd, aux->sec, vma, aux->require_sec,
(long *) NULL);
return (sym != NULL && (bfd_asymbol_value (sym) == vma));
}
/* Hold the last function name and the last line number we displayed
in a disassembly. */
@ -1458,6 +1482,7 @@ disassemble_data (abfd)
aux.abfd = abfd;
aux.require_sec = false;
disasm_info.print_address_func = objdump_print_address;
disasm_info.symbol_at_address_func = objdump_symbol_at_address;
if (machine != (char *) NULL)
{
@ -1513,6 +1538,8 @@ disassemble_data (abfd)
arelent **relpp = NULL;
arelent **relppend = NULL;
long stop;
asymbol *sym = NULL;
long place = 0;
if ((section->flags & SEC_LOAD) == 0
|| (! disassemble_all
@ -1579,11 +1606,6 @@ disassemble_data (abfd)
stop = disasm_info.buffer_length;
}
if(1) /* with or without prefix_addresses */
{
asymbol *sym;
long place;
sym = find_symbol_for_address (abfd, section, section->vma + i,
true, &place);
++place;
@ -1662,7 +1684,6 @@ disassemble_data (abfd)
i = nextstop;
sym = nextsym;
}
}
free (data);
if (relbuf != NULL)