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 /gdb | |
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 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/core.c | 22 | ||||
-rw-r--r-- | gdb/h8500-tdep.c | 5 | ||||
-rw-r--r-- | gdb/i386-pinsn.c | 12 | ||||
-rw-r--r-- | gdb/m68k-pinsn.c | 12 | ||||
-rw-r--r-- | gdb/mips-pinsn.c | 10 | ||||
-rw-r--r-- | gdb/z8k-tdep.c | 6 |
7 files changed, 36 insertions, 37 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d423e55..44f8877 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +Wed Mar 31 12:52:12 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * core.c (dis_asm_{read_memory,memory_error}): New functions. + m68k-pinsn.c, h8500-tdep.c, i386-pinsn.c, mips-pinsn.c, z8k-tdep.c: + Use read_memory_func interface to disassembler. + Tue Mar 30 15:46:14 1993 K. Richard Pixley (rich@rtl.cygnus.com) Teach sparc solaris to next over shared library functions. @@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "bfd.h" #include "target.h" #include "gdbcore.h" +#include "dis-asm.h" extern char registers[]; @@ -160,6 +161,27 @@ read_memory (memaddr, myaddr, len) memory_error (status, memaddr); } +/* Like target_read_memory, but slightly different parameters. */ +int +dis_asm_read_memory (memaddr, myaddr, len, info) + bfd_vma memaddr; + bfd_byte *myaddr; + int len; + disassemble_info *info; +{ + return target_read_memory (memaddr, myaddr, len); +} + +/* Like memory_error with slightly different parameters. */ +void +dis_asm_memory_error (status, memaddr, info) + int status; + bfd_vma memaddr; + disassemble_info *info; +{ + memory_error (status, memaddr); +} + /* Same as target_write_memory, but report an error if can't write. */ void write_memory (memaddr, myaddr, len) diff --git a/gdb/h8500-tdep.c b/gdb/h8500-tdep.c index 50d5ae0..fc16764 100644 --- a/gdb/h8500-tdep.c +++ b/gdb/h8500-tdep.c @@ -110,12 +110,9 @@ print_insn (memaddr, stream) CORE_ADDR memaddr; FILE *stream; { - /* Nothing is bigger than 8 bytes */ - char data[8]; disassemble_info info; - read_memory (memaddr, data, sizeof (data)); GDB_INIT_DISASSEMBLE_INFO(info, stream); - return print_insn_h8500 (memaddr, data, &info); + return print_insn_h8500 (memaddr, &info); } /* Given a GDB frame, determine the address of the calling function's frame. diff --git a/gdb/i386-pinsn.c b/gdb/i386-pinsn.c index 6c88de9..b6d7fe9 100644 --- a/gdb/i386-pinsn.c +++ b/gdb/i386-pinsn.c @@ -20,9 +20,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "defs.h" #include "dis-asm.h" -#define MAXLEN 20 -/* Print the m68k instruction at address MEMADDR in debugged memory, +/* Print the instruction at address MEMADDR in debugged memory, on STREAM. Returns length of the instruction, in bytes. */ int @@ -30,16 +29,9 @@ print_insn (memaddr, stream) CORE_ADDR memaddr; FILE *stream; { - unsigned char buffer[MAXLEN]; - register int i; - register unsigned char *p; - register char *d; - register int bestmask; - int best; disassemble_info info; GDB_INIT_DISASSEMBLE_INFO(info, stream); - read_memory (memaddr, (char *) buffer, MAXLEN); - return print_insn_i386 (memaddr, buffer, &info); + return print_insn_i386 (memaddr, &info); } diff --git a/gdb/m68k-pinsn.c b/gdb/m68k-pinsn.c index 01bbd92..321ff5d 100644 --- a/gdb/m68k-pinsn.c +++ b/gdb/m68k-pinsn.c @@ -20,9 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "defs.h" #include "dis-asm.h" -/* m68k instructions are never longer than this many bytes. */ -#define MAXLEN 22 - /* Print the m68k instruction at address MEMADDR in debugged memory, on STREAM. Returns length of the instruction, in bytes. */ @@ -31,16 +28,9 @@ print_insn (memaddr, stream) CORE_ADDR memaddr; FILE *stream; { - unsigned char buffer[MAXLEN]; - register int i; - register unsigned char *p; - register char *d; - register int bestmask; - int best; disassemble_info info; GDB_INIT_DISASSEMBLE_INFO(info, stream); - read_memory (memaddr, (char *) buffer, MAXLEN); - return print_insn_m68k (memaddr, buffer, &info); + return print_insn_m68k (memaddr, &info); } diff --git a/gdb/mips-pinsn.c b/gdb/mips-pinsn.c index da4232e..eec22c5 100644 --- a/gdb/mips-pinsn.c +++ b/gdb/mips-pinsn.c @@ -20,9 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "defs.h" #include "dis-asm.h" -/* Mips instructions are never longer than this many bytes. */ -#define MAXLEN 4 - /* Print the mips instruction at address MEMADDR in debugged memory, on STREAM. Returns length of the instruction, in bytes, which is always 4. */ @@ -32,16 +29,13 @@ print_insn (memaddr, stream) CORE_ADDR memaddr; FILE *stream; { - unsigned char buffer[MAXLEN]; disassemble_info info; GDB_INIT_DISASSEMBLE_INFO(info, stream); - read_memory (memaddr, buffer, MAXLEN); - /* print_insn_mips is in opcodes/mips-dis.c. */ if (TARGET_BYTE_ORDER == BIG_ENDIAN) - print_insn_big_mips (memaddr, buffer, &info); + print_insn_big_mips (memaddr, &info); else - print_insn_little_mips (memaddr, buffer, &info); + print_insn_little_mips (memaddr, &info); } diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c index ff91a76..10e4e4b 100644 --- a/gdb/z8k-tdep.c +++ b/gdb/z8k-tdep.c @@ -208,19 +208,17 @@ print_insn (memaddr, stream) CORE_ADDR memaddr; FILE *stream; { - char temp[20]; disassemble_info info; GDB_INIT_DISASSEMBLE_INFO(info, stream); - read_memory (memaddr, temp, 20); if (BIG) { - return print_insn_z8001 (memaddr, temp, &info); + return print_insn_z8001 (memaddr, &info); } else { - return print_insn_z8002 (memaddr, temp, &info); + return print_insn_z8002 (memaddr, &info); } } |