provide a new interface (using read_memory_func) to call the disassemblers

which copes with errors in a plausible way
This commit is contained in:
Jim Kingdon
1993-03-31 21:43:25 +00:00
parent 79337c85b8
commit 5d0734a7d7
18 changed files with 3961 additions and 533 deletions

View File

@ -1,3 +1,7 @@
Wed Mar 31 10:25:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* objdump.c (disassemble_data): Use new read_memory_func stuff.
Thu Mar 25 10:38:11 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
* objdump.c (fprintf): Declaration of variadic function had better

View File

@ -440,8 +440,12 @@ disassemble_data (abfd)
bfd_get_section_contents (abfd, section, data, 0, bfd_get_section_size_before_reloc (section));
disasm_info.buffer = data;
disasm_info.buffer_vma = section->vma;
disasm_info.buffer_length =
bfd_get_section_size_before_reloc (section);
i = 0;
while (i < bfd_get_section_size_before_reloc (section))
while (i < disasm_info.buffer_length)
{
if (data[i] == 0 && data[i + 1] == 0 && data[i + 2] == 0 &&
data[i + 3] == 0)
@ -489,9 +493,13 @@ disassemble_data (abfd)
printf (" ");
if (disassemble) /* New style */
i += (*disassemble)(section->vma + i,
data + i,
&disasm_info);
{
int bytes = (*disassemble)(section->vma + i,
&disasm_info);
if (bytes < 0)
break;
i += bytes;
}
else /* Old style */
i += print (section->vma + i,
data + i,