Skip to content

Commit cec6a81

Browse files
committed
add information on how to setup debugging
Signed-off-by: Doru Blânzeanu <[email protected]>
1 parent 8f4a63f commit cec6a81

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ This project is composed internally of several internal components, depicted in
3434

3535
* [Security guidance for developers](./security-guidance-for-developers.md)
3636
* [Paging Development Notes](./paging-development-notes.md)
37+
* [How to debug a Hyperlight guest](./how-to-debug-a-hyperlight-guest.md)
3738
* [How to use Flatbuffers in Hyperlight](./how-to-use-flatbuffers.md)
3839
* [How to make a Hyperlight release](./how-to-make-releases.md)
3940
* [Getting Hyperlight Metrics, Logs, and Traces](./hyperlight-metrics-logs-and-traces.md)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# How to debug a Hyperlight guest
2+
3+
Currently Hyperlight support gdb debugging of a guest running inside a Hyperlight sandbox.
4+
When the option is enabled Hyperlight starts listening on port `8081` for a gdb connection.
5+
6+
Note: It will only accept one connection, if the connection is closed, the debug session is also closed.
7+
8+
## Example
9+
```bash
10+
cargo run --example hello-world --features gdb
11+
```
12+
The execution will wait for gdb to attach.
13+
14+
One can use a simple gdb config to provide the symbols and desired configuration:
15+
16+
For the above example, when running from the repository root directory, the below contents
17+
of `.gdbinit` file can be used.
18+
```gdb
19+
file src/tests/rust_guests/bin/debug/simpleguest
20+
target remote :8081
21+
set disassembly-flavor intel
22+
set disassemble-next-line on
23+
enable pretty-printer
24+
layout regs
25+
layout src
26+
```

0 commit comments

Comments
 (0)