Feature/ksym backtrace - #11768
Conversation
Add optional symbol lookup for native SCons GCC/ELF builds. The generated table includes local, global, and weak functions in a compact relative-address format with a shared string table and per-symbol sizes. Use a lock-free binary search, preserve raw addresses, and canonicalize Thumb addresses only for 32-bit ARM. Verify generated addresses after the multi-pass link. Keep artifacts under build/ksym and pass the toolchain environment to the generators. The option remains disabled by default because the embedded function names and entries consume read-only memory.
Use the kernel symbol resolver from the common backtrace printers when RT_USING_KSYMS is enabled. Keep the raw program counter in every line and fall back to the address-only format when no symbol is found. Retain the existing addr2line guidance when the option is disabled.
Route Cortex-A unwind frames through the common formatted printer when kernel symbols are enabled. Disable the legacy Cortex-A function-name path in that mode to avoid duplicate output while retaining the existing unwind behavior. Add static-function lookup and backtrace coverage for ARM32 and AArch64.
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: kernelReviewers: @GorrayLi @ReviewSun @hamburger-os @lianux-mm @wdfk-prog @xu18838022837 Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-08-29 02:52 CST)
📝 Review Instructions
|
|
拉取/合并请求描述:(PR description)
为什么提交这份PR (why to submit this PR)
当前 RT-Thread 通用 backtrace 主要输出原始 PC 地址,并提示用户使用
addr2line进行解析。在 exception、assert、panic 等现场,通常没有完整 ELF/DWARF 环境,定位函数名称不够方便。
本 PR 增加一个可选的内核函数符号表,使 backtrace 可以直接输出函数名、
函数内偏移和函数大小,例如: