aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-11-10 08:45:13 +0000
committerAlan Modra <amodra@gmail.com>2008-11-10 08:45:13 +0000
commit17ceb936752c300b333b579762f1eb757e94a69e (patch)
treee85cc1f81b19c1e355db28e472a460976da98617 /binutils/objdump.c
parent4c7e1c68059460e97d500556822c44f245d8764c (diff)
downloadgdb-17ceb936752c300b333b579762f1eb757e94a69e.zip
gdb-17ceb936752c300b333b579762f1eb757e94a69e.tar.gz
gdb-17ceb936752c300b333b579762f1eb757e94a69e.tar.bz2
* objdump.c (disassemble_bytes): Don't skip leading zeros when
end of section calculation overflows.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 5fad8dd..76f595b 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1372,19 +1372,18 @@ disassemble_bytes (struct disassemble_info * info,
if (! prefix_addresses)
{
char buf[30];
- char *s;
-
- bfd_sprintf_vma
- (aux->abfd, buf,
- (section->vma
- + bfd_section_size (section->owner, section) / opb));
- s = buf;
- while (s[0] == '0' && s[1] == '0' && s[2] == '0' && s[3] == '0'
- && s[4] == '0')
- {
- skip_addr_chars += 4;
- s += 4;
- }
+
+ bfd_sprintf_vma (aux->abfd, buf, section->vma + section->size / opb);
+
+ while (buf[skip_addr_chars] == '0')
+ ++skip_addr_chars;
+
+ /* Don't discard zeros on overflow. */
+ if (buf[skip_addr_chars] == '\0' && section->vma != 0)
+ skip_addr_chars = 0;
+
+ if (skip_addr_chars != 0)
+ skip_addr_chars = (skip_addr_chars - 1) & -4;
}
info->insn_info_valid = 0;