Module Name:    src
Committed By:   matt
Date:           Fri Mar  2 16:38:21 UTC 2012

Modified Files:
        src/gnu/dist/gdb6/gdb: mips-tdep.h mipsnbsd-nat.c
        src/gnu/dist/gdb6/gdb/config/mips: nbsd.mh

Log Message:
target kvm support for mips


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/gnu/dist/gdb6/gdb/mips-tdep.h
cvs rdiff -u -r1.2 -r1.3 src/gnu/dist/gdb6/gdb/mipsnbsd-nat.c
cvs rdiff -u -r1.2 -r1.3 src/gnu/dist/gdb6/gdb/config/mips/nbsd.mh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/gnu/dist/gdb6/gdb/mips-tdep.h
diff -u src/gnu/dist/gdb6/gdb/mips-tdep.h:1.1.1.2 src/gnu/dist/gdb6/gdb/mips-tdep.h:1.2
--- src/gnu/dist/gdb6/gdb/mips-tdep.h:1.1.1.2	Sun Jul  2 20:14:39 2006
+++ src/gnu/dist/gdb6/gdb/mips-tdep.h	Fri Mar  2 16:38:20 2012
@@ -74,8 +74,19 @@ enum
   MIPS_AT_REGNUM = 1,
   MIPS_V0_REGNUM = 2,		/* Function integer return value.  */
   MIPS_A0_REGNUM = 4,		/* Loc of first arg during a subr call */
+  MIPS_S0_REGNUM = 16,
+  MIPS_S1_REGNUM = 17,
+  MIPS_S2_REGNUM = 18,
+  MIPS_S3_REGNUM = 19,
+  MIPS_S4_REGNUM = 20,
+  MIPS_S5_REGNUM = 21,
+  MIPS_S6_REGNUM = 22,
+  MIPS_S7_REGNUM = 23,
+  MIPS_T8_REGNUM = 24,
   MIPS_T9_REGNUM = 25,		/* Contains address of callee in PIC.  */
+  MIPS_GP_REGNUM = 28,
   MIPS_SP_REGNUM = 29,
+  MIPS_S8_REGNUM = 30,
   MIPS_RA_REGNUM = 31,
   MIPS_PS_REGNUM = 32,		/* Contains processor status.  */
   MIPS_EMBED_LO_REGNUM = 33,

Index: src/gnu/dist/gdb6/gdb/mipsnbsd-nat.c
diff -u src/gnu/dist/gdb6/gdb/mipsnbsd-nat.c:1.2 src/gnu/dist/gdb6/gdb/mipsnbsd-nat.c:1.3
--- src/gnu/dist/gdb6/gdb/mipsnbsd-nat.c:1.2	Wed Dec  6 18:25:29 2006
+++ src/gnu/dist/gdb6/gdb/mipsnbsd-nat.c	Fri Mar  2 16:38:20 2012
@@ -32,6 +32,9 @@
 #include "mips-tdep.h"
 #include "mipsnbsd-tdep.h"
 #include "inf-ptrace.h"
+#include "bsd-kvm.h"
+
+#include "machine/pcb.h"
 
 /* Determine if PT_GETREGS fetches this register.  */
 static int
@@ -104,6 +107,43 @@ mipsnbsd_store_inferior_registers (int r
 	perror_with_name (_("Couldn't write floating point status"));
     }
 }
+
+static int mipsnbsd_supply_pcb (struct regcache *, struct pcb *);
+
+static int
+mipsnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+  struct label_t sf;
+
+  sf = pcb->pcb_context;
+
+  /* really should test for n{32,64} abi for this register
+     unless this is purely the "n" ABI */
+
+  regcache_raw_supply (regcache, MIPS_S0_REGNUM, &sf.val[_L_S0]);
+  regcache_raw_supply (regcache, MIPS_S1_REGNUM, &sf.val[_L_S1]);
+  regcache_raw_supply (regcache, MIPS_S2_REGNUM, &sf.val[_L_S2]);
+  regcache_raw_supply (regcache, MIPS_S3_REGNUM, &sf.val[_L_S3]);
+  regcache_raw_supply (regcache, MIPS_S4_REGNUM, &sf.val[_L_S4]);
+  regcache_raw_supply (regcache, MIPS_S5_REGNUM, &sf.val[_L_S5]);
+  regcache_raw_supply (regcache, MIPS_S6_REGNUM, &sf.val[_L_S6]);
+  regcache_raw_supply (regcache, MIPS_S7_REGNUM, &sf.val[_L_S7]);
+
+  regcache_raw_supply (regcache, MIPS_S8_REGNUM, &sf.val[_L_S8]);
+
+  regcache_raw_supply (regcache, MIPS_T8_REGNUM, &sf.val[_L_T8]);
+
+  regcache_raw_supply (regcache, MIPS_GP_REGNUM, &sf.val[_L_GP]);
+
+  regcache_raw_supply (regcache, MIPS_SP_REGNUM, &sf.val[_L_SP]);
+  regcache_raw_supply (regcache, MIPS_RA_REGNUM, &sf.val[_L_RA]);
+  regcache_raw_supply (regcache, MIPS_PS_REGNUM, &sf.val[_L_SR]);
+
+  /* provide the return address of the savectx as the current pc */
+  regcache_raw_supply (regcache, MIPS_EMBED_PC_REGNUM, &sf.val[_L_RA]);
+
+  return 0;
+}
 
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
@@ -120,4 +160,7 @@ _initialize_mipsnbsd_nat (void)
   t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
 
   add_target (t);
+
+  /* Support debugging kernel virtual memory images.  */
+  bsd_kvm_add_target (mipsnbsd_supply_pcb);
 }

Index: src/gnu/dist/gdb6/gdb/config/mips/nbsd.mh
diff -u src/gnu/dist/gdb6/gdb/config/mips/nbsd.mh:1.2 src/gnu/dist/gdb6/gdb/config/mips/nbsd.mh:1.3
--- src/gnu/dist/gdb6/gdb/config/mips/nbsd.mh:1.2	Wed Dec  6 18:25:29 2006
+++ src/gnu/dist/gdb6/gdb/config/mips/nbsd.mh	Fri Mar  2 16:38:21 2012
@@ -1,2 +1,3 @@
 # Host: NetBSD/mips
-NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o mipsnbsd-nat.o
+NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o mipsnbsd-nat.o bsd-kvm.o
+LOADLIBS= -lkvm

Reply via email to