
On macOS 10.14 Apple changed the command line tools so that system headers now need to be manually installed. Instead of adding one extra install step to the install procedure add a build tag to allow compilation of delve without the native backend on macOS. By default (i.e. when using `go get`) this is how delve will be compiled on macOS, the make script is changed to enable compiling the native backend if the required dependencies have been installed. Insure that both configuration still build correctly on Travis CI and change the documentation to describe how to compile the native backend and that it isn't normally needed. Fixes #1359
31 lines
804 B
Go
31 lines
804 B
Go
//+build darwin,macnative
|
|
|
|
package native
|
|
|
|
import sys "golang.org/x/sys/unix"
|
|
|
|
// PtraceAttach executes the sys.PtraceAttach call.
|
|
func PtraceAttach(pid int) error {
|
|
return sys.PtraceAttach(pid)
|
|
}
|
|
|
|
// PtraceDetach executes the PT_DETACH ptrace call.
|
|
func PtraceDetach(tid, sig int) error {
|
|
return ptrace(sys.PT_DETACH, tid, 1, uintptr(sig))
|
|
}
|
|
|
|
// PtraceCont executes the PTRACE_CONT ptrace call.
|
|
func PtraceCont(tid, sig int) error {
|
|
return ptrace(sys.PTRACE_CONT, tid, 1, 0)
|
|
}
|
|
|
|
// PtraceSingleStep returns PT_STEP ptrace call.
|
|
func PtraceSingleStep(tid int) error {
|
|
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
|
|
}
|