From 8b910bab5574ef9cf4674a2fe60a91e243035a66 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Thu, 15 Apr 2004 15:03:30 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 9 +++++++++ gdb/Makefile.in | 4 ++-- gdb/vax-tdep.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4db97828171..cb236d17650 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2004-04-15 Mark Kettenis + + * 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. + 2004-04-15 Andrew Cagney * observer.c (normal_stop_subject, observer_notify_normal_stop) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index f5c9ef65e04..29a027e83c5 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2499,8 +2499,8 @@ varobj.o: varobj.c $(defs_h) $(value_h) $(expression_h) $(frame_h) \ $(language_h) $(wrapper_h) $(gdbcmd_h) $(gdb_string_h) $(varobj_h) vax-tdep.o: vax-tdep.c $(defs_h) $(symtab_h) $(opcode_vax_h) $(gdbcore_h) \ $(inferior_h) $(regcache_h) $(frame_h) $(frame_base_h) \ - $(frame_unwind_h) $(value_h) $(arch_utils_h) $(gdb_string_h) \ - $(osabi_h) $(dis_asm_h) $(vax_tdep_h) + $(frame_unwind_h) $(value_h) $(arch_utils_h) $(osabi_h) \ + $(dis_asm_h) $(regset_h) $(gdb_string_h) $(vax_tdep_h) vaxbsd-nat.o: vaxbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(vax_tdep_h) vaxnbsd-tdep.o: vaxnbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \ $(vax_tdep_h) $(solib_svr4_h) diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index f697c9eb0b6..1e8986cda52 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); -- 2.30.2