Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/gnu/dist/gdb6/gdb target kvm support for mips



details:   https://anonhg.NetBSD.org/src/rev/e396209e60a3
branches:  trunk
changeset: 777729:e396209e60a3
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Mar 02 16:38:20 2012 +0000

description:
target kvm support for mips

diffstat:

 gnu/dist/gdb6/gdb/config/mips/nbsd.mh |   3 +-
 gnu/dist/gdb6/gdb/mips-tdep.h         |  11 ++++++++
 gnu/dist/gdb6/gdb/mipsnbsd-nat.c      |  43 +++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 1 deletions(-)

diffs (96 lines):

diff -r a188ec8fb7d4 -r e396209e60a3 gnu/dist/gdb6/gdb/config/mips/nbsd.mh
--- a/gnu/dist/gdb6/gdb/config/mips/nbsd.mh     Fri Mar 02 16:38:14 2012 +0000
+++ b/gnu/dist/gdb6/gdb/config/mips/nbsd.mh     Fri Mar 02 16:38:20 2012 +0000
@@ -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
diff -r a188ec8fb7d4 -r e396209e60a3 gnu/dist/gdb6/gdb/mips-tdep.h
--- a/gnu/dist/gdb6/gdb/mips-tdep.h     Fri Mar 02 16:38:14 2012 +0000
+++ b/gnu/dist/gdb6/gdb/mips-tdep.h     Fri Mar 02 16:38:20 2012 +0000
@@ -74,8 +74,19 @@
   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,
diff -r a188ec8fb7d4 -r e396209e60a3 gnu/dist/gdb6/gdb/mipsnbsd-nat.c
--- a/gnu/dist/gdb6/gdb/mipsnbsd-nat.c  Fri Mar 02 16:38:14 2012 +0000
+++ b/gnu/dist/gdb6/gdb/mipsnbsd-nat.c  Fri Mar 02 16:38:20 2012 +0000
@@ -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 @@
        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 @@
   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);
 }



Home | Main Index | Thread Index | Old Index