diff --git a/core/arch/arm/kernel/unwind_arm32.c b/core/arch/arm/kernel/unwind_arm32.c index b8b53c84888..21ccefd39e4 100644 --- a/core/arch/arm/kernel/unwind_arm32.c +++ b/core/arch/arm/kernel/unwind_arm32.c @@ -367,10 +367,11 @@ void print_stack(int level) { struct unwind_state state; - memset(&state, 0, sizeof(state)); + asm volatile("stmia %0, {r0-r12}" :: "r" (state.registers) : "memory"); + state.registers[FP] = (uint32_t)__builtin_frame_address(0); state.registers[SP] = read_sp(); state.registers[LR] = read_lr(); - state.registers[PC] = read_pc(); + state.registers[PC] = (uint32_t)print_stack; do { switch (level) {