delve/proc/ptrace_darwin.go

21 lines
502 B
Go
Raw Normal View History

2015-06-12 19:49:23 +00:00
package proc
2015-01-14 02:37:10 +00:00
2015-10-06 17:45:36 +00:00
import sys "golang.org/x/sys/unix"
2015-01-14 02:37:10 +00:00
2015-05-01 20:50:29 +00:00
func PtraceDetach(tid, sig int) error {
2015-10-06 17:45:36 +00:00
return ptrace(sys.PT_DETACH, tid, 1, uintptr(sig))
2015-05-01 20:50:29 +00:00
}
2015-01-14 02:37:10 +00:00
func PtraceCont(tid, sig int) error {
2015-10-06 17:45:36 +00:00
return ptrace(sys.PTRACE_CONT, tid, 1, 0)
2015-01-14 02:37:10 +00:00
}
func PtraceSingleStep(tid int) error {
2015-10-06 17:45:36 +00:00
return ptrace(sys.PT_STEP, tid, 1, 0)
}
func ptrace(request, pid int, addr uintptr, data uintptr) (err error) {
_, _, err = sys.Syscall6(sys.SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
return
2015-01-14 02:37:10 +00:00
}