From 5dc03c90b9632bf9235e4ccc0be99535666a57c5 Mon Sep 17 00:00:00 2001
From: dd86k
Date: Sat, 12 Oct 2024 09:22:17 -0400
Subject: [PATCH] Fix FreeBSD build
---
src/adbg/debugger.d | 6 ++++++
src/adbg/process/thread.d | 1 +
2 files changed, 7 insertions(+)
diff --git a/src/adbg/debugger.d b/src/adbg/debugger.d
index fdc25e1..b2d08f0 100644
--- a/src/adbg/debugger.d
+++ b/src/adbg/debugger.d
@@ -44,6 +44,12 @@ version (Windows) {
version (USE_CLONE)
import adbg.include.posix.mann;
+
+ version (FreeBSD) {
+ // pragma(mangle, "stat@FBSD_1.5")
+ // leads to incorrect linked version
+ extern (C) int stat(const scope char*, stat_t*);
+ }
}
extern (C):
diff --git a/src/adbg/process/thread.d b/src/adbg/process/thread.d
index 4d35d59..768e219 100644
--- a/src/adbg/process/thread.d
+++ b/src/adbg/process/thread.d
@@ -26,6 +26,7 @@ version (Windows) {
import core.sys.posix.dirent;
import core.sys.posix.libgen : basename;
} else version (FreeBSD) {
+ import core.stdc.stdlib : malloc, free;
import adbg.include.freebsd.ptrace;
import adbg.include.freebsd.reg;
import core.sys.posix.sys.types : pid_t;