Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Breakpoint state can survive crash or cancellation recovery, and the hidden cache-sync mapping conflicts with the public mapping contract.
4 open findings
What changed in this PR
Adds Windows ARM64 WHP guest debugging and generalizes the GDB implementation across architectures.
Changes:
- Adds ARM64 registers, software breakpoints, stepping, and cache synchronization.
- Extracts shared debugger logic from x86_64 code.
- Updates tests, documentation, and platform configuration.
| File | Description |
|---|---|
CHANGELOG.md |
Records ARM64 GDB support. |
docs/how-to-debug-a-hyperlight-guest.md |
Documents architecture-specific capabilities. |
src/hyperlight_host/build.rs |
Enables GDB on Windows ARM64. |
src/hyperlight_host/examples/guest-debugging/main.rs |
Adds ARM64 debugging tests. |
src/hyperlight_host/src/hypervisor/gdb/arch.rs |
Dispatches architecture-specific logic. |
src/hyperlight_host/src/hypervisor/gdb/arch/aarch64.rs |
Implements ARM64 breakpoint and step decoding. |
src/hyperlight_host/src/hypervisor/gdb/arch/x86_64.rs |
Houses extracted x86_64 logic. |
src/hyperlight_host/src/hypervisor/gdb/event_loop.rs |
Maps ARM64 stop reasons. |
src/hyperlight_host/src/hypervisor/gdb/mod.rs |
Extends shared debugging interfaces. |
src/hyperlight_host/src/hypervisor/gdb/target.rs |
Adds architecture-specific GDB registers. |
src/hyperlight_host/src/hypervisor/hyperlight_vm/aarch64.rs |
Connects GDB to ARM64 VMs. |
src/hyperlight_host/src/hypervisor/hyperlight_vm/debug.rs |
Centralizes breakpoint and stepping state. |
src/hyperlight_host/src/hypervisor/hyperlight_vm/mod.rs |
Handles ARM64 debug exits. |
src/hyperlight_host/src/hypervisor/hyperlight_vm/x86_64.rs |
Removes extracted debugger logic. |
src/hyperlight_host/src/hypervisor/virtual_machine/mod.rs |
Extends VM exits and errors. |
src/hyperlight_host/src/hypervisor/virtual_machine/whp/aarch64.rs |
Implements WHP debugging and cache synchronization. |
src/hyperlight_host/src/sandbox/initialized.rs |
Guards snapshots with active breakpoints. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
8c0c245 to
39ea4cb
Compare
This comment has been minimized.
This comment has been minimized.
|
@cshung I guess you are using software breakpoints here because WHPX aarch64 does not yet support setting MDCR_EL2.TDE. I think this is very divergent from the other implementations and especially the emulation of software step looks very fragile in its current state. I wonder if we can make things a little bit more congruent with the other implementations by using the same hardware debug approach as other targets, but on WHP set MDSCR_EL1.KDE and have little assembly stubs catch this case and make hvcs (or, even make an hvc on every exception entry, when in gdb mode)? Admittedly this will not work very well if VBAR_EL1 or virtual memory configuration for the exception handlers are messed up, but in that case I think given the current guest architecture it is extremely unlikely that guest code would continue to execute and produce any useful results. |
7238539 to
6c35092
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Adds GDB stub support for guests running on the ARM64 WHP backend. * Split the x86_64 debug code out of `hyperlight_vm/x86_64.rs` into a shared `hyperlight_vm/debug.rs`. * Rename `gdb/x86_64_target.rs` to `gdb/target.rs` and add per-architecture register handling in `gdb/arch/`. * Give `DebuggableVm` default methods so backends without hardware breakpoints or single step report `Unsupported`. * Implement `DebuggableVm` for the aarch64 WHP VM, using the batched register helpers. * Flush the host instruction cache after guest memory writes so software breakpoints take effect. * Document ARM64 debugging in `docs/how-to-debug-a-hyperlight-guest.md` and `CHANGELOG.md`. On Windows ARM64 (WHP): * `just build`, `just clippy`, `just guests`, `just test` and `just fmt-check` pass. --------- Signed-off-by: cshung <3410332+cshung@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
## Changes * Run the full disable path when the debugger detaches after a crash, so software breakpoints and pending steps are cleaned up. * Cancel pending software steps for any cancellation source, not only debugger interrupts. * Reject `map_region` requests that overlap the hidden cache sync page at GPA 0x1000, and add a test. * Restore the `≡` and `×` characters in `hyperlight_vm/x86_64.rs` comments. ## Verification On Windows ARM64 (WHP): * `just clippy`, `just fmt-check` and the `hypervisor::` and `map_region` lib tests with the `gdb` feature pass. --------- Signed-off-by: cshung <3410332+cshung@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Guest synchronous exception vectors forward debug stops through HVC. Hardware single-step supports branches, returns, and self-loops. Two hardware breakpoint slots and BRK software breakpoints are available. Interrupted register context and breakpoint configuration survive cache synchronization and vCPU reset. Asynchronous vectors retain their normal exception paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: cshung <3410332+cshung@users.noreply.github.com>
dd86b49 to
698b851
Compare
Benchmark ResultsMeasured commit: kvm / amd (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
kvm / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / amd (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / amd (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / intel (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
Reported by |



Summary
Adds GDB stub support for guests running on the ARM64 WHP backend.
Changes
Debug core
hyperlight_vm/x86_64.rsinto a sharedhyperlight_vm/debug.rs.gdb/x86_64_target.rstogdb/target.rsand add per-architecture register handling ingdb/arch/.DebuggableVmdefault methods so backends without hardware breakpoints or single step reportUnsupported.ARM64 WHP
DebuggableVmfor the aarch64 WHP VM, using the batched register helpers.Docs
docs/how-to-debug-a-hyperlight-guest.mdandCHANGELOG.md.Verification
On Windows ARM64 (WHP):
just build,just clippy,just guests,just testandjust fmt-checkpass.