diff options
author | Mark Kettenis <kettenis@gnu.org> | 2004-05-22 22:34:44 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2004-05-22 22:34:44 +0000 |
commit | a770d4eca642f4ae0d2e2e8d04a76933afed7b78 (patch) | |
tree | bb28c848354e7e511bb38594165a601e0a017ce2 /gdb/sparcnbsd-nat.c | |
parent | 2e0c35398db447a1fbe111c52507afe4eb313971 (diff) | |
download | binutils-gdb-a770d4eca642f4ae0d2e2e8d04a76933afed7b78.tar.gz |
* sparcnbsd-nat.c: Include "gdbcore.h", "regcache.h",
<sys/types.h>, <machine/pcb.h> and "bsd-kvm.h".
(sparc32nbsd_supply_pcb): New function.
(_initialize_sparcnbsd_nat): Enable libkvm interface.
* Makefile.in (sparcnbsd-nat.o): Update dependencies.
* config/sparc/nbsdelf.mh (NATDEPFILES): Add bsd-kvm.o.
(LOADLIBES): New variable.
Diffstat (limited to 'gdb/sparcnbsd-nat.c')
-rw-r--r-- | gdb/sparcnbsd-nat.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gdb/sparcnbsd-nat.c b/gdb/sparcnbsd-nat.c index 9038ea334b6..01089eeef32 100644 --- a/gdb/sparcnbsd-nat.c +++ b/gdb/sparcnbsd-nat.c @@ -20,10 +20,44 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" +#include "gdbcore.h" +#include "regcache.h" #include "sparc-tdep.h" #include "sparc-nat.h" +/* Support for debugging kernel virtual memory images. */ + +#include <sys/types.h> +#include <machine/pcb.h> + +#include "bsd-kvm.h" + +static int +sparc32nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) +{ + /* The following is true for NetBSD 1.6.2: + + The pcb contains %sp, %sp, %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, SPARC_O7_REGNUM, &pcb->pcb_pc); + regcache_raw_supply (regcache, SPARC32_PSR_REGNUM, &pcb->pcb_psr); + regcache_raw_supply (regcache, SPARC32_WIM_REGNUM, &pcb->pcb_wim); + regcache_raw_supply (regcache, SPARC32_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); @@ -31,4 +65,7 @@ void _initialize_sparcnbsd_nat (void) { sparc_gregset = &sparc32nbsd_gregset; + + /* Support debugging kernel virtual memory images. */ + bsd_kvm_add_target (sparc32nbsd_supply_pcb); } |