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