Implement DWARF support in text-to-binary #1632
Merged
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.
This commit implements support to emit DWARF debugging information when the WebAssembly text format is converted to binary. Currently there is otherwise no means of translating a binary offset in a WebAssembly file back to the text format that it came from. This support is implemented with a few API knobs here and there as well as two new CLI flags for all the commands that support the text format as input:
-g
and--generate-dwarf lines|full
.The original motivation of this commit is that I was curious to learn more about DWARF and it seemed like a neat little feature that wouldn't be too hard to maintain. The inspiration was bytecodealliance/wasmtime#8658 which this does not implement as-is (e.g. not custom DWARF, just wasm-text-DWARF). Otherwise though I've realized that this can be useful for development in a few situations:
addr2line
to print a filename/line number of a WebAssembly text file.This commit implements knobs for "full" or "line" support in DWARF. The "line" support should be as complete as it can be (DWARF can only provide information for the code section). The "full" support is somewhat basic still but my hope is that it can be expanded in the future as needed.