File tree Expand file tree Collapse file tree 3 files changed +8
-11
lines changed
src/hyperlight_host/src/hypervisor/gdb Expand file tree Collapse file tree 3 files changed +8
-11
lines changed Original file line number Diff line number Diff line change 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
66Note: 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.
1414One can use a simple gdb config to provide the symbols and desired configuration:
1515
1616For 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
1919file src/tests/rust_guests/bin/debug/simpleguest
2020target remote :8081
@@ -23,4 +23,6 @@ set disassemble-next-line on
2323enable pretty-printer
2424layout regs
2525layout 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 ) .
Original file line number Diff line number Diff 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 ( )
Original file line number Diff line number Diff line change @@ -43,11 +43,8 @@ impl From<io::Error> for GdbTargetError {
4343}
4444
4545impl 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) ;
You can’t perform that action at this time.
0 commit comments