Source-Changes-HG archive

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

[src/trunk]: src/external/gpl3/gdb/dist/gdb Bring across target kvm support f...



details:   https://anonhg.NetBSD.org/src/rev/8a50b7f15c4b
branches:  trunk
changeset: 782459:8a50b7f15c4b
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Nov 03 14:59:44 2012 +0000

description:
Bring across target kvm support for mips from gdb6.

diffstat:

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

diffs (97 lines):

diff -r 8b821aad112e -r 8a50b7f15c4b external/gpl3/gdb/dist/gdb/config/mips/nbsd.mh
--- a/external/gpl3/gdb/dist/gdb/config/mips/nbsd.mh    Sat Nov 03 14:44:29 2012 +0000
+++ b/external/gpl3/gdb/dist/gdb/config/mips/nbsd.mh    Sat Nov 03 14:59:44 2012 +0000
@@ -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
diff -r 8b821aad112e -r 8a50b7f15c4b external/gpl3/gdb/dist/gdb/mips-tdep.h
--- a/external/gpl3/gdb/dist/gdb/mips-tdep.h    Sat Nov 03 14:44:29 2012 +0000
+++ b/external/gpl3/gdb/dist/gdb/mips-tdep.h    Sat Nov 03 14:59:44 2012 +0000
@@ -118,8 +118,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 8b821aad112e -r 8a50b7f15c4b external/gpl3/gdb/dist/gdb/mipsnbsd-nat.c
--- a/external/gpl3/gdb/dist/gdb/mipsnbsd-nat.c Sat Nov 03 14:44:29 2012 +0000
+++ b/external/gpl3/gdb/dist/gdb/mipsnbsd-nat.c Sat Nov 03 14:59:44 2012 +0000
@@ -40,6 +40,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
@@ -119,6 +122,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;
+}
 
 /* Wrapper functions.  These are only used by nbsd-thread.  */
 void
@@ -159,4 +199,7 @@
   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);
 }



Home | Main Index | Thread Index | Old Index