addr2line: detect clang version and dispatch to modern or legacy resolver#4973
Open
TianlongLiang wants to merge 1 commit into
Open
addr2line: detect clang version and dispatch to modern or legacy resolver#4973TianlongLiang wants to merge 1 commit into
TianlongLiang wants to merge 1 commit into
Conversation
…lver
Refactor the wasm symbolicator to make its toolchain workarounds
explicit. addr2line.py now detects the wasi-sdk's clang major version
at startup and routes per-frame address resolution to one of:
- resolve_address_modern (clang >= 22, wasi-sdk 33+):
single llvm-symbolizer call per address. The symbolizer handles
address-to-name correctly on this clang.
- resolve_address_legacy (clang < 22 or unknown):
llvm-symbolizer call + llvm-dwarfdump --lookup overlay to fix
the outermost function name. Older clang versions emit wasm DWARF
that confuses llvm-symbolizer's address-to-name resolver for some
addresses (e.g., reports 'recurse' as 'free'). --lookup goes
through a different DWARF traversal path that handles them.
The dispatch decision is logged once to stderr so users can see
which path was taken without polluting stdout. Stdout is byte-
identical between paths for non-buggy inputs.
Also includes accumulated improvements:
- --mode flag {interp,aot,fast-interp} for different runtime offset
conventions (interp post-advance, aot at-instruction-start,
fast-interp's transformed in-memory bytecode)
- Inline frame annotation "(inlined into <next>)" for clarity
- llvm-symbolizer preferred over llvm-addr2line for column info
- Fallback for offset=0 (trap at function entry; frame_ip not captured)
- Last-resort function-index name fallback when DWARF lacks PC ranges
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor the wasm symbolicator to make its toolchain workarounds explicit. addr2line.py now detects the wasi-sdk's clang major version at startup and routes per-frame address resolution to one of:
resolve_address_modern (clang >= 22, wasi-sdk 33+): single llvm-symbolizer call per address. The symbolizer handles address-to-name correctly on this clang.
resolve_address_legacy (clang < 22 or unknown): llvm-symbolizer call + llvm-dwarfdump --lookup overlay to fix the outermost function name. Older clang versions emit wasm DWARF that confuses llvm-symbolizer's address-to-name resolver for some addresses (e.g., reports 'recurse' as 'free'). --lookup goes through a different DWARF traversal path that handles them.
The dispatch decision is logged once to stderr so users can see which path was taken without polluting stdout. Stdout is byte- identical between paths for non-buggy inputs.
Also includes accumulated improvements: