proc: fix build on macOS (#728)

Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
This commit is contained in:
Koichi Shiraishi 2017-02-09 17:13:12 +09:00 committed by Alessandro Arzilli
parent 53f0d24057
commit 997f038c47
2 changed files with 6 additions and 5 deletions

@ -175,7 +175,7 @@ func (dbp *Process) Kill() (err error) {
func (dbp *Process) requestManualStop() (err error) { func (dbp *Process) requestManualStop() (err error) {
var ( var (
task = C.mach_port_t(dbp.os.task) task = C.mach_port_t(dbp.os.task)
thread = C.mach_port_t(dbp.CurrentThread.os.threadAct) thread = C.mach_port_t(dbp.currentThread.os.threadAct)
exceptionPort = C.mach_port_t(dbp.os.exceptionPort) exceptionPort = C.mach_port_t(dbp.os.exceptionPort)
) )
kret := C.raise_exception(task, thread, exceptionPort, C.EXC_BREAKPOINT) kret := C.raise_exception(task, thread, exceptionPort, C.EXC_BREAKPOINT)

@ -5,8 +5,9 @@ package proc
import "C" import "C"
import ( import (
"fmt" "fmt"
sys "golang.org/x/sys/unix"
"unsafe" "unsafe"
sys "golang.org/x/sys/unix"
) )
// WaitStatus is a synonym for the platform-specific WaitStatus // WaitStatus is a synonym for the platform-specific WaitStatus
@ -35,7 +36,7 @@ func (t *Thread) halt() (err error) {
return return
} }
if _, ok := t.dbp.Threads[t.ID]; ok { if _, ok := t.dbp.threads[t.ID]; ok {
err = fmt.Errorf("could not suspend thread %d %s", t.ID, errStr) err = fmt.Errorf("could not suspend thread %d %s", t.ID, errStr)
return return
} }
@ -49,7 +50,7 @@ func (t *Thread) singleStep() error {
return fmt.Errorf("could not single step") return fmt.Errorf("could not single step")
} }
for { for {
twthread, err := t.dbp.trapWait(t.dbp.Pid) twthread, err := t.dbp.trapWait(t.dbp.pid)
if err != nil { if err != nil {
return err return err
} }
@ -69,7 +70,7 @@ func (t *Thread) resume() error {
t.running = true t.running = true
// TODO(dp) set flag for ptrace stops // TODO(dp) set flag for ptrace stops
var err error var err error
t.dbp.execPtraceFunc(func() { err = PtraceCont(t.dbp.Pid, 0) }) t.dbp.execPtraceFunc(func() { err = PtraceCont(t.dbp.pid, 0) })
if err == nil { if err == nil {
return nil return nil
} }