summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-07-19 20:24:06 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-07-19 20:24:06 +0000
commit4fa6bff964617d8718df7dd8e6b092600a7b093e (patch)
tree660aa9aa12fb3a5b58e45e1c0a7c3b6504b81695 /gnu/usr.bin
parentbeddfeba89e8397a87a3804ee028b794941173c7 (diff)
``target kvm'' support for alpha; ok kettenis@
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/binutils/gdb/alphabsd-nat.c35
-rw-r--r--gnu/usr.bin/binutils/gdb/config/alpha/obsd.mh6
-rw-r--r--gnu/usr.bin/binutils/gdb/configure.host2
3 files changed, 42 insertions, 1 deletions
diff --git a/gnu/usr.bin/binutils/gdb/alphabsd-nat.c b/gnu/usr.bin/binutils/gdb/alphabsd-nat.c
index 5792ecc5344..13273cc6296 100644
--- a/gnu/usr.bin/binutils/gdb/alphabsd-nat.c
+++ b/gnu/usr.bin/binutils/gdb/alphabsd-nat.c
@@ -150,6 +150,38 @@ alphabsd_store_inferior_registers (int regno)
perror_with_name (_("Couldn't write floating point status"));
}
}
+
+
+/* Support for debugging kernel virtual memory images. */
+
+#include <sys/types.h>
+#include <machine/pcb.h>
+
+#include "bsd-kvm.h"
+
+static int
+alphabsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+ int regnum;
+
+ /* The following is true for OpenBSD 3.9:
+
+ The pcb contains the register state at the context switch inside
+ cpu_switch(). */
+
+ /* The stack pointer shouldn't be zero. */
+ if (pcb->pcb_hw.apcb_ksp == 0)
+ return 0;
+
+ regcache_raw_supply (regcache, ALPHA_SP_REGNUM, &pcb->pcb_hw.apcb_ksp);
+
+ for (regnum = 9; regnum < 16; regnum ++) /* s0-s6 */
+ regcache_raw_supply (regcache, regnum, &pcb->pcb_context[regnum - 9]);
+ regcache_raw_supply (regcache, ALPHA_RA_REGNUM, &pcb->pcb_context[7]);
+
+ return 1;
+}
+
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_alphabsd_nat (void);
@@ -163,4 +195,7 @@ _initialize_alphabsd_nat (void)
t->to_fetch_registers = alphabsd_fetch_inferior_registers;
t->to_store_registers = alphabsd_store_inferior_registers;
add_target (t);
+
+ /* Support debugging kernel virtual memory images. */
+ bsd_kvm_add_target (alphabsd_supply_pcb);
}
diff --git a/gnu/usr.bin/binutils/gdb/config/alpha/obsd.mh b/gnu/usr.bin/binutils/gdb/config/alpha/obsd.mh
new file mode 100644
index 00000000000..5b13449a801
--- /dev/null
+++ b/gnu/usr.bin/binutils/gdb/config/alpha/obsd.mh
@@ -0,0 +1,6 @@
+# Host: OpenBSD/alpha
+NATDEPFILES= fork-child.o inf-ptrace.o \
+ alphabsd-nat.o bsd-kvm.o
+NAT_FILE= nm-nbsd.h
+
+LOADLIBES= -lkvm
diff --git a/gnu/usr.bin/binutils/gdb/configure.host b/gnu/usr.bin/binutils/gdb/configure.host
index 559973ee3cb..5d9d6506d09 100644
--- a/gnu/usr.bin/binutils/gdb/configure.host
+++ b/gnu/usr.bin/binutils/gdb/configure.host
@@ -43,7 +43,7 @@ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
gdb_host=fbsd ;;
alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu)
gdb_host=nbsd ;;
-alpha*-*-openbsd*) gdb_host=nbsd ;;
+alpha*-*-openbsd*) gdb_host=obsd ;;
arm*-*-linux*) gdb_host=linux ;;
arm*-*-netbsdelf* | arm*-*-knetbsd*-gnu)