Guard debug stub port query behind macOS 26+

The _configuration._debugStub private API causes SIGBUS on macOS 15.
Only query it on macOS 26+ where the API exists.

Closes #128
This commit is contained in:
Lakr
2026-03-07 23:58:59 +08:00
parent 5f525452c1
commit 6b7b2cbbf1

View File

@@ -298,11 +298,15 @@ class VPhoneVirtualMachine: NSObject, VZVirtualMachineDelegate {
print("[vphone] VM started — booting normally")
}
// Print auto-assigned debug stub port after VM starts
if let debugStub = Dynamic(vm)._configuration._debugStub.asAnyObject {
if let port = Dynamic(debugStub).port.asInt, port > 0 {
print("[vphone] Kernel GDB debug stub listening on tcp://127.0.0.1:\(port)")
// Print auto-assigned debug stub port after VM starts (private API, macOS 26+ only)
if ProcessInfo.processInfo.operatingSystemVersion.majorVersion >= 26 {
if let debugStub = Dynamic(vm)._configuration._debugStub.asAnyObject {
if let port = Dynamic(debugStub).port.asInt, port > 0 {
print("[vphone] Kernel GDB debug stub listening on tcp://127.0.0.1:\(port)")
}
}
} else {
print("[vphone] Kernel GDB debug stub port query requires macOS 26+, skipped")
}
}