From 9fda010b32a6d1ffbfaaae98f63470d8bce33c0b Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Fri, 12 Sep 2014 12:24:43 +1200 Subject: [PATCH] Give up unwinding a fault if reading the stack fails. --- src/cortexm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cortexm.c b/src/cortexm.c index 1142394..8c2e54e 100644 --- a/src/cortexm.c +++ b/src/cortexm.c @@ -693,6 +693,8 @@ static int cortexm_fault_unwind(struct target_s *target) /* Read stack for pre-exception registers */ uint32_t sp = spsel ? regs[REG_PSP] : regs[REG_MSP]; target_mem_read_words(target, stack, sp, sizeof(stack)); + if (target_check_error(target)) + return 0; regs[REG_LR] = stack[5]; /* restore LR to pre-exception state */ regs[REG_PC] = stack[6]; /* restore PC to pre-exception state */