On 12/07/2024 18:48, Tom Rini wrote:
On Wed, Jul 10, 2024 at 06:26:17PM +0200, Caleb Connolly wrote:

U-Boot already emits frame pointers on ARM64, but lacks the code to
parse them, as well as a mechanism for looking up symbol names at
runtime.

There was some (seemingly?) leftover code for symbols lookups in
common/kallsyms.c and associated parts in the makefile, however it
appears to be entirely unused and unsupported. It relied on generating
one long string of all symbol addresses and names.

The approach taken here is instead largely based on the implementation
in the Xen hypervisor, it performs basic compression using non-ASCII
bytes to tokenize repeated string segments which can later be expanded
back out at runtime.

This is then utilized in the ARM64 interrupt handling routine to dump a
backtrace in the show_regs() debug function. As well as providing a
general purpose unwind_stack() function which can be used for debugging.

Just a few minor comments from me in general, and I'm glad to see this.
Please submit the next version non-RFC, thanks.

Thanks for the review.

One thing I'm a little unsure about before sending the next version: is it better to print the address in the link register or the address of the function in the backtrace?

In the example below I print the function address offset by _start, but that doesn't seem very useful for either interactive debugging or decompilation. Maybe the absolute address in the link register would be more useful.

I'm leaning towards the latter, but open to ideas.

Backtrace:
        <0x0000000001bb4c> do_mem_mw+0xbc
        <0x000000bb729cec> cmd_process+0x130
        <0x000000bb7213f8> run_list_real+0x6d0
        <0x000000bb721b08> parse_stream_outer+0x14c
        <0x000000bb722164> parse_file_outer+0x34
        <0x000000bb72929c> cli_loop+0x1c
        <0x000000bb71f1dc> main_loop+0x54
        <0x000000bb7229dc> run_main_loop+0x14
        <0x000000bb777664> initcall_run_list+0x7c
        <0x000000bb722bf8> board_init_r+0x34


--
// Caleb (they/them)

Reply via email to