aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparc64nbsd-nat.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-07-23 10:33:37 +0000
committerMark Kettenis <kettenis@gnu.org>2004-07-23 10:33:37 +0000
commit90f3cecd6ae6ffb2adb87e4d46a4317e0a7bcf10 (patch)
tree482b3d326e5cd437b68b616654a1f834b3a2b7fa /gdb/sparc64nbsd-nat.c
parenta4954a62fca0b9d4679b2549a84b5d224ca062ae (diff)
downloadgdb-90f3cecd6ae6ffb2adb87e4d46a4317e0a7bcf10.zip
gdb-90f3cecd6ae6ffb2adb87e4d46a4317e0a7bcf10.tar.gz
gdb-90f3cecd6ae6ffb2adb87e4d46a4317e0a7bcf10.tar.bz2
* sparc64nbsd-nat.c: Include "regcache.h", <sys/types.h>,
<machine/pcb.h> and "bsd-kvm.h". (sparc64nbsd_supply_pcb): New function. (_initialize_sparc64nbsd_nat): Renamed from _initialize_sparcnbsd_nat. Enable libkvm interface. * Makefile.in (sparc64nbsd-nat.o): Update dependencies. * config/sparc/nbsd64.mh (NATDEPFILES): Add bsd-kvm.o (LOADLIBES): New variable.
Diffstat (limited to 'gdb/sparc64nbsd-nat.c')
-rw-r--r--gdb/sparc64nbsd-nat.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/gdb/sparc64nbsd-nat.c b/gdb/sparc64nbsd-nat.c
index 9157703..7d554cf 100644
--- a/gdb/sparc64nbsd-nat.c
+++ b/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);
}