NetBSD/gnu/dist/toolchain/gdb/vax-tdep.c

73 lines
2.2 KiB
C

/* Print VAX instructions for GDB, the GNU debugger.
Copyright 1986, 1989, 1991, 1992, 1996 Free Software Foundation, Inc.
This file is part of GDB.
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 2 of the License, or
(at your option) any later version.
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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "symtab.h"
#include "gdbcore.h"
#include "frame.h"
#include "value.h"
#include "opcode/vax.h"
/* Advance PC across any function entry prologue instructions
to reach some "real" code. */
CORE_ADDR
vax_skip_prologue (pc)
CORE_ADDR pc;
{
register int op = (unsigned char) read_memory_integer (pc, 1);
if (op == 0x11)
pc += 2; /* skip brb */
if (op == 0x31)
pc += 3; /* skip brw */
if (op == 0xC2
&& ((unsigned char) read_memory_integer (pc + 2, 1)) == 0x5E)
pc += 3; /* skip subl2 */
if (op == 0x9E
&& ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xAE
&& ((unsigned char) read_memory_integer (pc + 3, 1)) == 0x5E)
pc += 4; /* skip movab */
if (op == 0x9E
&& ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xCE
&& ((unsigned char) read_memory_integer (pc + 4, 1)) == 0x5E)
pc += 5; /* skip movab */
if (op == 0x9E
&& ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xEE
&& ((unsigned char) read_memory_integer (pc + 6, 1)) == 0x5E)
pc += 7; /* skip movab */
return pc;
}
/* Return number of args passed to a frame.
Can return -1, meaning no way to tell. */
int
vax_frame_num_args (fi)
struct frame_info *fi;
{
return (0xff & read_memory_integer (FRAME_ARGS_ADDRESS (fi), 1));
}
void
_initialize_vax_tdep ()
{
tm_print_insn = print_insn_vax;
}