Module Name:    src
Committed By:   skrll
Date:           Sat Nov  3 14:59:44 UTC 2012

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

Log Message:
Bring across target kvm support for mips from gdb6.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/mips-tdep.h
cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gdb/dist/gdb/mipsnbsd-nat.c
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gdb/dist/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/external/gpl3/gdb/dist/gdb/mips-tdep.h
diff -u src/external/gpl3/gdb/dist/gdb/mips-tdep.h:1.1.1.1 src/external/gpl3/gdb/dist/gdb/mips-tdep.h:1.2
--- src/external/gpl3/gdb/dist/gdb/mips-tdep.h:1.1.1.1	Sat Sep 24 20:11:33 2011
+++ src/external/gpl3/gdb/dist/gdb/mips-tdep.h	Sat Nov  3 14:59:44 2012
@@ -118,8 +118,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/external/gpl3/gdb/dist/gdb/mipsnbsd-nat.c
diff -u src/external/gpl3/gdb/dist/gdb/mipsnbsd-nat.c:1.4 src/external/gpl3/gdb/dist/gdb/mipsnbsd-nat.c:1.5
--- src/external/gpl3/gdb/dist/gdb/mipsnbsd-nat.c:1.4	Thu Feb  9 15:14:19 2012
+++ src/external/gpl3/gdb/dist/gdb/mipsnbsd-nat.c	Sat Nov  3 14:59:44 2012
@@ -40,6 +40,9 @@ typedef struct fpreg fpregset_t;
 #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
@@ -119,6 +122,43 @@ mipsnbsd_store_inferior_registers (struc
 	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;
+}
 
 /* Wrapper functions.  These are only used by nbsd-thread.  */
 void
@@ -159,4 +199,7 @@ _initialize_mipsnbsd_nat (void)
   t->to_fetch_registers = mipsnbsd_fetch_inferior_registers;
   t->to_store_registers = mipsnbsd_store_inferior_registers;
   add_target (t);
+
+  /* Support debugging kernel virtual memory images.  */
+  bsd_kvm_add_target (mipsnbsd_supply_pcb);
 }

Index: src/external/gpl3/gdb/dist/gdb/config/mips/nbsd.mh
diff -u src/external/gpl3/gdb/dist/gdb/config/mips/nbsd.mh:1.3 src/external/gpl3/gdb/dist/gdb/config/mips/nbsd.mh:1.4
--- src/external/gpl3/gdb/dist/gdb/config/mips/nbsd.mh:1.3	Mon Feb  6 10:46:35 2012
+++ src/external/gpl3/gdb/dist/gdb/config/mips/nbsd.mh	Sat Nov  3 14:59:44 2012
@@ -1,3 +1,4 @@
 # Host: NetBSD/mips
 NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o mipsnbsd-nat.o \
-	nbsd-thread.o
+	nbsd-thread.o bsd-kvm.o
+LOADLIBS= -lkvm

Reply via email to