Commit 834b2964 authored by Rabin Vincent's avatar Rabin Vincent Committed by Jason Wessel

kgdb,arm: fix register dump

DBG_MAX_REG_NUM incorrectly had the number of indices in the GDB regs
array rather than the number of registers, leading to an oops when the
"rd" command is used in KDB.

Cc: stable@kernel.org
Signed-off-by: default avatarRabin Vincent <rabin@rab.in>
Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
parent 931ea248
...@@ -70,7 +70,8 @@ extern int kgdb_fault_expected; ...@@ -70,7 +70,8 @@ extern int kgdb_fault_expected;
#define _GP_REGS 16 #define _GP_REGS 16
#define _FP_REGS 8 #define _FP_REGS 8
#define _EXTRA_REGS 2 #define _EXTRA_REGS 2
#define DBG_MAX_REG_NUM (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS) #define GDB_MAX_REGS (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS)
#define DBG_MAX_REG_NUM (_GP_REGS + _FP_REGS + _EXTRA_REGS)
#define KGDB_MAX_NO_CPUS 1 #define KGDB_MAX_NO_CPUS 1
#define BUFMAX 400 #define BUFMAX 400
...@@ -93,7 +94,7 @@ extern int kgdb_fault_expected; ...@@ -93,7 +94,7 @@ extern int kgdb_fault_expected;
#define _SPT 13 #define _SPT 13
#define _LR 14 #define _LR 14
#define _PC 15 #define _PC 15
#define _CPSR (DBG_MAX_REG_NUM - 1) #define _CPSR (GDB_MAX_REGS - 1)
/* /*
* So that we can denote the end of a frame for tracing, * So that we can denote the end of a frame for tracing,
......
...@@ -79,7 +79,7 @@ sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task) ...@@ -79,7 +79,7 @@ sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task)
return; return;
/* Initialize to zero */ /* Initialize to zero */
for (regno = 0; regno < DBG_MAX_REG_NUM; regno++) for (regno = 0; regno < GDB_MAX_REGS; regno++)
gdb_regs[regno] = 0; gdb_regs[regno] = 0;
/* Otherwise, we have only some registers from switch_to() */ /* Otherwise, we have only some registers from switch_to() */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment