Enable guest debugging for HyperV on windows #478
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This closes #241
This brings the same debugging behavior to windows guests as kvm and mshv guests have on linux.
Some of the duplicated debug logic that is implemented on each hypervisor driver will be refactored later in a single implementation.
Copilot Generated Description
This pull request introduces significant updates to the Hyperlight debugging functionality, expanding support to Windows environments, refactoring the codebase to improve modularity, and enhancing the debugging capabilities. The most important changes include adding Windows-specific signal handling, introducing the
HypervDebug
struct for Hyper-V guest debugging, and removing Linux-specific dependencies from cross-platform code.Cross-platform debugging enhancements:
src/hyperlight_host/src/hypervisor/gdb/event_loop.rs
: Added conditional compilation for signal handling to differentiate between Linux (libc::SIGINT
,libc::SIGSEGV
) and Windows (SIGINT
,SIGSEGV
). Updated signal handling logic to use platform-specific signals. [1] [2]src/hyperlight_host/build.rs
: Removed Linux-specific constraints from thegdb
feature configuration, allowing debugging on Windows.Windows debugging support:
src/hyperlight_host/src/hypervisor/gdb/hyperv_debug.rs
: Added theHypervDebug
struct to implement debugging functionalities for Hyper-V guests, including hardware and software breakpoints, register manipulation, and vCPU stop reason handling.src/hyperlight_host/src/hypervisor/gdb/mod.rs
: IntegratedHypervDebug
into the debugging module and updated theGuestDebug
trait visibility topub(super)
for better encapsulation. [1] [2] [3]Refactoring for improved modularity:
src/hyperlight_host/src/hypervisor/gdb/x86_64_target.rs
: Replaced the thread ID with anInterruptHandle
for vCPU thread management. Added methods for setting the interrupt handle and interrupting vCPU execution. Updated tests to reflect these changes. [1] [2] [3] [4]src/hyperlight_host/src/hypervisor/gdb/mod.rs
: Refactoredcreate_gdb_thread
to handle the newInterruptHandle
mechanism and updated the communication protocol for initializing the debugger. [1] [2]Documentation updates:
docs/how-to-debug-a-hyperlight-guest.md
: Updated documentation to reflect support for debugging on Windows and clarified the removal ofKVM
andMSHV
guest-specific mentions. [1] [2]These changes collectively enhance the flexibility of Hyperlight's debugging capabilities, making it more robust and suitable for cross-platform use.