aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/Makefile.in3
-rw-r--r--gdb/config/powerpc/nbsd.mh4
-rw-r--r--gdb/ppcnbsd-nat.c48
4 files changed, 62 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3657a77..37a5ec3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2004-08-08 Nathan J. Williams <nathanw@wasabisystems.com>
+
+ * ppcnbsd-nat.c: Include <machine/frame.h>, <machine/pcb.h>,
+ "gdbcore.h", "regcache.h", and "bsd-kvm.h".
+ (ppcnbsd_supply_pcb): New function.
+ (_initialize_ppcnbsd_nat): New prototype and function.
+ * config/powerpc/nbsd.mh (NATDEPFILES): Add bsd-kvm.o.
+ (LOADLIBES): New variable.
+ * Makefile.in (ppcnbsd-nat.o): Update dependencies.
+
2004-08-08 Andrew Cagney <cagney@gnu.org>
* gdbtypes.c (builtin_type_arm_ext, builtin_type_ieee_single)
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index eed7a88..0e27df5 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2281,7 +2281,8 @@ ppc-linux-tdep.o: ppc-linux-tdep.c $(defs_h) $(frame_h) $(inferior_h) \
$(objfiles_h) $(regcache_h) $(value_h) $(osabi_h) $(regset_h) \
$(solib_svr4_h) $(ppc_tdep_h) $(trad_frame_h) $(frame_unwind_h)
ppcnbsd-nat.o: ppcnbsd-nat.c $(defs_h) $(inferior_h) $(gdb_assert_h) \
- $(ppc_tdep_h) $(ppcnbsd_tdep_h)
+ $(ppc_tdep_h) $(ppcnbsd_tdep_h) $(gdbcore.h) $(regcache_h) \
+ $(bsd_kvm_h)
ppcnbsd-tdep.o: ppcnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
$(target_h) $(breakpoint_h) $(value_h) $(osabi_h) $(ppc_tdep_h) \
$(ppcnbsd_tdep_h) $(nbsd_tdep_h) $(tramp_frame_h) $(trad_frame_h) \
diff --git a/gdb/config/powerpc/nbsd.mh b/gdb/config/powerpc/nbsd.mh
index 26ba24d..923b5f2 100644
--- a/gdb/config/powerpc/nbsd.mh
+++ b/gdb/config/powerpc/nbsd.mh
@@ -1,3 +1,5 @@
# Host: PowerPC, running NetBSD
-NATDEPFILES= fork-child.o infptrace.o inftarg.o ppcnbsd-nat.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o ppcnbsd-nat.o bsd-kvm.o
NAT_FILE= nm-nbsd.h
+
+LOADLIBES= -lkvm
diff --git a/gdb/ppcnbsd-nat.c b/gdb/ppcnbsd-nat.c
index 7b22b12..ecc70d2 100644
--- a/gdb/ppcnbsd-nat.c
+++ b/gdb/ppcnbsd-nat.c
@@ -1,5 +1,5 @@
/* Native-dependent code for PowerPC's running NetBSD, for GDB.
- Copyright 2002 Free Software Foundation, Inc.
+ Copyright 2002, 2004 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
This file is part of GDB.
@@ -22,10 +22,15 @@
#include <sys/types.h>
#include <sys/ptrace.h>
#include <machine/reg.h>
+#include <machine/frame.h>
+#include <machine/pcb.h>
#include "defs.h"
#include "inferior.h"
#include "gdb_assert.h"
+#include "gdbcore.h"
+#include "regcache.h"
+#include "bsd-kvm.h"
#include "ppc-tdep.h"
#include "ppcnbsd-tdep.h"
@@ -134,3 +139,44 @@ store_inferior_registers (int regno)
perror_with_name ("Couldn't set FP registers");
}
}
+
+static int
+ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+ struct switchframe sf;
+ struct callframe cf;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ int i;
+
+ /* The stack pointer shouldn't be zero. */
+ if (pcb->pcb_sp == 0)
+ return 0;
+
+ read_memory (pcb->pcb_sp, (char *) &sf, sizeof sf);
+ regcache_raw_supply (regcache, tdep->ppc_cr_regnum, &sf.cr);
+ regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 2, &sf.fixreg2);
+ for (i = 0 ; i < 19 ; i++)
+ regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 13 + i,
+ &sf.fixreg[i]);
+
+ read_memory(sf.sp, (char *)&cf, sizeof(cf));
+ regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 30, &cf.r30);
+ regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 31, &cf.r31);
+ regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 1, &cf.sp);
+
+ read_memory(cf.sp, (char *)&cf, sizeof(cf));
+ regcache_raw_supply (regcache, tdep->ppc_lr_regnum, &cf.lr);
+ regcache_raw_supply (regcache, PC_REGNUM, &cf.lr);
+
+ return 1;
+}
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+void _initialize_ppcnbsd_nat (void);
+
+void
+_initialize_ppcnbsd_nat (void)
+{
+ /* Support debugging kernel virtual memory images. */
+ bsd_kvm_add_target (ppcnbsd_supply_pcb);
+}