gitlab.com/Raven-IO/raven-delve@v1.22.4/pkg/proc/native/ptrace_darwin.go (about) 1 //go:build darwin && macnative 2 3 package native 4 5 import sys "golang.org/x/sys/unix" 6 7 // ptraceAttach executes the sys.PtraceAttach call. 8 func ptraceAttach(pid int) error { 9 return sys.PtraceAttach(pid) 10 } 11 12 // ptraceDetach executes the PT_DETACH ptrace call. 13 func ptraceDetach(tid, sig int) error { 14 return ptrace(sys.PT_DETACH, tid, 1, uintptr(sig)) 15 } 16 17 // ptraceCont executes the PTRACE_CONT ptrace call. 18 func ptraceCont(tid, sig int) error { 19 return ptrace(sys.PTRACE_CONT, tid, 1, 0) 20 } 21 22 // ptraceSingleStep returns PT_STEP ptrace call. 23 func ptraceSingleStep(tid int) error { 24 return ptrace(sys.PT_STEP, tid, 1, 0) 25 } 26 27 func ptrace(request, pid int, addr uintptr, data uintptr) (err error) { 28 _, _, err = sys.Syscall6(sys.SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) 29 return 30 }