backtrace: sandbox: Add support for obtaining symbols
Add backtrace functions for sandbox, including: - os_backtrace() to collect addresses into a caller-supplied buffer - os_backtrace_symbols() to convert addresses to symbol strings - os_backtrace_symbols_free() to free the symbol array The libbacktrace library (bundled with GCC) reads DWARF debug information to provide detailed symbol resolution including function names (even for static functions), source file paths, and line numbers. The sandbox backtrace implementation wraps these OS functions to implement the generic backtrace API (backtrace_init, backtrace_get_syms, etc.). Enable it for just the 'sandbox' board. Add the library for the Rust example too. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
@@ -65,6 +65,9 @@ fn main() {
|
||||
// Fallback to just SDL2 if sdl2-config is not available
|
||||
println!("cargo:rustc-link-arg=-lSDL2");
|
||||
}
|
||||
|
||||
// Link with libbacktrace for backtrace support on sandbox
|
||||
println!("cargo:rustc-link-arg=-lbacktrace");
|
||||
}
|
||||
|
||||
// For dynamic linking, link required system libraries normally
|
||||
|
||||
@@ -44,4 +44,4 @@ SHARED_LDFLAGS := -L$(UBOOT_BUILD) -lu-boot -Wl,-rpath,$(UBOOT_BUILD)
|
||||
STATIC_LDFLAGS := -Wl,-T,$(LIB_STATIC_LDS) \
|
||||
-Wl,--whole-archive $(UBOOT_BUILD)/libu-boot.a \
|
||||
-Wl,--no-whole-archive \
|
||||
-lpthread -ldl $(PLATFORM_LIBS) -Wl,-z,noexecstack
|
||||
-lpthread -ldl -lbacktrace $(PLATFORM_LIBS) -Wl,-z,noexecstack
|
||||
|
||||
Reference in New Issue
Block a user