-/* Disassembler for the Pyramid Technology 90x
- Copyright (C) 1988,1989 Free Software Foundation, Inc.
+/* Print Pyramid Technology 90x instructions for GDB, the GNU Debugger.
+ Copyright 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
-This file is part of GDB, the GNU disassembler.
+This file is part of GDB, the GNU debugger.
-GDB is free software; you can redistribute it and/or modify
+This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
-GDB is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
-#include "param.h"
#include "symtab.h"
-#include "opcode.h"
+#include "opcode/pyr.h"
+#include "gdbcore.h"
\f
/* A couple of functions used for debugging frame-handling on
Pyramids. (The Pyramid-dependent handling of register values for
windowed registers is known to be buggy.)
- When debugging, these functions supplant the normal definitions of some
- of the macros in m-pyramid.h The quantity of information produced
+ When debugging, these functions can supplant the normal definitions of some
+ of the macros in tm-pyramid.h The quantity of information produced
when these functions are used makes the gdb unusable as a
debugger for user programs. */
CORE_ADDR frame;
{
int foo=frame - CONTROL_STACK_FRAME_SIZE;
- /* printf ("...following chain from %x: got %x\n", frame, foo);*/
+ /* printf_unfiltered ("...following chain from %x: got %x\n", frame, foo);*/
return foo;
}
{
int foo=0;
foo = read_memory_integer (((CORE_ADDR)(frame))+60, 4);
- printf ("..reading pc from frame 0x%0x+%d regs: got %0x\n",
+ printf_unfiltered ("..reading pc from frame 0x%0x+%d regs: got %0x\n",
frame, 60/4, foo);
return foo;
}
-\f
/* Pyramid instructions are never longer than this many bytes. */
#define MAXLEN 24
/*const*/ static int nopcodes = (sizeof (pyr_opcodes) / sizeof( pyr_opcodes[0]));
#define NOPCODES (nopcodes)
-extern char *reg_names[];
-\f
-/* Let's be byte-independent so we can use this as a cross-assembler.
- (will this ever be useful?
- */
+/* Let's be byte-independent so we can use this as a cross-assembler. */
#define NEXTLONG(p) \
(p += 4, (((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1])
-
\f
/* Print one instruction at address MEMADDR in debugged memory,
on STREAM. Returns length of the instruction, in bytes. */
if (*((int *)buffer) == 0x0) {
/* "halt" looks just like an invalid "jump" to the insn decoder,
so is dealt with as a special case */
- fprintf (stream, "halt");
+ fprintf_unfiltered (stream, "halt");
return (4);
}
if (i == NOPCODES)
/* FIXME: Handle unrecognised instructions better. */
- fprintf (stream, "???\t#%08x\t(op=%x mode =%x)",
+ fprintf_unfiltered (stream, "???\t#%08x\t(op=%x mode =%x)",
insn, insn_decode.operator, insn_decode.mode);
else
{
special case: check the operands of branch insn and print an
appropriate mnemonic. */
- fprintf (stream, "%s\t", pyr_opcodes[i].name);
+ fprintf_unfiltered (stream, "%s\t", pyr_opcodes[i].name);
/* Print the operands of the insn (as specified in
insn.operand_mode).
/* Is bfc and no bits specified an unconditional branch?*/
for (i=0;i<4;i++) {
if ((bit_codes) & 0x1)
- fputc (cc_bit_names[i], stream);
+ fputc_unfiltered (cc_bit_names[i], stream);
bit_codes >>= 1;
}
- fprintf (stream, ",%0x",
+ fprintf_unfiltered (stream, ",%0x",
displacement + memaddr);
return (insn_size);
}
switch (operand_mode) {
case 0:
- fprintf (stream, "%s,%s",
+ fprintf_unfiltered (stream, "%s,%s",
reg_names [op_1_regno],
reg_names [op_2_regno]);
break;
case 1:
- fprintf (stream, " 0x%0x,%s",
+ fprintf_unfiltered (stream, " 0x%0x,%s",
op_1_regno,
reg_names [op_2_regno]);
break;
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream, " $0x%0x,%s",
+ fprintf_unfiltered (stream, " $0x%0x,%s",
extra_1,
reg_names [op_2_regno]);
break;
case 3:
- fprintf (stream, " (%s),%s",
+ fprintf_unfiltered (stream, " (%s),%s",
reg_names [op_1_regno],
reg_names [op_2_regno]);
break;
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream, " 0x%0x(%s),%s",
+ fprintf_unfiltered (stream, " 0x%0x(%s),%s",
extra_1,
reg_names [op_1_regno],
reg_names [op_2_regno]);
/* S1 destination mode */
case 5:
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? "%s,(%s)[%s*%1d]" : "%s,(%s)"),
reg_names [op_1_regno],
reg_names [op_2_regno],
break;
case 6:
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? " $%#0x,(%s)[%s*%1d]"
: " $%#0x,(%s)"),
op_1_regno,
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? " $%#0x,(%s)[%s*%1d]"
: " $%#0x,(%s)"),
extra_1,
break;
case 8:
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? " (%s),(%s)[%s*%1d]" : " (%s),(%s)"),
reg_names [op_1_regno],
reg_names [op_2_regno],
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno)
? "%#0x(%s),(%s)[%s*%1d]"
: "%#0x(%s),(%s)"),
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? "%s,%#0x(%s)[%s*%1d]" : "%s,%#0x(%s)"),
reg_names [op_1_regno],
extra_1,
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ?
" $%#0x,%#0x(%s)[%s*%1d]" : " $%#0x,%#0x(%s)"),
op_1_regno,
read_memory (memaddr+8, buffer, MAXLEN);
insn_size += 4;
extra_2 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ?
" $%#0x,%#0x(%s)[%s*%1d]" : " $%#0x,%#0x(%s)"),
extra_1,
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno)
? " (%s),%#0x(%s)[%s*%1d]"
: " (%s),%#0x(%s)"),
read_memory (memaddr+8, buffer, MAXLEN);
insn_size += 4;
extra_2 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? "%#0x(%s),%#0x(%s)[%s*%1d]"
: "%#0x(%s),%#0x(%s) "),
extra_1,
break;
default:
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? "%s,%s [%s*%1d]" : "%s,%s"),
reg_names [op_1_regno],
reg_names [op_2_regno],
reg_names [index_reg_regno],
index_multiplier);
- fprintf (stream,
+ fprintf_unfiltered (stream,
"\t\t# unknown mode in %08x",
insn);
break;