mirror of
https://github.com/go-delve/delve.git
synced 2025-10-27 20:23:41 +08:00
* delve: support linux-loong64 native debug LoongArch is a new RISC ISA, which is independently designed by Loongson Technology. LoongArch includes a reduced 32-bit version (LA32R), a standard 32-bit version (LA32S) and a 64-bit version (LA64), and loong64 is the 64-bit version of LoongArch. LoongArch documentation: https://github.com/loongson/LoongArch-Documentation.git * *: mark loong64 port as experimental --------- Co-authored-by: Huang Qiqi <huangqiqi@loongson.cn>
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
//go:build (linux && amd64) || (linux && arm64) || (linux && ppc64le) || (linux && riscv64) || (linux && loong64)
|
|
|
|
package native
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
|
|
sys "golang.org/x/sys/unix"
|
|
)
|
|
|
|
// processVmRead calls process_vm_readv
|
|
func processVmRead(tid int, addr uintptr, data []byte) (int, error) {
|
|
len_iov := uint64(len(data))
|
|
local_iov := sys.Iovec{Base: &data[0], Len: len_iov}
|
|
remote_iov := remoteIovec{base: addr, len: uintptr(len_iov)}
|
|
n, _, err := syscall.Syscall6(sys.SYS_PROCESS_VM_READV, uintptr(tid), uintptr(unsafe.Pointer(&local_iov)), 1, uintptr(unsafe.Pointer(&remote_iov)), 1, 0)
|
|
if err != syscall.Errno(0) {
|
|
return 0, err
|
|
}
|
|
return int(n), nil
|
|
}
|
|
|
|
// processVmWrite calls process_vm_writev
|
|
func processVmWrite(tid int, addr uintptr, data []byte) (int, error) {
|
|
len_iov := uint64(len(data))
|
|
local_iov := sys.Iovec{Base: &data[0], Len: len_iov}
|
|
remote_iov := remoteIovec{base: addr, len: uintptr(len_iov)}
|
|
n, _, err := syscall.Syscall6(sys.SYS_PROCESS_VM_WRITEV, uintptr(tid), uintptr(unsafe.Pointer(&local_iov)), 1, uintptr(unsafe.Pointer(&remote_iov)), 1, 0)
|
|
if err != syscall.Errno(0) {
|
|
return 0, err
|
|
}
|
|
return int(n), nil
|
|
}
|