* [RFA] BSD KVM support for NetBSD/powerpc
@ 2004-08-05 18:51 Nathan J. Williams
2004-08-05 20:22 ` Kevin Buettner
0 siblings, 1 reply; 3+ messages in thread
From: Nathan J. Williams @ 2004-08-05 18:51 UTC (permalink / raw)
To: gdb-patches
Pretty much like it says.
2004-08-05 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.
Index: gdb/ppcnbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ppcnbsd-nat.c,v
retrieving revision 1.15
diff -u -r1.15 ppcnbsd-nat.c
--- gdb/ppcnbsd-nat.c 13 May 2004 19:27:07 -0000 1.15
+++ gdb/ppcnbsd-nat.c 5 Aug 2004 18:44:31 -0000
@@ -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 @@
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);
+}
Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.605
diff -u -r1.605 Makefile.in
--- gdb/Makefile.in 5 Aug 2004 14:34:16 -0000 1.605
+++ gdb/Makefile.in 5 Aug 2004 18:44:32 -0000
@@ -2281,7 +2281,8 @@
$(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) \
Index: gdb/config/powerpc/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/nbsd.mh,v
retrieving revision 1.11
diff -u -r1.11 nbsd.mh
--- gdb/config/powerpc/nbsd.mh 30 May 2002 01:21:53 -0000 1.11
+++ gdb/config/powerpc/nbsd.mh 5 Aug 2004 18:44:32 -0000
@@ -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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFA] BSD KVM support for NetBSD/powerpc
2004-08-05 18:51 [RFA] BSD KVM support for NetBSD/powerpc Nathan J. Williams
@ 2004-08-05 20:22 ` Kevin Buettner
2004-08-08 16:53 ` Jason Thorpe
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2004-08-05 20:22 UTC (permalink / raw)
To: Nathan J. Williams; +Cc: gdb-patches
On 05 Aug 2004 14:51:00 -0400
"Nathan J. Williams" <nathanw@wasabisystems.com> wrote:
> Pretty much like it says.
>
> 2004-08-05 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.
Hi Nathan,
If you need my approval on anything in this patch, you've got it.
However, after looking at the MAINTAINERS file, it appears to me
that approval for the ppcnbsd-nat.c part of it falls to Jason Thorpe.
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] BSD KVM support for NetBSD/powerpc
2004-08-05 20:22 ` Kevin Buettner
@ 2004-08-08 16:53 ` Jason Thorpe
0 siblings, 0 replies; 3+ messages in thread
From: Jason Thorpe @ 2004-08-08 16:53 UTC (permalink / raw)
To: Kevin Buettner; +Cc: Nathan J. Williams, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 343 bytes --]
On Aug 5, 2004, at 1:22 PM, Kevin Buettner wrote:
> If you need my approval on anything in this patch, you've got it.
> However, after looking at the MAINTAINERS file, it appears to me
> that approval for the ppcnbsd-nat.c part of it falls to Jason Thorpe.
The patch is OK with me.
-- Jason R. Thorpe <thorpej@wasabisystems.com>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-08-08 16:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-05 18:51 [RFA] BSD KVM support for NetBSD/powerpc Nathan J. Williams
2004-08-05 20:22 ` Kevin Buettner
2004-08-08 16:53 ` Jason Thorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox