This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Add NetBSD/vax and OpenBSD/vax corefile support
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 15 Apr 2004 17:05:55 +0200 (CEST)
- Subject: [PATCH] Add NetBSD/vax and OpenBSD/vax corefile support
Committed,
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* 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.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.541
diff -u -p -r1.541 Makefile.in
--- Makefile.in 15 Apr 2004 14:29:20 -0000 1.541
+++ Makefile.in 15 Apr 2004 15:02:50 -0000
@@ -2499,8 +2499,8 @@ varobj.o: varobj.c $(defs_h) $(value_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)
Index: vax-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/vax-tdep.c,v
retrieving revision 1.75
diff -u -p -r1.75 vax-tdep.c
--- vax-tdep.c 15 Apr 2004 12:40:27 -0000 1.75
+++ vax-tdep.c 15 Apr 2004 15:02:51 -0000
@@ -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 *gdbar
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. */
@@ -427,6 +469,9 @@ vax_gdbarch_init (struct gdbarch_info in
set_gdbarch_sp_regnum (gdbarch, VAX_SP_REGNUM);
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);