aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog23
-rw-r--r--gdb/vax-tdep.c70
-rw-r--r--gdb/vax-tdep.h44
3 files changed, 64 insertions, 73 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7af3426..73c553c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,26 @@
+2004-04-12 Mark Kettenis <kettenis@gnu.org>
+
+ * vax-tdep.h: Update copyright year. Adjust comments.
+ (VAX_REGISTER_SIZE, VAX_REGISTER_BYTES, VAX_MAX_REGISTER_RAW_SIZE,
+ VAX_MAX_REGISTER_VIRTUAL_SIZE): Remove macros.
+ (vax_regnum): New enum. Replacing...
+ (VAX_AP_REGNUM, VAX_FP_REGNUM, VAX_SP_REGNUM, VAX_PC_REGNUM)
+ (VAX_PS_REGNUM): ... these removed macros.
+ * vax-tdep.c (vax_register_name): Remove prototype.
+ (vax_register_name): Reorganize somewhat. Use ARRAY_SIZE.
+ (vax_register_byte, vax_register_raw_size,
+ vax_register_virtual_size, vax_register_virtual_type): Remove
+ functions.
+ (vax_register_type): New function.
+ (vax_breakpoint_from_pc): Reorganize.
+ (vax_gdbarch_init): Set register_type. Don't set
+ deprecated_register_size, deprecated_register_bytes,
+ deprecated_register_byte, deprecated_register_raw_size,
+ deprecated_max_register_raw_size,
+ deprecated_register_virtual_size,
+ deprecated_max_register_virtual_size and
+ deprecated_register_virtual_type. Add comment on stack direction.
+
2004-04-11 Mark Kettenis <kettenis@gnu.org>
* amd64-tdep.h (amd64_regnum): Add AMD64_CS_REGNUM,
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index a0eac7d..cf2f86c 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -35,8 +35,6 @@
#include "vax-tdep.h"
-static gdbarch_register_name_ftype vax_register_name;
-
static gdbarch_skip_prologue_ftype vax_skip_prologue;
static gdbarch_frame_num_args_ftype vax_frame_num_args;
static gdbarch_deprecated_frame_chain_ftype vax_frame_chain;
@@ -45,45 +43,32 @@ static gdbarch_deprecated_extract_return_value_ftype vax_extract_return_value;
static gdbarch_deprecated_push_dummy_frame_ftype vax_push_dummy_frame;
+
+/* Return the name of register REGNUM. */
+
static const char *
-vax_register_name (int regno)
+vax_register_name (int regnum)
{
static char *register_names[] =
{
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "ap", "fp", "sp", "pc",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "ap", "fp", "sp", "pc",
"ps",
};
- if (regno < 0)
- return (NULL);
- if (regno >= (sizeof(register_names) / sizeof(*register_names)))
- return (NULL);
- return (register_names[regno]);
-}
+ if (regnum >= 0 && regnum < ARRAY_SIZE (register_names))
+ return register_names[regnum];
-static int
-vax_register_byte (int regno)
-{
- return (regno * 4);
+ return NULL;
}
-static int
-vax_register_raw_size (int regno)
-{
- return (4);
-}
-
-static int
-vax_register_virtual_size (int regno)
-{
- return (4);
-}
+/* Return the GDB type object for the "standard" data type of data in
+ register REGNUM. */
static struct type *
-vax_register_virtual_type (int regno)
+vax_register_type (struct gdbarch *gdbarch, int regnum)
{
- return (builtin_type_int);
+ return builtin_type_int;
}
static void
@@ -273,13 +258,20 @@ vax_store_return_value (struct type *valtype, char *valbuf)
deprecated_write_register_bytes (0, valbuf, TYPE_LENGTH (valtype));
}
+
+/* Use the program counter to determine the contents and size of a
+ breakpoint instruction. Return a pointer to a string of bytes that
+ encode a breakpoint instruction, store the length of the string in
+ *LEN and optionally adjust *PC to point to the correct memory
+ location for inserting the breakpoint. */
+
static const unsigned char *
-vax_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
+vax_breakpoint_from_pc (CORE_ADDR *pc, int *len)
{
- static const unsigned char vax_breakpoint[] = { 3 };
+ static unsigned char break_insn[] = { 3 };
- *lenptr = sizeof(vax_breakpoint);
- return (vax_breakpoint);
+ *len = sizeof (break_insn);
+ return break_insn;
}
/* Advance PC across any function entry prologue instructions
@@ -342,22 +334,13 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Register info */
set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS);
+ set_gdbarch_register_name (gdbarch, vax_register_name);
+ set_gdbarch_register_type (gdbarch, vax_register_type);
set_gdbarch_sp_regnum (gdbarch, VAX_SP_REGNUM);
set_gdbarch_deprecated_fp_regnum (gdbarch, VAX_FP_REGNUM);
set_gdbarch_pc_regnum (gdbarch, VAX_PC_REGNUM);
set_gdbarch_ps_regnum (gdbarch, VAX_PS_REGNUM);
- set_gdbarch_register_name (gdbarch, vax_register_name);
- set_gdbarch_deprecated_register_size (gdbarch, VAX_REGISTER_SIZE);
- set_gdbarch_deprecated_register_bytes (gdbarch, VAX_REGISTER_BYTES);
- set_gdbarch_deprecated_register_byte (gdbarch, vax_register_byte);
- set_gdbarch_deprecated_register_raw_size (gdbarch, vax_register_raw_size);
- set_gdbarch_deprecated_max_register_raw_size (gdbarch, VAX_MAX_REGISTER_RAW_SIZE);
- set_gdbarch_deprecated_register_virtual_size (gdbarch, vax_register_virtual_size);
- set_gdbarch_deprecated_max_register_virtual_size (gdbarch,
- VAX_MAX_REGISTER_VIRTUAL_SIZE);
- set_gdbarch_deprecated_register_virtual_type (gdbarch, vax_register_virtual_type);
-
/* Frame and stack info */
set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue);
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, vax_saved_pc_after_call);
@@ -373,6 +356,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_args_skip (gdbarch, 4);
+ /* Stack grows downward. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
/* Return value info */
diff --git a/gdb/vax-tdep.h b/gdb/vax-tdep.h
index 1a19917..d27f1a8 100644
--- a/gdb/vax-tdep.h
+++ b/gdb/vax-tdep.h
@@ -1,5 +1,6 @@
-/* Common target dependent code for GDB on VAX systems.
- Copyright 2002, 2003 Free Software Foundation, Inc.
+/* Target-dependent code for the VAX.
+
+ Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,35 +22,18 @@
#ifndef VAX_TDEP_H
#define VAX_TDEP_H
-/* Say how long (ordinary) registers are. This is a piece of bogosity
- used in push_word and a few other places; DEPRECATED_REGISTER_RAW_SIZE is the
- real way to know how big a register is. */
-#define VAX_REGISTER_SIZE 4
+/* Register numbers of various important registers. */
+
+enum vax_regnum
+{
+ VAX_AP_REGNUM = 12, /* Argument pointer on user stack. */
+ VAX_FP_REGNUM, /* Address of executing stack frame. */
+ VAX_SP_REGNUM, /* Address of top of stack. */
+ VAX_PC_REGNUM, /* Program counter. */
+ VAX_PS_REGNUM /* Processor status. */
+};
/* Number of machine registers. */
#define VAX_NUM_REGS 17
-/* Total amount of space needed to store our copies of the machine's
- register state. */
-#define VAX_REGISTER_BYTES (VAX_NUM_REGS * 4)
-
-/* Largest value DEPRECATED_REGISTER_RAW_SIZE can have. */
-#define VAX_MAX_REGISTER_RAW_SIZE 4
-
-/* Largest value DEPRECATED_REGISTER_VIRTUAL_SIZE can have. */
-#define VAX_MAX_REGISTER_VIRTUAL_SIZE 4
-
-/* Register numbers of various important registers.
- Note that most of these values are "real" register numbers,
- and correspond to the general registers of the machine,
- and are "phony" register numbers which is too large
- to be an actual register number as far as the user is concerned
- but serves to get the desired value when passed to read_register. */
-
-#define VAX_AP_REGNUM 12 /* argument pointer */
-#define VAX_FP_REGNUM 13 /* Contains address of executing stack frame */
-#define VAX_SP_REGNUM 14 /* Contains address of top of stack */
-#define VAX_PC_REGNUM 15 /* Contains program counter */
-#define VAX_PS_REGNUM 16 /* Contains processor status */
-
-#endif /* VAX_TDEP_H */
+#endif /* vax-tdep.h */