c-api: Enable debugger DWARF export for guest code #9915
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.
In order to allow source level debugging of hosted webassembly code in C-based embeddings, we must enable the debug-builtins cargo feature when building the C api. This allows for embeddings of wasmtime in non-rust environments to benefit from the integration with gdb/lldb's JIT debug interface.
Fixes #9909
Tests: I have tested this manually per the notes in the linked issue, and have single-stepped through the code to confirm it is behaving as I expect (I basically did a side-by side step through with an equivalent rust program linked with the default settings and
wasmtime
cargo dependency).For automated tests, I have a simple strategy: I can validate that the GDB structures are actually set up in the fib-debug/main.c. It's a little hacky so I've added as a second commit. The strategy is to validate the actual
__jit_debug_descriptor
that's created is non-NULL after instantiation. As these examples are used by other people, I have gated the code with a compile definition that's only set during the tests.I have confirmed this test fails without my patch and passes with it.