func (dbp *Process) requestManualStop() (err error) { var ( task = C.mach_port_t(dbp.os.task) thread = C.mach_port_t(dbp.CurrentThread.os.thread_act) exceptionPort = C.mach_port_t(dbp.os.exceptionPort) ) kret := C.raise_exception(task, thread, exceptionPort, C.EXC_BREAKPOINT) if kret != C.KERN_SUCCESS { return fmt.Errorf("could not raise mach exception") } return nil }
func (t *Thread) singleStep() error { kret := C.single_step(t.os.threadAct) if kret != C.KERN_SUCCESS { return fmt.Errorf("could not single step") } for { port := C.mach_port_wait(t.dbp.os.portSet, C.int(0)) if port == C.mach_port_t(t.ID) { break } } kret = C.clear_trap_flag(t.os.threadAct) if kret != C.KERN_SUCCESS { return fmt.Errorf("could not clear CPU trap flag") } return nil }