summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2004-08-13 21:04:17 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2004-08-13 21:04:17 +0000
commite0f9c2b4a42298e77afe8a4513a982b3e3f5bbb2 (patch)
tree90e3f00b7f08394ddc565babbde44146fe066cb9 /gnu
parentb750e62e178d69b14b5aef913092d3a5d7ef037d (diff)
Add sparc64 libkvm kernel memory image debugging support.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/binutils/gdb/config/sparc/nbsd64.mh4
-rw-r--r--gnu/usr.bin/binutils/gdb/config/sparc/obsd64.mt2
-rw-r--r--gnu/usr.bin/binutils/gdb/sparc64nbsd-nat.c39
3 files changed, 41 insertions, 4 deletions
diff --git a/gnu/usr.bin/binutils/gdb/config/sparc/nbsd64.mh b/gnu/usr.bin/binutils/gdb/config/sparc/nbsd64.mh
index e8ac58bda2b..9ac8cf477d2 100644
--- a/gnu/usr.bin/binutils/gdb/config/sparc/nbsd64.mh
+++ b/gnu/usr.bin/binutils/gdb/config/sparc/nbsd64.mh
@@ -1,4 +1,6 @@
# Host: NetBSD/sparc64
-NATDEPFILES= sparc64nbsd-nat.o sparc-nat.o \
+NATDEPFILES= sparc64nbsd-nat.o sparc-nat.o bsd-kvm.o \
fork-child.o infptrace.o inftarg.o
NAT_FILE= nm-nbsd.h
+
+LOADLIBES= -lkvm
diff --git a/gnu/usr.bin/binutils/gdb/config/sparc/obsd64.mt b/gnu/usr.bin/binutils/gdb/config/sparc/obsd64.mt
index a69281754c4..82587dfc84a 100644
--- a/gnu/usr.bin/binutils/gdb/config/sparc/obsd64.mt
+++ b/gnu/usr.bin/binutils/gdb/config/sparc/obsd64.mt
@@ -1,5 +1,5 @@
# Target: OpenBSD/sparc64
TDEPFILES= sparc64-tdep.o sparc64nbsd-tdep.o sparc64obsd-tdep.o \
- sparc-tdep.o sparcnbsd-tdep.o nbsd-tdep.o \
+ sparc-tdep.o sparcnbsd-tdep.o sparcobsd-tdep.o nbsd-tdep.o \
corelow.o solib.o solib-svr4.o
TM_FILE= tm-nbsd.h
diff --git a/gnu/usr.bin/binutils/gdb/sparc64nbsd-nat.c b/gnu/usr.bin/binutils/gdb/sparc64nbsd-nat.c
index 91577039eb3..7d554cf6089 100644
--- a/gnu/usr.bin/binutils/gdb/sparc64nbsd-nat.c
+++ b/gnu/usr.bin/binutils/gdb/sparc64nbsd-nat.c
@@ -20,6 +20,7 @@
Boston, MA 02111-1307, USA. */
#include "defs.h"
+#include "regcache.h"
#include "sparc64-tdep.h"
#include "sparc-nat.h"
@@ -122,13 +123,44 @@ sparc64nbsd_fpregset_supplies_p (int regnum)
return 0;
}
+
+
+/* Support for debugging kernel virtual memory images. */
+
+#include <sys/types.h>
+#include <machine/pcb.h>
+
+#include "bsd-kvm.h"
+
+static int
+sparc64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+ int regnum;
+
+ /* The following is true for NetBSD 1.6.2:
+
+ The pcb contains %sp and %pc, %psr and %wim. From this information
+ we reconstruct the register state as it would look when we just
+ returned from cpu_switch(). */
+
+ /* The stack pointer shouldn't be zero. */
+ if (pcb->pcb_sp == 0)
+ return 0;
+
+ regcache_raw_supply (regcache, SPARC_SP_REGNUM, &pcb->pcb_sp);
+ regcache_raw_supply (regcache, SPARC64_PC_REGNUM, &pcb->pcb_pc);
+
+ sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
+
+ return 1;
+}
/* Provide a prototype to silence -Wmissing-prototypes. */
-void _initialize_sparcnbsd_nat (void);
+void _initialize_sparc64nbsd_nat (void);
void
-_initialize_sparcnbsd_nat (void)
+_initialize_sparc64nbsd_nat (void)
{
sparc_supply_gregset = sparc64nbsd_supply_gregset;
sparc_collect_gregset = sparc64nbsd_collect_gregset;
@@ -136,4 +168,7 @@ _initialize_sparcnbsd_nat (void)
sparc_collect_fpregset = sparc64nbsd_collect_fpregset;
sparc_gregset_supplies_p = sparc64nbsd_gregset_supplies_p;
sparc_fpregset_supplies_p = sparc64nbsd_fpregset_supplies_p;
+
+ /* Support debugging kernel virtual memory images. */
+ bsd_kvm_add_target (sparc64nbsd_supply_pcb);
}