Skip to content

Several fixes to debugging infrastructure: component vs. module PCs and gdbstub wasm module names.#12901

Merged
alexcrichton merged 3 commits intobytecodealliance:mainfrom
cfallin:debugging-fixes
Mar 31, 2026
Merged

Several fixes to debugging infrastructure: component vs. module PCs and gdbstub wasm module names.#12901
alexcrichton merged 3 commits intobytecodealliance:mainfrom
cfallin:debugging-fixes

Conversation

@cfallin
Copy link
Copy Markdown
Member

@cfallin cfallin commented Mar 30, 2026

Contains several fixes pulled out from #12859:

  • Fix module-offset PC vs. component-offset PC discrepancy in metadata. All offsets used by debugging APIs are core module-relative (components "do not exist" when introspected by a debugger, only the flattened core modules).
  • Add newtypes to disambiguate the two (based on review feedback in Debugging: add debugger support for wasmtime serve. #12859).
  • Give distinct names to each Wasm module when presented over the wire to a gdbstub-speaking debugger so they are not mistakenly dedup'd together.

@cfallin cfallin requested review from a team as code owners March 30, 2026 23:41
@cfallin cfallin requested review from fitzgen and removed request for a team March 30, 2026 23:41
cfallin added 2 commits March 30, 2026 16:42
…ibrary names.

Two bugfixes for guest debugging with components:

1. Convert component-relative source locations to module-relative PCs
   in the frame table. The guest-debug API presents a core-Wasm view
   where components are deconstructed into individual modules, so all
   PCs must be module-relative. This adds a `wasm_module_offset` field
   to `ModuleTranslation` and `FuncEnvironment`, set during component
   translation, and subtracts it in `debug_tags()`.

2. Give unique names to "library" entries in the gdbstub XML response.
   LLDB's DynamicLoader deduplicates by name, so using "wasm" for all
   modules caused only the first to be loaded.
Introduce `ModulePC` (module-relative) and `ComponentPC`
(component-relative) newtype wrappers around u32 Wasm bytecode
offsets. These replace raw u32 values throughout the frame table,
breakpoint, and debug systems to prevent confusion between the two
offset spaces.
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Mar 31, 2026
@alexcrichton alexcrichton added this pull request to the merge queue Mar 31, 2026
Merged via the queue into bytecodealliance:main with commit 9500c41 Mar 31, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants