stack_unwind
Reconstruct the call chain from a Cortex-M fault stack frame to locate the faulting function. Accepts an ELF path, optional frame, SP, and EXC_RETURN for accurate MSP/PSP and FPU frame handling.
Instructions
栈回溯:把 fault 时压栈的 8 个字还原成调用链,定位出错函数。
frame 按硬件压栈顺序:[R0, R1, R2, R3, R12, LR, PC, xPSR] stack_unwind("build/app.elf", frame=[r0,r1,r2,r3,r12,lr,pc,xpsr]) ★同 symbol_lookup:优先给 .elf。.map 的符号表稀疏时 PC/LR 可能反查出 假函数名,工具会就此提示。 exc_return 传 handler 入口时的 LR——它决定栈帧是标准还是 FPU 扩展、 以及异常前用的是 MSP 还是 PSP(RTOS 任务)。传了会给出更准的判断。 ★ PC 反查不到符号时,说明是典型「跑飞」,工具会给排查方向。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sp | No | ||
| path | Yes | ||
| frame | No | ||
| exc_return | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |