// SetPC sets the RIP register to the value specified by `pc`. func (r *Regs) SetPC(thread *Thread, pc uint64) error { var context C.CONTEXT context.ContextFlags = C.CONTEXT_ALL res := C.GetThreadContext(C.HANDLE(thread.os.hThread), &context) if res == C.FALSE { return fmt.Errorf("could not GetThreadContext") } context.Rip = C.DWORD64(pc) res = C.SetThreadContext(C.HANDLE(thread.os.hThread), &context) if res == C.FALSE { return fmt.Errorf("could not SetThreadContext") } return nil }