RE: [PATCH 1/1] arm: backtrace-clang: fix wrong sp usage for unwinding

From: Maninder Singh

Date: Tue Aug 04 2026 - 23:59:28 EST


Hi Ard, Nathan

Thanks for checking the patch.

> The existing code does seem to be broken, as the provided frame pointer
> value is ignored entirely.
>
> However, by removing this add, you are skipping the false frame, which
> was added to ensure that calling c_backtrace() from dump_backtrace()
> does not miss any frames when regs == NULL.
>
> So I think the correct approach here is to make the add conditional
> on whether frame == fp, which will be the case when c_backtrace()
> is called from dump_backtrace() with a NULL regs argument.
>
> I.e.,
>
>   cmp    frame, fp
>   addeq  frame, sp, #24

Initially I thought we can ignore the extra frame, because we will be getting
the backtrace till show_stack().

But "YES" as you said to ensure dump_backtrace() in Backtrace, it should be there.
So I will send the update change.

Tested with your suggestion:

Call trace:
dump_backtrace from show_stack+0x14/0x18
show_stack from dump_stack_lvl+0x38/0x74
dump_stack_lvl from dump_stack+0x14/0x18
dump_stack from meminfo_proc_show+0x4c/0x908
meminfo_proc_show from seq_read_iter+0x148/0x4bc


Thanks,

Maninder Singh