diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-03-31 21:43:25 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-03-31 21:43:25 +0000 |
commit | 5d0734a7d74cf01b73303aeb884b719b4b220035 (patch) | |
tree | f24aaaf513a030c64dd9b0dae5ddb405a1c214f3 /binutils | |
parent | 79337c85b8e706bd247a99d26a237f6dddf4ffe5 (diff) | |
download | gdb-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')
-rw-r--r-- | binutils/ChangeLog | 4 | ||||
-rw-r--r-- | binutils/objdump.c | 16 |
2 files changed, 16 insertions, 4 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index a9a0b7b..0e6dd46 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -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 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, |