[PATCH 0/1] ARM: Fix crash when frame cannot be found

Meador Inge
2011-07-19T18:44:09Z

This patch addresses an issue with the ARM prologue analyzer that occurs
when the frame pointer cannot be deduced. The way things are currently
written GDB crashes in some cases.

For example, a crash can occur when the first instruction in the assembly
function in question is 'mov sp, r0'. When stepping GDB kicks off a prologue
analysis from 'arm-tdep.c:arm_make_prologue_cache'. However, it can't actually
find the frame, so it sets the cached frame reg to -1. Later on in
'arm_make_prologue_cache' GDB tries to pass 'cache->framereg' to
'get_frame_register_unsigned' and crashes.

This patch fixes the problem by always falling back on the SP register when
the frame cannot be computed. A similar strategy is used on other
architectures. GDB testsuite run with 'target sim'; no regressions. Some
ad hoc testing done on actual hardware as well.

OK?

Meador Inge (1):
arm: Change prologue analyzer to always fallback on SP.

gdb/arm-tdep.c | 16 +------------
gdb/testsuite/gdb.arch/thumb-prologue.c | 34 +++++++++++++++++++++++++++++
gdb/testsuite/gdb.arch/thumb-prologue.exp | 27 +++++++++++++++++++++++
3 files changed, 63 insertions(+), 14 deletions(-)