gitlab.com/Raven-IO/raven-delve@v1.22.4/pkg/proc/native/ptrace_linux_64bit.go (about) 1 //go:build (linux && amd64) || (linux && arm64) || (linux && ppc64le) 2 3 package native 4 5 import ( 6 "syscall" 7 "unsafe" 8 9 sys "golang.org/x/sys/unix" 10 ) 11 12 // processVmRead calls process_vm_readv 13 func processVmRead(tid int, addr uintptr, data []byte) (int, error) { 14 len_iov := uint64(len(data)) 15 local_iov := sys.Iovec{Base: &data[0], Len: len_iov} 16 remote_iov := remoteIovec{base: addr, len: uintptr(len_iov)} 17 n, _, err := syscall.Syscall6(sys.SYS_PROCESS_VM_READV, uintptr(tid), uintptr(unsafe.Pointer(&local_iov)), 1, uintptr(unsafe.Pointer(&remote_iov)), 1, 0) 18 if err != syscall.Errno(0) { 19 return 0, err 20 } 21 return int(n), nil 22 } 23 24 // processVmWrite calls process_vm_writev 25 func processVmWrite(tid int, addr uintptr, data []byte) (int, error) { 26 len_iov := uint64(len(data)) 27 local_iov := sys.Iovec{Base: &data[0], Len: len_iov} 28 remote_iov := remoteIovec{base: addr, len: uintptr(len_iov)} 29 n, _, err := syscall.Syscall6(sys.SYS_PROCESS_VM_WRITEV, uintptr(tid), uintptr(unsafe.Pointer(&local_iov)), 1, uintptr(unsafe.Pointer(&remote_iov)), 1, 0) 30 if err != syscall.Errno(0) { 31 return 0, err 32 } 33 return int(n), nil 34 }