Skip to content

Change how wasm DWARF is inserted into artifacts#5358

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:fix-component-dwarf
Dec 6, 2022
Merged

Change how wasm DWARF is inserted into artifacts#5358
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:fix-component-dwarf

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit fixes a bug with components by changing how DWARF information from a wasm binary is copied over to the final compiled artifact. Note that this is not the Wasmtime-generated DWARF but rather the native wasm DWARF itself used in backtraces.

Previously the wasm dwarf was inserted into sections .*.wasm where * was debug_info, debug_str, etc -- one per gimli::SectionId as found in the original wasm module. This does not work with components, however, where modules did not correctly separate their debug information into separate sections or otherwise disambiguate. The fix in this commit is to instead smash all the debug information together into one large section and store offsets into that giant section. This is similar to the name-section scraping or the trap metadata section where one section contains all the data for all the modules in a component.

This simplifies the object file parsing by only looking for one section name and doesn't add all that much complexity to serializing and looking up dwarf information as well.

This commit fixes a bug with components by changing how DWARF
information from a wasm binary is copied over to the final compiled
artifact. Note that this is not the Wasmtime-generated DWARF but rather
the native wasm DWARF itself used in backtraces.

Previously the wasm dwarf was inserted into sections `.*.wasm` where `*`
was `debug_info`, `debug_str`, etc -- one per `gimli::SectionId` as
found in the original wasm module. This does not work with components,
however, where modules did not correctly separate their debug
information into separate sections or otherwise disambiguate. The fix in
this commit is to instead smash all the debug information together into
one large section and store offsets into that giant section. This is
similar to the `name`-section scraping or the trap metadata section
where one section contains all the data for all the modules in a component.

This simplifies the object file parsing by only looking for one section
name and doesn't add all that much complexity to serializing and looking
up dwarf information as well.
@alexcrichton alexcrichton requested a review from pchickey December 1, 2022 19:39
Copy link
Copy Markdown
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement

@alexcrichton alexcrichton merged commit 08d44e3 into bytecodealliance:main Dec 6, 2022
@alexcrichton alexcrichton deleted the fix-component-dwarf branch December 6, 2022 20:29
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.

2 participants