Fix gdb_cpu_getreg() to actually match GDB's register

definition.
This commit is contained in:
Marcel Moolenaar 2009-11-05 06:31:50 +00:00
parent 2ffa44209a
commit 4590f2282a

View File

@ -53,12 +53,15 @@ gdb_cpu_getreg(int regnum, size_t *regsz)
*regsz = gdb_cpu_regsz(regnum); *regsz = gdb_cpu_regsz(regnum);
if (kdb_thread == curthread) { if (kdb_thread == curthread) {
if (regnum < 16) if (regnum < 15)
return (&kdb_frame->tf_r0 + 4 * regnum); return (&kdb_frame->tf_r0 + regnum);
if (regnum == 15)
return (&kdb_frame->tf_pc);
if (regnum == 25) if (regnum == 25)
return (&kdb_frame->tf_spsr); return (&kdb_frame->tf_spsr);
} }
switch (regnum) { switch (regnum) {
case 8: return (&kdb_thrctx->un_32.pcb32_r8); case 8: return (&kdb_thrctx->un_32.pcb32_r8);
case 9: return (&kdb_thrctx->un_32.pcb32_r9); case 9: return (&kdb_thrctx->un_32.pcb32_r9);
@ -78,6 +81,7 @@ gdb_cpu_getreg(int regnum, size_t *regsz)
return (&kdb_thrctx->un_32.pcb32_pc); return (&kdb_thrctx->un_32.pcb32_pc);
} }
} }
return (NULL); return (NULL);
} }