diff options
author | Timothy Wall <twall@alum.mit.edu> | 2000-02-03 18:12:55 +0000 |
---|---|---|
committer | Timothy Wall <twall@alum.mit.edu> | 2000-02-03 18:12:55 +0000 |
commit | 940b2b788ccdda311ff16e18d79e68d0c7928842 (patch) | |
tree | 1bf115ed503420cc45254c97a054e8e7f6909817 /opcodes | |
parent | 8b93c6380e299446e645ece29bf77d26f5713529 (diff) | |
download | gdb-940b2b788ccdda311ff16e18d79e68d0c7928842.zip gdb-940b2b788ccdda311ff16e18d79e68d0c7928842.tar.gz gdb-940b2b788ccdda311ff16e18d79e68d0c7928842.tar.bz2 |
octets vs bytes changes for binutils
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 6 | ||||
-rw-r--r-- | opcodes/dis-buf.c | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index cda0156..2b72067 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +2000-02-03 Timothy Wall <twall@redhat.com> + + * dis-buf.c (buffer_read_memory): Use octets_per_byte field + to adjust target address bounds checking and calculate the + appropriate octet offset into data. + 2000-01-27 Nick Clifton <nickc@redhat.com> * arm-dis.c: (parse_disassembler_option): Rename to diff --git a/opcodes/dis-buf.c b/opcodes/dis-buf.c index 523fe72..65b1edb 100644 --- a/opcodes/dis-buf.c +++ b/opcodes/dis-buf.c @@ -29,11 +29,17 @@ buffer_read_memory (memaddr, myaddr, length, info) int length; struct disassemble_info *info; { + int opb = info->octets_per_byte; + int end_addr_offset = length / opb; + int max_addr_offset = info->buffer_length / opb; + int octets = (memaddr - info->buffer_vma) * opb; + if (memaddr < info->buffer_vma - || memaddr - info->buffer_vma + length > info->buffer_length) + || memaddr - info->buffer_vma + end_addr_offset > max_addr_offset) /* Out of bounds. Use EIO because GDB uses it. */ return EIO; - memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length); + memcpy (myaddr, info->buffer + octets, length); + return 0; } |