syscall: Don't use PtraceRegs if it is not defined.
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 31 Jan 2012 14:23:07 +0000 (14:23 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 31 Jan 2012 14:23:07 +0000 (14:23 +0000)
From-SVN: r183758

libgo/go/syscall/libcall_linux.go
libgo/go/syscall/syscall_linux_386.go
libgo/go/syscall/syscall_linux_alpha.go
libgo/go/syscall/syscall_linux_amd64.go

index 3ff5d5f913f24ab47ef4a06e861255697a6b3f1c..7e88d04026e9106c3fd70e62af447d8187b430b7 100644 (file)
@@ -139,14 +139,6 @@ func PtracePokeData(pid int, addr uintptr, data []byte) (count int, err error) {
        return ptracePoke(PTRACE_POKEDATA, PTRACE_PEEKDATA, pid, addr, data)
 }
 
-func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
-       return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
-}
-
-func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
-       return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
-}
-
 func PtraceSetOptions(pid int, options int) (err error) {
        return ptrace(PTRACE_SETOPTIONS, pid, 0, uintptr(options))
 }
index aca9c7bf5ef4469e6839aaf07f9010aa92c8dfea..9a988a5dca2263a9cf65fc458f15260dd1472a02 100644 (file)
@@ -6,10 +6,20 @@
 
 package syscall
 
+import "unsafe"
+
 func (r *PtraceRegs) PC() uint64 {
-       return uint64(uint32(r.Eip));
+       return uint64(uint32(r.Eip))
 }
 
 func (r *PtraceRegs) SetPC(pc uint64) {
-       r.Eip = int32(pc);
+       r.Eip = int32(pc)
+}
+
+func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
+       return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
+}
+
+func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
+       return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
 }
index d58f8eb13a5187534423e604b751224b300903c7..713546cb0579dc7ed666a99c96d84ac37a4db788 100644 (file)
@@ -6,42 +6,52 @@
 
 package syscall
 
+import "unsafe"
+
 type PtraceRegs struct {
-       R0 uint64
-       R1 uint64
-       R2 uint64
-       R3 uint64
-       R4 uint64
-       R5 uint64
-       R6 uint64
-       R7 uint64
-       R8 uint64
-       R19 uint64
-       R20 uint64
-       R21 uint64
-       R22 uint64
-       R23 uint64
-       R24 uint64
-       R25 uint64
-       R26 uint64
-       R27 uint64
-       R28 uint64
-       Hae uint64
+       R0      uint64
+       R1      uint64
+       R2      uint64
+       R3      uint64
+       R4      uint64
+       R5      uint64
+       R6      uint64
+       R7      uint64
+       R8      uint64
+       R19     uint64
+       R20     uint64
+       R21     uint64
+       R22     uint64
+       R23     uint64
+       R24     uint64
+       R25     uint64
+       R26     uint64
+       R27     uint64
+       R28     uint64
+       Hae     uint64
        Trap_a0 uint64
        Trap_a1 uint64
        Trap_a2 uint64
-       Ps uint64
-       Pc uint64
-       Gp uint64
-       R16 uint64
-       R17 uint64
-       R18 uint64
+       Ps      uint64
+       Pc      uint64
+       Gp      uint64
+       R16     uint64
+       R17     uint64
+       R18     uint64
 }
 
 func (r *PtraceRegs) PC() uint64 {
-       return r.Pc;
+       return r.Pc
 }
 
 func (r *PtraceRegs) SetPC(pc uint64) {
-       r.Pc = pc;
+       r.Pc = pc
+}
+
+func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
+       return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
+}
+
+func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
+       return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
 }
index 9932579cc10a93ef702bb53fb2df4525ff28e09f..609faed06d438d7885e9af9deb7a7383fa54e38b 100644 (file)
@@ -6,10 +6,20 @@
 
 package syscall
 
+import "unsafe"
+
 func (r *PtraceRegs) PC() uint64 {
-       return r.Rip;
+       return r.Rip
 }
 
 func (r *PtraceRegs) SetPC(pc uint64) {
-       r.Rip = pc;
+       r.Rip = pc
+}
+
+func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
+       return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
+}
+
+func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
+       return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
 }