Author: gonzo
Date: Mon Nov  8 00:26:49 2010
New Revision: 214965
URL: http://svn.freebsd.org/changeset/base/214965

Log:
  - Provide more registers for GDB

Modified:
  head/sys/mips/mips/gdb_machdep.c

Modified: head/sys/mips/mips/gdb_machdep.c
==============================================================================
--- head/sys/mips/mips/gdb_machdep.c    Sun Nov  7 23:44:40 2010        
(r214964)
+++ head/sys/mips/mips/gdb_machdep.c    Mon Nov  8 00:26:49 2010        
(r214965)
@@ -117,26 +117,33 @@ gdb_cpu_getreg(int regnum, size_t *regsz
 
        *regsz = gdb_cpu_regsz(regnum);
        if (kdb_thread  == PCPU_GET(curthread)) {
-               switch (regnum) {
-               /*
-               * XXX: May need to add more registers 
-               */
-               case 2: return (&kdb_frame->v0);
-               case 3: return (&kdb_frame->v1);
-               }
+               register_t *zero_ptr = &kdb_frame->zero;
+               return zero_ptr + regnum;
        }
+       
        switch (regnum) {
-       case 16: return (&kdb_thrctx->pcb_context[0]);
-       case 17: return (&kdb_thrctx->pcb_context[1]);
-       case 18: return (&kdb_thrctx->pcb_context[2]);
-       case 19: return (&kdb_thrctx->pcb_context[3]);
-       case 20: return (&kdb_thrctx->pcb_context[4]);
-       case 21: return (&kdb_thrctx->pcb_context[5]);
-       case 22: return (&kdb_thrctx->pcb_context[6]);
-       case 23: return (&kdb_thrctx->pcb_context[7]);
-       case 29: return (&kdb_thrctx->pcb_context[8]);
-       case 30: return (&kdb_thrctx->pcb_context[9]);
-       case 31: return (&kdb_thrctx->pcb_context[10]);
+       /* 
+        * S0..S7
+        */
+       case 16:
+       case 17:
+       case 18:
+       case 19:
+       case 20:
+       case 21:
+       case 22:
+       case 23:
+               return (&kdb_thrctx->pcb_context[PCB_REG_S0 + regnum - 16]);
+       case 28: 
+               return (&kdb_thrctx->pcb_context[PCB_REG_GP]);
+       case 29: 
+               return (&kdb_thrctx->pcb_context[PCB_REG_SP]);
+       case 30: 
+               return (&kdb_thrctx->pcb_context[PCB_REG_S8]);
+       case 31: 
+               return (&kdb_thrctx->pcb_context[PCB_REG_RA]);
+       case 37: 
+               return (&kdb_thrctx->pcb_context[PCB_REG_PC]);
        }
        return (NULL);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to