| c4a38d67 | 26-Jan-2026 |
Philip Craig <[email protected]> |
Use `gimli::write::Dwarf::convert_with_filter` for DWARF transform (#12428)
Replace parts of the transform code with `gimli`'s generic DWARF transformation support. Most of the remaining code is spe
Use `gimli::write::Dwarf::convert_with_filter` for DWARF transform (#12428)
Replace parts of the transform code with `gimli`'s generic DWARF transformation support. Most of the remaining code is specific to the needs of Wasmtime.
The overall behaviour is the same as the previous implementation. We build a graph of the DIE dependencies, and prune DIEs that don't have valid code ranges. Then we traverse the DIE tree again and transform the DIEs. However, there are some differences.
Previously, unresolved references to DIEs were stored in `PendingUnitRefs` and `PendingDebugInfoRefs`, then at the end of the transformation we went back and fixed up these references. The new behaviour reserves IDs for all of the DIEs in the dependency tree before transformation, which avoids the need to fix up references later. It also allows gimli to correctly handle references in DWARF expressions, although that doesn't currently matter for Wasmtime because it doesn't handle references in expressions yet. The visible effect of this in Wasmtime is that the order of transformed attributes will now always match the original DWARF.
The DIE tree pruning is slightly different. We no longer add back-edges pointing to namespace DIEs or the root DIE, which previously caused some DIEs to be reachable when they should not have been. In particular, this affects DW_TAG_variable DIEs for global variables. Wasmtime can't currently translate the location for globals, so they were added without a valid DW_AT_location. These DIEs are now omitted from the transformed DWARF. In the future when global variables can be translated correctly, they can be included by calling `ReserveUnitSection::require_entry`.
Performance measurements for `wasmtime compile -D debug-info=y` show minimal change.
show more ...
|