mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ci: fix bootstrapping on macos/freebsd etc
This commit is contained in:
parent
82c4338b76
commit
612ac69486
@ -9,5 +9,8 @@ fn C.ptrace(int, u32, voidptr, int) int
|
|||||||
pub fn debugger_present() bool {
|
pub fn debugger_present() bool {
|
||||||
// check if the parent could trace its process,
|
// check if the parent could trace its process,
|
||||||
// if not a debugger must be present
|
// if not a debugger must be present
|
||||||
|
$if macos {
|
||||||
return C.ptrace(C.PT_TRACE_ME, 0, voidptr(1), 0) == -1
|
return C.ptrace(C.PT_TRACE_ME, 0, voidptr(1), 0) == -1
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
|
}
|
16
vlib/os/debugger_freebsd.c.v
Normal file
16
vlib/os/debugger_freebsd.c.v
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
module os
|
||||||
|
|
||||||
|
#include <sys/ptrace.h>
|
||||||
|
|
||||||
|
fn C.ptrace(int, u32, voidptr, int) int
|
||||||
|
|
||||||
|
// debugger_present returns a bool indicating if the process is being debugged
|
||||||
|
[inline]
|
||||||
|
pub fn debugger_present() bool {
|
||||||
|
// check if the parent could trace its process,
|
||||||
|
// if not a debugger must be present
|
||||||
|
$if freebsd {
|
||||||
|
return C.ptrace(C.PT_TRACE_ME, 0, voidptr(1), 0) == -1
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
@ -9,5 +9,8 @@ fn C.ptrace(u32, u32, voidptr, voidptr) u64
|
|||||||
pub fn debugger_present() bool {
|
pub fn debugger_present() bool {
|
||||||
// check if the parent could trace its process,
|
// check if the parent could trace its process,
|
||||||
// if not a debugger must be present
|
// if not a debugger must be present
|
||||||
|
$if linux {
|
||||||
return C.ptrace(C.PTRACE_TRACEME, 0, 1, 0) == -1
|
return C.ptrace(C.PTRACE_TRACEME, 0, 1, 0) == -1
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
@ -6,5 +6,8 @@ module os
|
|||||||
// debugger_present returns a bool indicating if the process is being debugged
|
// debugger_present returns a bool indicating if the process is being debugged
|
||||||
[inline]
|
[inline]
|
||||||
pub fn debugger_present() bool {
|
pub fn debugger_present() bool {
|
||||||
|
$if windows {
|
||||||
return C.IsDebuggerPresent()
|
return C.IsDebuggerPresent()
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user