aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1993-03-31 21:43:25 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1993-03-31 21:43:25 +0000
commit5d0734a7d74cf01b73303aeb884b719b4b220035 (patch)
treef24aaaf513a030c64dd9b0dae5ddb405a1c214f3 /binutils/objdump.c
parent79337c85b8e706bd247a99d26a237f6dddf4ffe5 (diff)
downloadgdb-5d0734a7d74cf01b73303aeb884b719b4b220035.zip
gdb-5d0734a7d74cf01b73303aeb884b719b4b220035.tar.gz
gdb-5d0734a7d74cf01b73303aeb884b719b4b220035.tar.bz2
provide a new interface (using read_memory_func) to call the disassemblers
which copes with errors in a plausible way
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 95f3a33..7d36ad0 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -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,