aboutsummaryrefslogtreecommitdiff
path: root/gdb/vax-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-04-15 15:03:30 +0000
committerMark Kettenis <kettenis@gnu.org>2004-04-15 15:03:30 +0000
commit8b910bab5574ef9cf4674a2fe60a91e243035a66 (patch)
tree73333ad1bfd0d407c0f887aa3d08e30f47747ced /gdb/vax-tdep.c
parent7a46442073403bcb8560c4763768aecee620846b (diff)
downloadgdb-8b910bab5574ef9cf4674a2fe60a91e243035a66.zip
gdb-8b910bab5574ef9cf4674a2fe60a91e243035a66.tar.gz
gdb-8b910bab5574ef9cf4674a2fe60a91e243035a66.tar.bz2
* vax-tdep.c: Include "regset.h".
(vax_supply_gregset): New function. (vax_gregset): New variable. (vax_regset_from_core_section): New function. (vax_gdbarch_init): Set regset_from_core_section. * Makefile.in (vax-tdep.o): Update dependencies.
Diffstat (limited to 'gdb/vax-tdep.c')
-rw-r--r--gdb/vax-tdep.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index f697c9e..1e8986c 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -32,9 +32,11 @@
#include "trad-frame.h"
#include "value.h"
#include "arch-utils.h"
-#include "gdb_string.h"
#include "osabi.h"
#include "dis-asm.h"
+#include "regset.h"
+
+#include "gdb_string.h"
#include "vax-tdep.h"
@@ -65,7 +67,47 @@ vax_register_type (struct gdbarch *gdbarch, int regnum)
return builtin_type_int;
}
+/* Core file support. */
+
+/* Supply register REGNUM from the buffer specified by GREGS and LEN
+ in the general-purpose register set REGSET to register cache
+ REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
+
+static void
+vax_supply_gregset (const struct regset *regset, struct regcache *regcache,
+ int regnum, const void *gregs, size_t len)
+{
+ const char *regs = gregs;
+ int i;
+
+ for (i = 0; i < VAX_NUM_REGS; i++)
+ {
+ if (regnum == i || regnum == -1)
+ regcache_raw_supply (regcache, i, regs + i * 4);
+ }
+}
+/* VAX register set. */
+
+static struct regset vax_gregset =
+{
+ NULL,
+ vax_supply_gregset
+};
+
+/* Return the appropriate register set for the core section identified
+ by SECT_NAME and SECT_SIZE. */
+
+static const struct regset *
+vax_regset_from_core_section (struct gdbarch *gdbarch,
+ const char *sect_name, size_t sect_size)
+{
+ if (strcmp (sect_name, ".reg") == 0 && sect_size >= VAX_NUM_REGS * 4)
+ return &vax_gregset;
+
+ return NULL;
+}
+
/* The VAX Unix calling convention uses R1 to pass a structure return
value address instead of passing it as a first (hidden) argument as
the VMS calling convention suggests. */
@@ -428,6 +470,9 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_pc_regnum (gdbarch, VAX_PC_REGNUM);
set_gdbarch_ps_regnum (gdbarch, VAX_PS_REGNUM);
+ set_gdbarch_regset_from_core_section
+ (gdbarch, vax_regset_from_core_section);
+
/* Frame and stack info */
set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue);
set_gdbarch_frame_num_args (gdbarch, vax_frame_num_args);