aboutsummaryrefslogtreecommitdiff
path: root/gdb/vaxbsd-nat.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-07-17 11:03:49 +0000
committerMark Kettenis <kettenis@gnu.org>2004-07-17 11:03:49 +0000
commit7ddd7709149d9789a53d455f7bc9ba4c83635608 (patch)
tree6906ba596995be648bcfdae8ac16650d94143760 /gdb/vaxbsd-nat.c
parent2c07db7ac031ac855c833c5ceed59763d4011290 (diff)
downloadgdb-7ddd7709149d9789a53d455f7bc9ba4c83635608.zip
gdb-7ddd7709149d9789a53d455f7bc9ba4c83635608.tar.gz
gdb-7ddd7709149d9789a53d455f7bc9ba4c83635608.tar.bz2
* vaxbsd-nat.c: Include <sys/types.h>, <machine/pcb.h> and
"bsd-kvm.h". (vaxbsd_supply_pcb): New function. (_initialize_vaxbsd_nat): New prototype and function. * config/vax/nbsdaout.mh (NATDEPFILES): Add bsd-kvm.o, solib.o and solib-sunos.o. (LOADLIBES): New variable. * config/vax/nbsdelf.mh (NATDEPFILES): Add bsd-kvm.o. (LOADLIBES): New variable. * config/vax/obsd.mh (NATDEPFILES): Add bsd-kvm.o. (LOADLIBES): New variable. * Makefile.in (vaxbsd-nat.o): Update dependencies.
Diffstat (limited to 'gdb/vaxbsd-nat.c')
-rw-r--r--gdb/vaxbsd-nat.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/gdb/vaxbsd-nat.c b/gdb/vaxbsd-nat.c
index d2757c5..0529f3e 100644
--- a/gdb/vaxbsd-nat.c
+++ b/gdb/vaxbsd-nat.c
@@ -92,3 +92,47 @@ store_inferior_registers (int regnum)
(PTRACE_ARG3_TYPE) &regs, 0) == -1)
perror_with_name ("Couldn't write registers");
}
+
+
+/* Support for debugging kernel virtual memory images. */
+
+#include <sys/types.h>
+#include <machine/pcb.h>
+
+#include "bsd-kvm.h"
+
+static int
+vaxbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+ int regnum;
+
+ /* The following is true for OpenBSD 3.5:
+
+ The pcb contains the register state at the context switch inside
+ cpu_switch(). */
+
+ /* The stack pointer shouldn't be zero. */
+ if (pcb->KSP == 0)
+ return 0;
+
+ for (regnum = VAX_R0_REGNUM; regnum < VAX_AP_REGNUM; regnum++)
+ regcache_raw_supply (regcache, regnum, &pcb->R[regnum - VAX_R0_REGNUM]);
+ regcache_raw_supply (regcache, VAX_AP_REGNUM, &pcb->AP);
+ regcache_raw_supply (regcache, VAX_FP_REGNUM, &pcb->FP);
+ regcache_raw_supply (regcache, VAX_SP_REGNUM, &pcb->KSP);
+ regcache_raw_supply (regcache, VAX_PC_REGNUM, &pcb->PC);
+ regcache_raw_supply (regcache, VAX_PS_REGNUM, &pcb->PSL);
+
+ return 1;
+}
+
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+void _initialize_vaxbsd_nat (void);
+
+void
+_initialize_vaxbsd_nat (void)
+{
+ /* Support debugging kernel virtual memory images. */
+ bsd_kvm_add_target (vaxbsd_supply_pcb);
+}