Add DWARF line table parser for source-level backtraces#329
Conversation
Parse DWARF .debug_line, .debug_info, .debug_abbrev, and .debug_ranges sections from WASM custom sections to resolve code addresses to source file/line/column locations. Used by Caller.captureBacktrace() to provide source-level information in stack traces. Key components: - DWARFLineTable: parses DWARF v4/v5 line number programs with CU-aware resolution using .debug_info address ranges - Code section offset conversion between file-level and DWARF addresses - binaryOffsetCorrection in Translator to fix buffer-relative offsets - Backtrace.Symbol.sourceLocation for resolved source locations - Precise line resolution via instruction mapping with function-start fallback - Translator fix from expose-debugging-api for folded instruction mapping - codeSectionStart exposed via ParsingPayload.codeSection - 13 unit tests for the DWARF parser Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
There's ongoing work on offline symbolication for Swift on other platforms. If we could agree on a format that WasmKit outputs, maybe the symbolicator could accept that and we wouldn't need DWARF parsing in WasmKit at all
There was a problem hiding this comment.
Could be optional of course, but handy during debugging. Still need something to decode the translated PC values to correct offsets that can be used offline. I don't believe the current PC values would work.
There was a problem hiding this comment.
I'd be happy to adjust values to whatever symbolicator is expecting. Probably also need to align WasmKit with output from other Wasm runtimes so that the symbolicator can expect consistent input.
|
Looking at the failing unit tests now. |
This was polluting iseqToWasm, and breaking a debugger test.
Parse DWARF .debug_line, .debug_info, .debug_abbrev, and .debug_ranges sections from WASM custom sections to resolve code addresses to source file/line/column locations. Used by Caller.captureBacktrace() to provide source-level information in stack traces.
Key components: