Skip to content

feat(gdb): share ARM64 debugger support across backends - #2050

Open
cshung wants to merge 1 commit into
hyperlight-dev:mainfrom
cshung:cshung/gdb-shared
Open

cshung wants to merge 1 commit into
hyperlight-dev:mainfrom
cshung:cshung/gdb-shared

Conversation

@cshung

@cshung cshung commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Shared GDB support

Architecture adapters and common debugger handling support ARM64 register
packets, software breakpoints, page-sized memory access, guest debug vectors,
and snapshot, cancellation and crash-detach recovery.

The existing x86_64 platform guard remains. Backend PRs enable ARM64 GDB.

Related PRs

Backend integration is in #1907 for WHP, #2016 for KVM, and #2052 for MSHV.
The MSHV backend is part of main through #1626.

Validation

November 23, base f297a914:

  • Windows x64 formatting, fresh debug/release Rust and C guests, build, Clippy, the full just test recipe, and focused debugger tests pass.
  • ARM64 cross-Clippy passes with default, KVM-only, and MSHV-only GDB features.
  • WHP integration passes Windows ARM64 cross-Clippy and Linux just clippyw.

November 19 native ARM64 MSHV validation through #2052 passed 481 library
tests (13 ignored), five concurrency tests, and seven real GDB client tests.
Native ARM64 runtime tests have not been repeated on this base.

@cshung cshung added the C-enhancement For PRs adding features, improving functionality, docs, tests, etc. label Nov 11, 2026
Copilot AI balanced review requested due to automatic review settings November 11, 2026 20:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Resume translation errors can terminate the debugger session, and partially successful code writes can return without synchronizing the guest instruction cache.

2 open issues
What changed in this PR

This PR provides shared ARM64 debugger infrastructure for Hyperlight’s WHP, KVM and MSHV backends. ARM64 platform enablement remains in separate backend PRs.

Changes:

  • Adds architecture-specific register handling, breakpoint support and shared debugger request processing.
  • Adds guest-page-sized memory access, cache synchronization hooks and snapshot recovery safeguards.
  • Adds debugger tests, guest exception forwarding and backend-layer documentation.
File Description
src/​hyperlight_host/​src/​sandbox/​uninitialized_evolve.rs Initializes ARM64 guest debug vectors.
src/​hyperlight_host/​src/​sandbox/​snapshot/​memory/​backing.rs Exposes backing ranges for cache synchronization.
src/​hyperlight_host/​src/​sandbox/​initialized.rs Adds breakpoint guards, recovery handling and tests.
src/​hyperlight_host/​src/​mem/​mgr.rs Exposes guest backing host ranges to debugging code.
src/​hyperlight_host/​src/​mem/​exe.rs Carries debug-vector addresses in load metadata.
src/​hyperlight_host/​src/​mem/​elf.rs Finds and relocates guest debug-vector symbols.
src/​hyperlight_host/​src/​hypervisor/​virtual_machine/​whp/​x86_64.rs Adopts the shared address-translation interface.
src/​hyperlight_host/​src/​hypervisor/​virtual_machine/​mshv/​x86_64.rs Adopts the shared address-translation interface.
src/​hyperlight_host/​src/​hypervisor/​virtual_machine/​mod.rs Adds ARM64 debug exit and initialization types.
src/​hyperlight_host/​src/​hypervisor/​virtual_machine/​kvm/​x86_64.rs Adopts the shared address-translation interface.
src/​hyperlight_host/​src/​hypervisor/​hyperlight_vm/​x86_64.rs Uses shared debugger handling and breakpoint storage.
src/​hyperlight_host/​src/​hypervisor/​hyperlight_vm/​mod.rs Integrates shared debug state and stop handling.
src/​hyperlight_host/​src/​hypervisor/​hyperlight_vm/​debug.rs Implements shared requests, breakpoints and ARM64 stepping.
src/​hyperlight_host/​src/​hypervisor/​hyperlight_vm/​aarch64.rs Adds debugger initialization and reset hooks.
src/​hyperlight_host/​src/​hypervisor/​gdb/​target.rs Supports ARM64 register packets and conversion tests.
src/​hyperlight_host/​src/​hypervisor/​gdb/​mod.rs Adds page-table translation and cache synchronization hooks.
src/​hyperlight_host/​src/​hypervisor/​gdb/​event_loop.rs Handles ARM64 initial-stop notifications.
src/​hyperlight_host/​src/​hypervisor/​gdb/​arch/​x86_64.rs Contains x86_64 breakpoint and stop classification logic.
src/​hyperlight_host/​src/​hypervisor/​gdb/​arch/​aarch64.rs Defines ARM64 BRK encoding and alignment checks.
src/​hyperlight_host/​src/​hypervisor/​gdb/​arch.rs Selects the architecture-specific debugger adapter.
src/​hyperlight_host/​examples/​guest-debugging/​main.rs Adds ARM64 GDB client scenarios.
src/​hyperlight_guest_bin/​src/​arch/​aarch64/​exception/​entry.rs Exports debug vectors and forwards synchronous exceptions.
src/​hyperlight_common/​src/​arch/​aarch64/​exn.rs Defines the debug exception HVC immediate.
Justfile Includes shared debugger and recovery test filters.
docs/​gdb-commit-layers.md Documents backend dependencies and validation requirements.
CHANGELOG.md Records debugger memory-access and recovery fixes.

