-
Notifications
You must be signed in to change notification settings - Fork 2
Description
The current DWARF for WebAssembly spec requires that instruction addresses are offsets into the Code Section. However, (extended) constant expressions contain instructions that are executed at runtime (and can contain errors), but their instructions are not encoded in the Code Section.
If I understand correctly, DWARF allows us to optionally specify which memory each instruction is stored in (by index). Presumably, that feature could be repurposed to reference section IDs instead. Given that the zero section ID is used for custom sections (so it cannot unambiguously identify an individual section), zero (in this context) could be mapped to the Code Section, so that section remains the default.
To be honest, I'm just beginning to learn about DWARF, so don't understand it very well yet. In any case, it should be possible to debug the text format with the debugging format.
WABT would ideally implement DWARF support in wat2wasm, and source languages operating at the same level of abstraction really need to support DWARF (if DWARF is all that browsers understand). I'm personally working on a source language that's basically WAT with whitespace and sugar, and there have been other alt-wat source languages in the past. None (except WAT) have achieved any real adoption, but it should at least be possible to debug these languages.