arm: Let the GDB stub write to SP, LR and GP registers
This can be handy if gdb's stack unwinder fails, for example because of a bug in kgdb's trap frame unwinder. PR: 251463 Submitted by: Dmitry Salychev <dsl@mcusim.org> MFC after: 1 week
This commit is contained in:
parent
d8b227f766
commit
d1593b2a41
@ -97,11 +97,25 @@ gdb_cpu_getreg(int regnum, size_t *regsz)
|
||||
void
|
||||
gdb_cpu_setreg(int regnum, void *val)
|
||||
{
|
||||
if (kdb_thread != curthread)
|
||||
return;
|
||||
|
||||
switch (regnum) {
|
||||
case GDB_REG_PC:
|
||||
if (kdb_thread == curthread)
|
||||
kdb_frame->tf_pc = *(register_t *)val;
|
||||
kdb_frame->tf_pc = *(register_t *)val;
|
||||
break;
|
||||
case GDB_REG_SP:
|
||||
kdb_frame->tf_svc_sp = *(register_t *)val;
|
||||
break;
|
||||
case GDB_REG_LR:
|
||||
kdb_frame->tf_svc_lr = *(register_t *)val;
|
||||
break;
|
||||
default:
|
||||
/* Write to the general purpose registers r0-r12. */
|
||||
if (regnum >= 0 && regnum <= 12) {
|
||||
*(&kdb_frame->tf_r0 + regnum) = *(register_t *)val;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,8 @@
|
||||
|
||||
#define GDB_BUFSZ 400
|
||||
#define GDB_NREGS 26
|
||||
#define GDB_REG_SP 13
|
||||
#define GDB_REG_LR 14
|
||||
#define GDB_REG_PC 15
|
||||
|
||||
static __inline size_t
|
||||
|
Loading…
Reference in New Issue
Block a user