Commit dbaaa92
authored
Debugging: add builtin gdbstub component. (#12771)
* Debugging: add builtin gdbstub component.
This adds a debug component that makes use of the debug-main world
defined in #12756 and serves the gdbstub protocol, with Wasm
extensions, compatible with LLDB.
This component is built and included inside the Wasmtime binary, and
is loaded using the lower-level `-D debugger=...` debug-main option;
the user doesn't need to specify the `.wasm` adapter
component. Instead, the user simply runs `wasmtime run -g <PORT>
program.wasm ...` and Wasmtime will load and prepare to run
`program.wasm` as the debuggee, waiting for a gdbstub connection on
the given TCP port before continuing.
The workflow is:
```
$ wasmtime run -g 1234 program.wasm
[ wasmtime starts and waits for connection ]
$ /opt/wasi-sdk/bin/lldb # use LLDB from wasi-sdk release 32 or later
(lldb) process connect --plugin wasm connect://localhost:1234
Process 1 stopped
* thread #1, stop reason = signal SIGTRAP
frame #0: 0x40000000000001cc
-> 0x40000000000001cc: unreachable
0x40000000000001cd: end
0x40000000000001ce: local.get 0
0x40000000000001d0: call 13
(lldb) si
Process 1 stopped
* thread #1, stop reason = instruction step into
frame #0: 0x4000000000000184
-> 0x4000000000000184: block
0x4000000000000186: block
0x4000000000000188: global.get 1
0x400000000000018e: i32.const 3664
[ ... ]
```
This makes use of the `gdbstub` third-party crate, into which I've
upstreamed support for the Wasm extensions in daniel5151/gdbstub#188,
daniel5151/gdbstub#189, daniel5151/gdbstub#190, and
daniel5151/gdbstub#192. (I'll add vets as part of this PR.)
* cargo vets.
* Handle Trap events as well as breakpoints.
* Review feedback.
* Fix gdbstub artifact build to make it publishable (by disabling it when isolated crates are used).
* Review feedback.
* fix published-crates list
* For now, empty gdbstub data but no compile error when artifact crate is published.
* add some more Cargo metadata: version for artifact crate dep1 parent 0ed1171 commit dbaaa92
19 files changed
Lines changed: 1503 additions & 46 deletions
File tree
- .github/workflows
- ci
- crates/gdbstub-component
- artifact
- src
- src
- scripts
- src
- commands
- supply-chain
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| 390 | + | |
390 | 391 | | |
391 | 392 | | |
392 | 393 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| 170 | + | |
| 171 | + | |
169 | 172 | | |
170 | 173 | | |
171 | 174 | | |
| |||
276 | 279 | | |
277 | 280 | | |
278 | 281 | | |
| 282 | + | |
279 | 283 | | |
280 | 284 | | |
281 | 285 | | |
| |||
354 | 358 | | |
355 | 359 | | |
356 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
357 | 364 | | |
358 | 365 | | |
359 | 366 | | |
| |||
437 | 444 | | |
438 | 445 | | |
439 | 446 | | |
| 447 | + | |
| 448 | + | |
440 | 449 | | |
441 | 450 | | |
442 | 451 | | |
| |||
523 | 532 | | |
524 | 533 | | |
525 | 534 | | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
526 | 540 | | |
527 | 541 | | |
528 | 542 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments