Skip to content

Commit 2a36f06

Browse files
committed
fix documentation and remove unnecessary comments
Signed-off-by: Doru Blânzeanu <[email protected]>
1 parent 16492de commit 2a36f06

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

docs/how-to-debug-a-hyperlight-guest.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# How to debug a Hyperlight guest
22

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.
3+
Hyperlight supports gdb debugging of a guest running inside a Hyperlight sandbox.
4+
When Hyperlight is compiled with the `gdb` feature enabled, Hyperlight starts listening on port `8081` for a gdb connection.
55

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

@@ -14,7 +14,7 @@ The execution will wait for gdb to attach.
1414
One can use a simple gdb config to provide the symbols and desired configuration:
1515

1616
For the above example, when running from the repository root directory, the below contents
17-
of `.gdbinit` file can be used.
17+
of `.gdbinit` file can be used to provide configuration to gdb startup.
1818
```gdb
1919
file src/tests/rust_guests/bin/debug/simpleguest
2020
target remote :8081
@@ -23,4 +23,6 @@ set disassemble-next-line on
2323
enable pretty-printer
2424
layout regs
2525
layout src
26-
```
26+
```
27+
28+
One can find more information about the `.gdbinit` file at [gdbinit(5)](https://www.man7.org/linux/man-pages/man5/gdbinit.5.html).

src/hyperlight_host/src/hypervisor/gdb/kvm_target.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ impl HyperlightKvmSandboxTarget {
176176

177177
/// Translates the guest address to physical address
178178
fn translate_gva(&self, gva: u64) -> Result<u64, GdbTargetError> {
179-
// TODO: Properly handle errors
180179
let tr = self
181180
.vcpu_fd
182181
.lock()

src/hyperlight_host/src/hypervisor/gdb/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ impl From<io::Error> for GdbTargetError {
4343
}
4444

4545
impl From<DebugMessage> for GdbTargetError {
46-
fn from(value: DebugMessage) -> Self {
47-
match value {
48-
DebugMessage::VcpuStoppedEv => GdbTargetError::UnexpectedMessageError,
49-
_ => GdbTargetError::UnexpectedMessageError,
50-
}
46+
fn from(_value: DebugMessage) -> Self {
47+
GdbTargetError::UnexpectedMessageError
5148
}
5249
}
5350

@@ -140,7 +137,6 @@ where
140137
<T as Target>::Error:
141138
std::fmt::Debug + Send + From<io::Error> + From<DebugMessage> + From<TryRecvError>,
142139
{
143-
// TODO: Address multiple sandboxes scenario
144140
let socket = format!("localhost:{}", 8081);
145141

146142
log::info!("Listening on {:?}", socket);

0 commit comments

Comments
 (0)