1
2
3
4
5
6
7 package unix
8
9 import "unsafe"
10
11
12 type PtraceRegs386 struct {
13 Ebx int32
14 Ecx int32
15 Edx int32
16 Esi int32
17 Edi int32
18 Ebp int32
19 Eax int32
20 Xds int32
21 Xes int32
22 Xfs int32
23 Xgs int32
24 Orig_eax int32
25 Eip int32
26 Xcs int32
27 Eflags int32
28 Esp int32
29 Xss int32
30 }
31
32
33 func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error {
34 return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
35 }
36
37
38 func PtraceSetRegs386(pid int, regs *PtraceRegs386) error {
39 return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
40 }
41
42
43 type PtraceRegsAmd64 struct {
44 R15 uint64
45 R14 uint64
46 R13 uint64
47 R12 uint64
48 Rbp uint64
49 Rbx uint64
50 R11 uint64
51 R10 uint64
52 R9 uint64
53 R8 uint64
54 Rax uint64
55 Rcx uint64
56 Rdx uint64
57 Rsi uint64
58 Rdi uint64
59 Orig_rax uint64
60 Rip uint64
61 Cs uint64
62 Eflags uint64
63 Rsp uint64
64 Ss uint64
65 Fs_base uint64
66 Gs_base uint64
67 Ds uint64
68 Es uint64
69 Fs uint64
70 Gs uint64
71 }
72
73
74 func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error {
75 return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
76 }
77
78
79 func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error {
80 return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
81 }
82
View as plain text