From 6d5402d7c109275822c0166f0c39f0507a0ac8fc Mon Sep 17 00:00:00 2001
From: dd86k
Date: Mon, 30 Sep 2024 16:02:35 -0400
Subject: [PATCH] debugger: provide correct addr for PT_CONTINUE on BSDs
---
src/adbg/debugger.d | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/adbg/debugger.d b/src/adbg/debugger.d
index df602cf..db21c04 100644
--- a/src/adbg/debugger.d
+++ b/src/adbg/debugger.d
@@ -751,7 +751,10 @@ version (Windows) {
version(Trace) trace("pid=%d state=%d", proc.pid, proc.status);
switch (proc.status) with (AdbgProcStatus) {
case loaded, stopped:
- if (ptrace(PT_CONTINUE, proc.pid, null, 0) < 0) {
+ // NOTE: FreeBSD/NetBSD/OpenBSD PT_CONTINUE
+ // addr can be an address to resume at, or 1
+ // data can be a signal number, or 0
+ if (ptrace(PT_CONTINUE, proc.pid, cast(caddr_t)1, 0) < 0) {
proc.status = AdbgProcStatus.unknown;
return adbg_oops(AdbgError.os);
}