Skip to content

Commit

Permalink
add information on how to setup debugging
Browse files Browse the repository at this point in the history
Signed-off-by: Doru Blânzeanu <[email protected]>
  • Loading branch information
dblnz committed Dec 17, 2024
1 parent 8f4a63f commit cec6a81
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ This project is composed internally of several internal components, depicted in

* [Security guidance for developers](./security-guidance-for-developers.md)
* [Paging Development Notes](./paging-development-notes.md)
* [How to debug a Hyperlight guest](./how-to-debug-a-hyperlight-guest.md)
* [How to use Flatbuffers in Hyperlight](./how-to-use-flatbuffers.md)
* [How to make a Hyperlight release](./how-to-make-releases.md)
* [Getting Hyperlight Metrics, Logs, and Traces](./hyperlight-metrics-logs-and-traces.md)
Expand Down
26 changes: 26 additions & 0 deletions docs/how-to-debug-a-hyperlight-guest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# How to debug a Hyperlight guest

Currently Hyperlight support gdb debugging of a guest running inside a Hyperlight sandbox.
When the option is enabled Hyperlight starts listening on port `8081` for a gdb connection.

Note: It will only accept one connection, if the connection is closed, the debug session is also closed.

## Example
```bash
cargo run --example hello-world --features gdb
```
The execution will wait for gdb to attach.

One can use a simple gdb config to provide the symbols and desired configuration:

For the above example, when running from the repository root directory, the below contents
of `.gdbinit` file can be used.
```gdb
file src/tests/rust_guests/bin/debug/simpleguest
target remote :8081
set disassembly-flavor intel
set disassemble-next-line on
enable pretty-printer
layout regs
layout src
```

0 comments on commit cec6a81

Please sign in to comment.