From 4590f2282a421b9cddaed32cf1a0711c5c4ee087 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Thu, 5 Nov 2009 06:31:50 +0000 Subject: [PATCH] Fix gdb_cpu_getreg() to actually match GDB's register definition. --- sys/arm/arm/gdb_machdep.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/arm/arm/gdb_machdep.c b/sys/arm/arm/gdb_machdep.c index a6fa7675e306..eefb046ef901 100644 --- a/sys/arm/arm/gdb_machdep.c +++ b/sys/arm/arm/gdb_machdep.c @@ -53,12 +53,15 @@ gdb_cpu_getreg(int regnum, size_t *regsz) *regsz = gdb_cpu_regsz(regnum); - if (kdb_thread == curthread) { - if (regnum < 16) - return (&kdb_frame->tf_r0 + 4 * regnum); + if (kdb_thread == curthread) { + if (regnum < 15) + return (&kdb_frame->tf_r0 + regnum); + if (regnum == 15) + return (&kdb_frame->tf_pc); if (regnum == 25) return (&kdb_frame->tf_spsr); } + switch (regnum) { case 8: return (&kdb_thrctx->un_32.pcb32_r8); 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 (NULL); }