diff --git a/src/cortexm.c b/src/cortexm.c index 11423943..8c2e54ed 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 */