aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1993-01-07 21:38:05 +0000
committerIan Lance Taylor <ian@airs.com>1993-01-07 21:38:05 +0000
commitb4a4ff7d515422f4337131fc99186cf9211db40b (patch)
tree46139038cfac95dec2d2ba6f272766de6a9c5383
parentbf1dd2fddd4964f33cea2d0d0f392efa5823e234 (diff)
downloadgdb-b4a4ff7d515422f4337131fc99186cf9211db40b.zip
gdb-b4a4ff7d515422f4337131fc99186cf9211db40b.tar.gz
gdb-b4a4ff7d515422f4337131fc99186cf9211db40b.tar.bz2
Thu Jan 7 13:33:06 1993 Ian Lance Taylor (ian@cygnus.com)
* mips-pinsn.c: Actual work now done by opcodes/mips-dis.c.
-rw-r--r--gdb/mips-pinsn.c113
1 files changed, 3 insertions, 110 deletions
diff --git a/gdb/mips-pinsn.c b/gdb/mips-pinsn.c
index ca0e825..88ce930 100644
--- a/gdb/mips-pinsn.c
+++ b/gdb/mips-pinsn.c
@@ -1,6 +1,5 @@
/* Print mips instructions for GDB, the GNU debugger.
Copyright 1989, 1991, 1992 Free Software Foundation, Inc.
- Contributed by Nobuyuki Hikichi(hikichi@sra.co.jp).
This file is part of GDB.
@@ -19,88 +18,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
-#include "symtab.h"
-#include "opcode/mips.h"
/* Mips instructions are never longer than this many bytes. */
#define MAXLEN 4
-/* Number of elements in the opcode table. */
-#define NOPCODES (sizeof mips_opcodes / sizeof mips_opcodes[0])
-
-#define MKLONG(p) *(unsigned long*)p
-
-/* subroutine */
-static unsigned char *
-print_insn_arg (d, l, stream, pc)
- char *d;
- register unsigned long int *l;
- FILE *stream;
- CORE_ADDR pc;
-{
- switch (*d)
- {
- case ',':
- case '(':
- case ')':
- fputc (*d, stream);
- break;
-
- case 's':
- fprintf (stream, "$%s", reg_names[((struct op_i_fmt *) l)->rs]);
- break;
-
- case 't':
- fprintf (stream, "$%s", reg_names[((struct op_i_fmt *) l)->rt]);
- break;
-
- case 'i':
- fprintf (stream, "%d", ((struct op_i_fmt *) l)->immediate);
- break;
-
- case 'j': /* same as i, but sign-extended */
- fprintf (stream, "%d", ((struct op_b_fmt *) l)->delta);
- break;
-
- case 'a':
- print_address ((pc & 0xF0000000) | (((struct op_j_fmt *)l)->target << 2),
- stream);
- break;
-
- case 'b':
- print_address ((((struct op_b_fmt *) l)->delta << 2) + pc + 4, stream);
- break;
-
- case 'd':
- fprintf (stream, "$%s", reg_names[((struct op_r_fmt *) l)->rd]);
- break;
-
- case 'h':
- fprintf (stream, "0x%x", ((struct op_r_fmt *) l)->shamt);
- break;
-
- case 'B':
- fprintf (stream, "0x%x", ((struct op_brk_fmt *) l)->code);
- break;
-
- case 'S':
- fprintf (stream, "$f%d", ((struct fop_r_fmt *) l)->fs);
- break;
-
- case 'T':
- fprintf (stream, "$f%d", ((struct fop_r_fmt *) l)->ft);
- break;
-
- case 'D':
- fprintf (stream, "$f%d", ((struct fop_r_fmt *) l)->fd);
- break;
-
- default:
- fprintf (stream, "# internal error, undefined modifier(%c)", *d);
- break;
- }
-}
-
/* Print the mips instruction at address MEMADDR in debugged memory,
on STREAM. Returns length of the instruction, in bytes, which
is always 4. */
@@ -111,38 +32,10 @@ print_insn (memaddr, stream)
FILE *stream;
{
unsigned char buffer[MAXLEN];
- register int i;
- register char *d;
- unsigned long int l;
read_memory (memaddr, buffer, MAXLEN);
- SWAP_TARGET_AND_HOST (buffer, MAXLEN);
-
- for (i = 0; i < NOPCODES; i++)
- {
- register unsigned int opcode = mips_opcodes[i].opcode;
- register unsigned int match = mips_opcodes[i].match;
- if ((*(unsigned int*)buffer & match) == opcode)
- break;
- }
-
- l = MKLONG (buffer);
- /* Handle undefined instructions. */
- if (i == NOPCODES)
- {
- fprintf (stream, "0x%x",l);
- return 4;
- }
-
- fprintf (stream, "%s", mips_opcodes[i].name);
-
- if (!(d = mips_opcodes[i].args))
- return 4;
-
- fputc (' ', stream);
-
- while (*d)
- print_insn_arg (d++, &l, stream, memaddr);
- return 4;
+ /* print_insn_mips is in opcodes/mips-dis.c. */
+ return print_insn_mips (memaddr, buffer, stream,
+ TARGET_BYTE_ORDER == BIG_ENDIAN);
}