This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] libkvm interface for NetBSD/sparc64 and OpenBSD/sparc64


This adds another one to the list.

Committed,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* 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.

 
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.595
diff -u -p -r1.595 Makefile.in
--- Makefile.in 17 Jul 2004 11:03:46 -0000 1.595
+++ Makefile.in 23 Jul 2004 10:31:42 -0000
@@ -2418,8 +2418,8 @@ sparc64-linux-tdep.o: sparc64-linux-tdep
 	$(solib_svr4_h) $(sparc64_tdep_h)
 sparc64-nat.o: sparc64-nat.c $(defs_h) $(gdbarch_h) $(sparc64_tdep_h) \
 	$(sparc_nat_h)
-sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(sparc64_tdep_h) \
-	$(sparc_nat_h)
+sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(regcache_h) \
+	$(sparc64_tdep_h) $(sparc_nat_h) $(bsd_kvm_h)
 sparc64nbsd-tdep.o: sparc64nbsd-tdep.c $(defs_h) $(frame_h) \
 	$(frame_unwind_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(regset_h) \
 	$(symtab_h) $(solib_svr4_h) $(trad_frame_h) $(gdb_assert_h) \
Index: sparc64nbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64nbsd-nat.c,v
retrieving revision 1.4
diff -u -p -r1.4 sparc64nbsd-nat.c
--- sparc64nbsd-nat.c 3 Jan 2004 10:08:44 -0000 1.4
+++ sparc64nbsd-nat.c 23 Jul 2004 10:31:42 -0000
@@ -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 reg
 
   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);
 }
Index: config/sparc/nbsd64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nbsd64.mh,v
retrieving revision 1.2
diff -u -p -r1.2 nbsd64.mh
--- config/sparc/nbsd64.mh 3 Jan 2004 10:08:45 -0000 1.2
+++ config/sparc/nbsd64.mh 23 Jul 2004 10:31:42 -0000
@@ -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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]