Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix meaning of generated .debug_loc sections #8753

Merged

Conversation

alexcrichton
Copy link
Member

This commit is a fix to Wasmtime's DWARF processing transform to correct the meaning of the .debug_loc section. This section's addresses are relative to the DW_AT_low_pc entry located in the DW_TAG_compile_unit container, but Wasmtime's construction of this section didn't take this into account. Instead all addresses in .debug_loc are relative to the start of the compiled object, not to the start of the compile unit itself. This commit fixes this by unconditionally describing DW_TAG_compile_unit locations with DW_AT_ranges instead of DW_AT_low_pc. This ends up fixing debug information for debug information using .debug_loc with multiple codegen units.

Closes #8752

This commit is a fix to Wasmtime's DWARF processing transform to correct
the meaning of the `.debug_loc` section. This section's addresses are
relative to the `DW_AT_low_pc` entry located in the
`DW_TAG_compile_unit` container, but Wasmtime's construction of this
section didn't take this into account. Instead all addresses in
`.debug_loc` are relative to the start of the compiled object, not to
the start of the compile unit itself. This commit fixes this by
unconditionally describing `DW_TAG_compile_unit` locations with
`DW_AT_ranges` instead of `DW_AT_low_pc`. This ends up fixing debug
information for debug information using `.debug_loc` with multiple
codegen units.

Closes bytecodealliance#8752
@alexcrichton alexcrichton requested a review from a team as a code owner June 7, 2024 00:38
@alexcrichton alexcrichton requested review from elliottt and removed request for a team June 7, 2024 00:38
@alexcrichton alexcrichton added this pull request to the merge queue Jun 10, 2024
Merged via the queue into bytecodealliance:main with commit 33cc495 Jun 10, 2024
36 checks passed
@alexcrichton alexcrichton deleted the fix-dwarf-debug-loc branch June 10, 2024 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source-level DWARF debugging with control flow broke long ago in #5843
2 participants