Review effort: Balanced

@cshung cshung added the S-needs-review PR is ready for (re-)review label Nov 11, 2026
@cshung
cshung force-pushed the cshung/gdb-shared branch 2 times, most recently from a1e7706 to 1790d3c Compare November 12, 2026 00:12
@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@yoshuawuyts yoshuawuyts added the O-aarch64 Specific to 64-bit Arm processors label Nov 16, 2026
@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

Architecture adapters, software breakpoints, page-sized memory access and recovery handling are shared by backend layers. Guest debug vectors and common tests support ARM64. Backend layers control platform enablement.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: cshung <3410332+cshung@users.noreply.github.com>
@hyperlight-gh-bot

Copy link
Copy Markdown

Benchmark Results

Measured commit: 39376e20d710
Baseline commit: 81848a915b4e

kvm / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 268.62 ns (➖ 1.01x slower)
vec_bytes 81.71 ns (➖ 1.02x slower)
372.72 µs (➖ 1.01x faster)

payload_allocation

slot_pool_segmented
65536 141.94 ns (➖ 1.53x faster)
262144 520.94 ns (➖ 1.00x faster)

sandboxes

create_initialized_and_drop
medium 13.24 ms (➖ 1.01x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
7.75 ns (➖ 1.01x slower) 7.69 ns (➖ 1.17x faster) 7.68 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 124.30 µs (➖ 1.07x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 1.92 µs (➖ 1.08x faster) 2.03 µs (➖ 1.05x slower)
262144 7.08 µs (➖ 1.02x faster) 8.15 µs (➖ 1.15x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 6.56 µs (➖ 1.06x faster) 6.27 µs (➖ 1.02x faster)
262144 28.38 µs (➖ 1.03x slower)
8192 1.01 µs (➖ 1.01x slower) 1.03 µs (➖ 1.04x slower)
kvm / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 245.93 ns (➖ 1.01x slower)
vec_bytes 79.00 ns (➖ 1.02x slower)
682.57 µs (➖ 1.00x faster)

payload_allocation

slot_pool_segmented
65536 169.54 ns (➖ 1.01x faster)
262144 494.22 ns (➖ 1.07x faster)

sandboxes

create_initialized_and_drop
medium 15.29 ms (➖ 1.06x slower)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
6.77 ns (➖ 1.00x slower) 6.78 ns (➖ 1.00x slower) 6.76 ns (➖ 1.00x slower)

snapshot_files

load_snapshot_unverified
small 57.13 µs (➖ 1.02x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.12 µs (➖ 1.00x faster) 2.11 µs (➖ 1.01x faster)
262144 7.53 µs (➖ 1.00x slower) 7.51 µs (➖ 1.00x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 6.96 µs (➖ 1.01x faster) 7.02 µs (➖ 1.01x faster)
262144 30.23 µs (➖ 1.03x faster)
8192 703.44 ns (➖ 1.00x faster) 730.10 ns (➖ 1.02x slower)
mshv3 / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 372.09 ns (➖ 1.01x slower)
vec_bytes 105.87 ns (➖ 1.02x faster)
346.50 µs (➖ 1.04x slower)

payload_allocation

slot_pool_segmented
65536 195.38 ns (➖ 1.00x slower)
262144 731.44 ns (➖ 1.05x faster)

sandboxes

create_initialized_and_drop
medium 66.88 ms (➖ 1.28x slower)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
9.53 ns (➖ 1.02x faster) 9.63 ns (➖ 1.01x faster) 9.51 ns (➖ 1.04x faster)

snapshot_files

load_snapshot_unverified
small 105.57 µs (➖ 1.01x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.24 µs (➖ 1.01x slower) 2.38 µs (➖ 1.03x faster)
262144 10.05 µs (➖ 1.04x slower) 11.25 µs (➖ 1.09x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 8.42 µs (➖ 1.15x faster) 9.90 µs (➖ 1.03x slower)
262144 36.42 µs (➖ 1.03x faster)
8192 1.27 µs (➖ 1.06x slower) 1.24 µs (➖ 1.08x faster)
mshv3 / intel (Linux) (❌ 1.59x)

Top regressions

  • sandboxes/create_initialized_and_drop/medium — ❌ 1.59x slower

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 367.95 ns (➖ 1.00x faster)
vec_bytes 91.51 ns (➖ 1.01x slower)
736.74 µs (➖ 1.05x faster)

payload_allocation

slot_pool_segmented
65536 252.18 ns (➖ 1.03x faster)
262144 705.96 ns (➖ 1.01x slower)

sandboxes

create_initialized_and_drop
medium 83.52 ms (❌ 1.59x slower)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
8.69 ns (➖ 1.00x faster) 8.78 ns (➖ 1.14x faster) 8.70 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 56.24 µs (➖ 1.01x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.29 µs (➖ 1.00x faster) 2.27 µs (➖ 1.02x faster)
262144 8.06 µs (➖ 1.02x slower) 7.93 µs (➖ 1.02x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 7.50 µs (➖ 1.01x faster) 7.45 µs (➖ 1.01x faster)
262144 39.87 µs (➖ 1.01x slower)
8192 907.04 ns (➖ 1.03x faster) 900.07 ns (➖ 1.01x faster)
hyperv-ws2025 / amd (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 542.07 ns (➖ 1.06x faster)
vec_bytes 159.69 ns (➖ 1.05x faster)
1.98 ms (➖ 1.05x slower)

payload_allocation

slot_pool_segmented
65536 242.38 ns (➖ 1.03x slower)
262144 784.46 ns (➖ 1.01x faster)

sandboxes

create_initialized_and_drop
medium 12.21 ms (➖ 1.09x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
10.01 ns (➖ 1.00x slower) 9.94 ns (➖ 1.00x slower) 10.02 ns (➖ 1.00x slower)

snapshot_files

load_snapshot_unverified
small 816.04 µs (➖ 1.01x slower)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.33 µs (➖ 1.01x faster) 2.31 µs (➖ 1.02x faster)
262144 9.34 µs (➖ 1.03x slower) 9.13 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 8.88 µs (➖ 1.02x faster) 8.92 µs (➖ 1.01x faster)
262144 38.59 µs (➖ 1.23x faster)
8192 1.27 µs (➖ 1.01x slower) 1.26 µs (➖ 1.01x slower)
hyperv-ws2025 / intel (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 608.08 ns (➖ 1.03x slower)
vec_bytes 169.66 ns (➖ 1.03x slower)
3.23 ms (➖ 1.00x faster)

payload_allocation

slot_pool_segmented
65536 209.28 ns (➖ 1.00x slower)
262144 739.02 ns (➖ 1.01x faster)

sandboxes

create_initialized_and_drop
medium 14.51 ms (➖ 1.00x faster)

slot_pool

alloc_dealloc_4096 alloc_dealloc_1500 alloc_dealloc_128
10.08 ns (➖ 1.00x slower) 9.64 ns (➖ 1.00x faster) 9.75 ns (➖ 1.00x slower)

snapshot_files

load_snapshot_unverified
small 700.42 µs (➖ 1.01x faster)

virtq_readonly

slot_pool_segmented slot_pool_segmented_fragmented
65536 2.28 µs (➖ 1.00x slower) 2.28 µs (➖ 1.00x faster)
262144 7.71 µs (➖ 1.02x faster) 7.69 µs (➖ 1.00x slower)

virtq_readwrite

slot_pool_segmented slot_pool_segmented_fragmented
65536 8.56 µs (➖ 1.02x slower) 8.68 µs (➖ 1.02x slower)
262144 42.73 µs (➖ 1.01x faster)
8192 1.08 µs (➖ 1.08x faster) 1.07 µs (➖ 1.01x slower)

Reported by cargo ci bench-report --candidate run:45470883368 --config-file bench_report.toml.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-enhancement For PRs adding features, improving functionality, docs, tests, etc. O-aarch64 Specific to 64-bit Arm processors S-needs-review PR is ready for (re-)review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants