Skip to content

Commit f1f3f7f

Browse files
committed
Add documentation on how to set up and use a Wasm target.
1 parent ccc213b commit f1f3f7f

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

gdbstub_arch/src/wasm/mod.rs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,41 @@
2323
//! extensions. See the [`self::addr`] submodule for utilities to encode and
2424
//! decode these synthesized addresses.
2525
//!
26-
//! [`Wasm`]: gdbstub::target::ext::wasm::Wasm
26+
//! To use GDB RSP with these extensions implemented by LLDB:
27+
//!
28+
//! 1. Implement the `Target` trait and the [`Wasm`], [`HostInfo`] and
29+
//! [`ProcessInfo`] traits on the target implementation for your Wasm
30+
//! execution engine/target.
31+
//! 2. Make use of this `Arch` implementation in your target.
32+
//! 3. Make use of the [`report_stop_with_regs`] API to report the Wasm PC with
33+
//! every stop packet.
34+
//! 4. Ensure that you have a build of LLDB with the Wasm target enabled. (A
35+
//! binary distribution of LLDB with your operating system may not have this,
36+
//! but a build from LLVM source will, by default. Once a release of
37+
//! [`wasi-sdk`] with [this PR] is made, `wasi-sdk` will distribute such a
38+
//! build for all major platforms.)
39+
//! 5. Start up LLDB and attach it to an endpoint served by `gdbstub` with this
40+
//! target:
41+
//!
42+
//! $ .../bin/lldb
43+
//! (lldb) process connect --plugin wasm connect://localhost:1234 #
44+
//! TCP port (for example)
45+
//!
46+
//! then ordinary debugging with breakpoints, step/continue, and state
47+
//! examination should work.
48+
//!
49+
//! See [Wasmtime] for an example of the use of this crate.
50+
//!
2751
//! [LLDB-specific Wasm extensions]:
2852
//! https://lldb.llvm.org/resources/lldbgdbremote.html#wasm-packets
53+
//! [`Wasm`]: gdbstub::target::ext::wasm::Wasm
54+
//! [`HostInfo`]: gdbstub::target::ext::host_info::HostInfo
55+
//! [`ProcessInfo`]: gdbstub::target::ext::process_info::ProcessInfo
56+
//! [`report_stop_with_regs`]:
57+
//! gdbstub::stub::state_machine::GdbStubStateMachineInner::report_stop_with_regs
58+
//! [`wasi-sdk`]: https://github.com/WebAssembly/wasi-sdk
59+
//! [this PR]: https://github.com/WebAssembly/wasi-sdk/pull/596
60+
//! [Wasmtime]: https://github.com/bytecodealliance/wasmtime
2961
3062
use gdbstub::arch::Arch;
3163

0 commit comments

Comments
 (0)