* objdump.c: Revert rev 1.81 commit.
This commit is contained in:
parent
67c127dde0
commit
0f6cb37fa4
2 changed files with 57 additions and 57 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2003-11-11 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* objdump.c: Revert rev 1.81 commit.
|
||||||
|
|
||||||
2003-11-10 Tobias Burnus <tobias.burnus@physik.fu-berlin.de>
|
2003-11-10 Tobias Burnus <tobias.burnus@physik.fu-berlin.de>
|
||||||
|
|
||||||
* ar.c (print_contents): Remove "member" from verbose output in
|
* ar.c (print_contents): Remove "member" from verbose output in
|
||||||
|
|
|
@ -643,14 +643,14 @@ objdump_print_symname (bfd *abfd, struct disassemble_info *info,
|
||||||
free (alloc);
|
free (alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Locate a symbol given a bfd and a section (from INFO->application_data),
|
/* Locate a symbol given a bfd, a section, and a VMA. If REQUIRE_SEC
|
||||||
and a VMA. If INFO->application_data->require_sec is TRUE, then always
|
is TRUE, then always require the symbol to be in the section. This
|
||||||
require the symbol to be in the section. Returns NULL if there is no
|
returns NULL if there is no suitable symbol. If PLACE is not NULL,
|
||||||
suitable symbol. If PLACE is not NULL, then *PLACE is set to the index
|
then *PLACE is set to the index of the symbol in sorted_syms. */
|
||||||
of the symbol in sorted_syms. */
|
|
||||||
|
|
||||||
static asymbol *
|
static asymbol *
|
||||||
find_symbol_for_address (bfd_vma vma, struct disassemble_info *info, long *place)
|
find_symbol_for_address (bfd *abfd, asection *sec, bfd_vma vma,
|
||||||
|
bfd_boolean require_sec, long *place)
|
||||||
{
|
{
|
||||||
/* @@ Would it speed things up to cache the last two symbols returned,
|
/* @@ Would it speed things up to cache the last two symbols returned,
|
||||||
and maybe their address ranges? For many processors, only one memory
|
and maybe their address ranges? For many processors, only one memory
|
||||||
|
@ -661,9 +661,6 @@ find_symbol_for_address (bfd_vma vma, struct disassemble_info *info, long *place
|
||||||
long min = 0;
|
long min = 0;
|
||||||
long max = sorted_symcount;
|
long max = sorted_symcount;
|
||||||
long thisplace;
|
long thisplace;
|
||||||
struct objdump_disasm_info * aux = (struct objdump_disasm_info *) info->application_data;
|
|
||||||
bfd * abfd = aux->abfd;
|
|
||||||
asection * sec = aux->sec;
|
|
||||||
unsigned int opb = bfd_octets_per_byte (abfd);
|
unsigned int opb = bfd_octets_per_byte (abfd);
|
||||||
|
|
||||||
if (sorted_symcount < 1)
|
if (sorted_symcount < 1)
|
||||||
|
@ -707,7 +704,7 @@ find_symbol_for_address (bfd_vma vma, struct disassemble_info *info, long *place
|
||||||
no way to tell what's desired without looking at the relocation
|
no way to tell what's desired without looking at the relocation
|
||||||
table. */
|
table. */
|
||||||
if (sorted_syms[thisplace]->section != sec
|
if (sorted_syms[thisplace]->section != sec
|
||||||
&& (aux->require_sec
|
&& (require_sec
|
||||||
|| ((abfd->flags & HAS_RELOC) != 0
|
|| ((abfd->flags & HAS_RELOC) != 0
|
||||||
&& vma >= bfd_get_section_vma (abfd, sec)
|
&& vma >= bfd_get_section_vma (abfd, sec)
|
||||||
&& vma < (bfd_get_section_vma (abfd, sec)
|
&& vma < (bfd_get_section_vma (abfd, sec)
|
||||||
|
@ -752,22 +749,15 @@ find_symbol_for_address (bfd_vma vma, struct disassemble_info *info, long *place
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sorted_syms[thisplace]->section != sec
|
if (sorted_syms[thisplace]->section != sec
|
||||||
&& (aux->require_sec
|
&& (require_sec
|
||||||
|| ((abfd->flags & HAS_RELOC) != 0
|
|| ((abfd->flags & HAS_RELOC) != 0
|
||||||
&& vma >= bfd_get_section_vma (abfd, sec)
|
&& vma >= bfd_get_section_vma (abfd, sec)
|
||||||
&& vma < (bfd_get_section_vma (abfd, sec)
|
&& vma < (bfd_get_section_vma (abfd, sec)
|
||||||
+ bfd_section_size (abfd, sec)))))
|
+ bfd_section_size (abfd, sec)))))
|
||||||
/* There is no suitable symbol. */
|
{
|
||||||
return NULL;
|
/* There is no suitable symbol. */
|
||||||
}
|
return NULL;
|
||||||
|
}
|
||||||
/* Give the target a chance to reject the symbol. */
|
|
||||||
while (! info->symbol_is_valid (sorted_syms [thisplace], info))
|
|
||||||
{
|
|
||||||
++ thisplace;
|
|
||||||
if (thisplace >= sorted_symcount
|
|
||||||
|| bfd_asymbol_value (sorted_syms [thisplace]) > vma)
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (place != NULL)
|
if (place != NULL)
|
||||||
|
@ -829,7 +819,7 @@ static void
|
||||||
objdump_print_addr (bfd_vma vma, struct disassemble_info *info,
|
objdump_print_addr (bfd_vma vma, struct disassemble_info *info,
|
||||||
bfd_boolean skip_zeroes)
|
bfd_boolean skip_zeroes)
|
||||||
{
|
{
|
||||||
struct objdump_disasm_info * aux = (struct objdump_disasm_info *) info->application_data;
|
struct objdump_disasm_info *aux;
|
||||||
asymbol *sym;
|
asymbol *sym;
|
||||||
|
|
||||||
if (sorted_symcount < 1)
|
if (sorted_symcount < 1)
|
||||||
|
@ -839,7 +829,9 @@ objdump_print_addr (bfd_vma vma, struct disassemble_info *info,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sym = find_symbol_for_address (vma, info, NULL);
|
aux = (struct objdump_disasm_info *) info->application_data;
|
||||||
|
sym = find_symbol_for_address (aux->abfd, aux->sec, vma, aux->require_sec,
|
||||||
|
NULL);
|
||||||
objdump_print_addr_with_sym (aux->abfd, aux->sec, sym, vma, info,
|
objdump_print_addr_with_sym (aux->abfd, aux->sec, sym, vma, info,
|
||||||
skip_zeroes);
|
skip_zeroes);
|
||||||
}
|
}
|
||||||
|
@ -858,9 +850,16 @@ objdump_print_address (bfd_vma vma, struct disassemble_info *info)
|
||||||
static int
|
static int
|
||||||
objdump_symbol_at_address (bfd_vma vma, struct disassemble_info * info)
|
objdump_symbol_at_address (bfd_vma vma, struct disassemble_info * info)
|
||||||
{
|
{
|
||||||
|
struct objdump_disasm_info * aux;
|
||||||
asymbol * sym;
|
asymbol * sym;
|
||||||
|
|
||||||
sym = find_symbol_for_address (vma, info, NULL);
|
/* 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,
|
||||||
|
NULL);
|
||||||
|
|
||||||
return (sym != NULL && (bfd_asymbol_value (sym) == vma));
|
return (sym != NULL && (bfd_asymbol_value (sym) == vma));
|
||||||
}
|
}
|
||||||
|
@ -1628,7 +1627,6 @@ disassemble_section (bfd *abfd, asection *section, void *info)
|
||||||
bfd_get_section_contents (abfd, section, data, 0, datasize);
|
bfd_get_section_contents (abfd, section, data, 0, datasize);
|
||||||
|
|
||||||
paux->sec = section;
|
paux->sec = section;
|
||||||
paux->require_sec = TRUE;
|
|
||||||
pinfo->buffer = data;
|
pinfo->buffer = data;
|
||||||
pinfo->buffer_vma = section->vma;
|
pinfo->buffer_vma = section->vma;
|
||||||
pinfo->buffer_length = datasize;
|
pinfo->buffer_length = datasize;
|
||||||
|
@ -1661,7 +1659,8 @@ disassemble_section (bfd *abfd, asection *section, void *info)
|
||||||
printf (_("Disassembly of section %s:\n"), section->name);
|
printf (_("Disassembly of section %s:\n"), section->name);
|
||||||
|
|
||||||
/* Find the nearest symbol forwards from our current position. */
|
/* Find the nearest symbol forwards from our current position. */
|
||||||
sym = find_symbol_for_address (section->vma + addr_offset, info, &place);
|
sym = find_symbol_for_address (abfd, section, section->vma + addr_offset,
|
||||||
|
TRUE, &place);
|
||||||
|
|
||||||
/* Disassemble a block of instructions up to the address associated with
|
/* Disassemble a block of instructions up to the address associated with
|
||||||
the symbol we have just found. Then print the symbol and find the
|
the symbol we have just found. Then print the symbol and find the
|
||||||
|
@ -1669,81 +1668,81 @@ disassemble_section (bfd *abfd, asection *section, void *info)
|
||||||
or we have reached the end of the address range we are interested in. */
|
or we have reached the end of the address range we are interested in. */
|
||||||
while (addr_offset < stop_offset)
|
while (addr_offset < stop_offset)
|
||||||
{
|
{
|
||||||
bfd_vma addr;
|
|
||||||
asymbol *nextsym;
|
asymbol *nextsym;
|
||||||
unsigned long nextstop_offset;
|
unsigned long nextstop_offset;
|
||||||
bfd_boolean insns;
|
bfd_boolean insns;
|
||||||
|
|
||||||
addr = section->vma + addr_offset;
|
if (sym != NULL
|
||||||
|
&& bfd_asymbol_value (sym) <= section->vma + addr_offset)
|
||||||
if (sym != NULL && bfd_asymbol_value (sym) <= addr)
|
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
for (x = place;
|
for (x = place;
|
||||||
(x < sorted_symcount
|
(x < sorted_symcount
|
||||||
&& (bfd_asymbol_value (sorted_syms[x]) <= addr));
|
&& (bfd_asymbol_value (sorted_syms[x])
|
||||||
|
<= section->vma + addr_offset));
|
||||||
++x)
|
++x)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pinfo->symbols = sorted_syms + place;
|
pinfo->symbols = & sorted_syms[place];
|
||||||
pinfo->num_symbols = x - place;
|
pinfo->num_symbols = x - place;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
pinfo->symbols = NULL;
|
||||||
pinfo->symbols = NULL;
|
|
||||||
pinfo->num_symbols = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! prefix_addresses)
|
if (! prefix_addresses)
|
||||||
{
|
{
|
||||||
pinfo->fprintf_func (pinfo->stream, "\n");
|
pinfo->fprintf_func (pinfo->stream, "\n");
|
||||||
objdump_print_addr_with_sym (abfd, section, sym, addr,
|
objdump_print_addr_with_sym (abfd, section, sym,
|
||||||
|
section->vma + addr_offset,
|
||||||
pinfo, FALSE);
|
pinfo, FALSE);
|
||||||
pinfo->fprintf_func (pinfo->stream, ":\n");
|
pinfo->fprintf_func (pinfo->stream, ":\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sym != NULL && bfd_asymbol_value (sym) > addr)
|
if (sym != NULL
|
||||||
|
&& bfd_asymbol_value (sym) > section->vma + addr_offset)
|
||||||
nextsym = sym;
|
nextsym = sym;
|
||||||
else if (sym == NULL)
|
else if (sym == NULL)
|
||||||
nextsym = NULL;
|
nextsym = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#define is_valid_next_sym(SYM) \
|
|
||||||
((SYM)->section == section \
|
|
||||||
&& (bfd_asymbol_value (SYM) > bfd_asymbol_value (sym)) \
|
|
||||||
&& pinfo->symbol_is_valid (SYM, pinfo))
|
|
||||||
|
|
||||||
/* Search forward for the next appropriate symbol in
|
/* Search forward for the next appropriate symbol in
|
||||||
SECTION. Note that all the symbols are sorted
|
SECTION. Note that all the symbols are sorted
|
||||||
together into one big array, and that some sections
|
together into one big array, and that some sections
|
||||||
may have overlapping addresses. */
|
may have overlapping addresses. */
|
||||||
while (place < sorted_symcount
|
while (place < sorted_symcount
|
||||||
&& ! is_valid_next_sym (sorted_syms [place]))
|
&& (sorted_syms[place]->section != section
|
||||||
|
|| (bfd_asymbol_value (sorted_syms[place])
|
||||||
|
<= bfd_asymbol_value (sym))))
|
||||||
++place;
|
++place;
|
||||||
|
|
||||||
if (place >= sorted_symcount)
|
if (place >= sorted_symcount)
|
||||||
nextsym = NULL;
|
nextsym = NULL;
|
||||||
else
|
else
|
||||||
nextsym = sorted_syms[place];
|
nextsym = sorted_syms[place];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sym != NULL && bfd_asymbol_value (sym) > addr)
|
if (sym != NULL
|
||||||
nextstop_offset = bfd_asymbol_value (sym) - section->vma;
|
&& bfd_asymbol_value (sym) > section->vma + addr_offset)
|
||||||
|
{
|
||||||
|
nextstop_offset = bfd_asymbol_value (sym) - section->vma;
|
||||||
|
if (nextstop_offset > stop_offset)
|
||||||
|
nextstop_offset = stop_offset;
|
||||||
|
}
|
||||||
else if (nextsym == NULL)
|
else if (nextsym == NULL)
|
||||||
nextstop_offset = stop_offset;
|
nextstop_offset = stop_offset;
|
||||||
else
|
else
|
||||||
nextstop_offset = bfd_asymbol_value (nextsym) - section->vma;
|
{
|
||||||
|
nextstop_offset = bfd_asymbol_value (nextsym) - section->vma;
|
||||||
if (nextstop_offset > stop_offset)
|
if (nextstop_offset > stop_offset)
|
||||||
nextstop_offset = stop_offset;
|
nextstop_offset = stop_offset;
|
||||||
|
}
|
||||||
|
|
||||||
/* If a symbol is explicitly marked as being an object
|
/* If a symbol is explicitly marked as being an object
|
||||||
rather than a function, just dump the bytes without
|
rather than a function, just dump the bytes without
|
||||||
disassembling them. */
|
disassembling them. */
|
||||||
if (disassemble_all
|
if (disassemble_all
|
||||||
|| sym == NULL
|
|| sym == NULL
|
||||||
|| bfd_asymbol_value (sym) > addr
|
|| bfd_asymbol_value (sym) > section->vma + addr_offset
|
||||||
|| ((sym->flags & BSF_OBJECT) == 0
|
|| ((sym->flags & BSF_OBJECT) == 0
|
||||||
&& (strstr (bfd_asymbol_name (sym), "gnu_compiled")
|
&& (strstr (bfd_asymbol_name (sym), "gnu_compiled")
|
||||||
== NULL)
|
== NULL)
|
||||||
|
@ -1790,7 +1789,7 @@ disassemble_data (bfd *abfd)
|
||||||
/* Sort the symbols into section and symbol order. */
|
/* Sort the symbols into section and symbol order. */
|
||||||
qsort (sorted_syms, sorted_symcount, sizeof (asymbol *), compare_symbols);
|
qsort (sorted_syms, sorted_symcount, sizeof (asymbol *), compare_symbols);
|
||||||
|
|
||||||
init_disassemble_info (&disasm_info, stdout, (fprintf_ftype) fprintf);
|
init_disassemble_info (&disasm_info, stdout, fprintf);
|
||||||
|
|
||||||
disasm_info.application_data = (void *) &aux;
|
disasm_info.application_data = (void *) &aux;
|
||||||
aux.abfd = abfd;
|
aux.abfd = abfd;
|
||||||
|
@ -1846,9 +1845,6 @@ disassemble_data (bfd *abfd)
|
||||||
instead. */
|
instead. */
|
||||||
disasm_info.endian = BFD_ENDIAN_UNKNOWN;
|
disasm_info.endian = BFD_ENDIAN_UNKNOWN;
|
||||||
|
|
||||||
/* Allow the target to customize the info structure. */
|
|
||||||
disassemble_init_for_target (abfd, & disasm_info);
|
|
||||||
|
|
||||||
/* Pre-load the dynamic relocs if we are going
|
/* Pre-load the dynamic relocs if we are going
|
||||||
to be dumping them along with the disassembly. */
|
to be dumping them along with the disassembly. */
|
||||||
if (dump_dynamic_reloc_info)
|
if (dump_dynamic_reloc_info)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue