Without the CPSR register, gdb is unable to correctly step over a conditional
branch. This is because it cannot see the condition code bits, and thus cannot
determine which side of the branch to place the breakpoint.
This patch fixes the register layout of the registers passed to the host gdb,
so that CPSR is properly interpreted.
Signed-off-by: Kevin Hilman <[EMAIL PROTECTED]>
Signed-off-by: Sergei Shtylyov <[EMAIL PROTECTED]>
arch/arm/kernel/kgdb.c | 2 +-
include/asm-arm/kgdb.h | 26 +++++++++++++++++++-------
2 files changed, 20 insertions(+), 8 deletions(-)
Index: linux-2.6/arch/arm/kernel/kgdb.c
===================================================================
--- linux-2.6.orig/arch/arm/kernel/kgdb.c
+++ linux-2.6/arch/arm/kernel/kgdb.c
@@ -77,7 +77,7 @@ void gdb_regs_to_regs(unsigned long *gdb
kernel_regs->ARM_sp = gdb_regs[_SP];
kernel_regs->ARM_lr = gdb_regs[_LR];
kernel_regs->ARM_pc = gdb_regs[_PC];
- kernel_regs->ARM_cpsr = gdb_regs[GDB_MAX_REGS - 1];
+ kernel_regs->ARM_cpsr = gdb_regs[_CPSR];
}
static inline struct pt_regs *kgdb_get_user_regs(struct task_struct *task)
Index: linux-2.6/include/asm-arm/kgdb.h
===================================================================
--- linux-2.6.orig/include/asm-arm/kgdb.h
+++ linux-2.6/include/asm-arm/kgdb.h
@@ -51,15 +51,27 @@ extern int kgdb_fault_expected;
#endif /* !__ASSEMBLY__ */
/*
- * From Amit S. Kale:
+ * From Kevin Hilman:
*
- * In the register packet, words 0-15 are R0 to R10, FP, IP, SP, LR, PC. But
- * Register 16 isn't cpsr. GDB passes CPSR in word 25. There are 9 words in
- * between which are unused. Passing only 26 words to gdb is sufficient.
- * GDB can figure out that floating point registers are not passed.
- * GDB_MAX_REGS should be 26.
+ * gdb is expecting the following registers layout.
+ *
+ * r0-r15: 1 long word each
+ * f0-f7: unused, 3 long words each !!
+ * fps: unused, 1 long word
+ * cpsr: 1 long word
+ *
+ * Even though f0-f7 and fps are not used, they need to be
+ * present in the registers sent for correct processing in
+ * the host-side gdb.
+ *
+ * In particular, it is crucial that CPSR is in the right place,
+ * otherwise gdb will not be able to correctly interpret stepping over
+ * conditional branches.
*/
-#define GDB_MAX_REGS (26)
+#define _GP_REGS 16
+#define _FP_REGS 8
+#define _EXTRA_REGS 2
+#define GDB_MAX_REGS (_GP_REGS + (_FP_REGS * 3) +
_EXTRA_REGS)
#define KGDB_MAX_NO_CPUS 1
#define BUFMAX 400
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport