Debugging: add debugger support for `wasmtime serve`. by cfallin · Pull Request #12859 · bytecodealliance/wasmtime

fitzgen

…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.

@cfallin

This adopts a simple solution to bytecodealliance#12776: it takes the "instance reuse"
paradigm to the extreme, instantiating exactly one instance and
serializing all requests into that one instance. This allows the
debugger component to operate on one `Store`, setting breakpoint state
and presenting its execution to the attached debugger as a single
program execution and minimizing impedance mismatches.

This also adds an integration test that runs an existing wasi-http
test component under the debugger.