mirror of git://gcc.gnu.org/git/gcc.git
syscall: Don't use PtraceRegs if it is not defined.
From-SVN: r183758
This commit is contained in:
parent
458842fb38
commit
e8738e985e
|
|
@ -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)
|
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) {
|
func PtraceSetOptions(pid int, options int) (err error) {
|
||||||
return ptrace(PTRACE_SETOPTIONS, pid, 0, uintptr(options))
|
return ptrace(PTRACE_SETOPTIONS, pid, 0, uintptr(options))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,20 @@
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
func (r *PtraceRegs) PC() uint64 {
|
func (r *PtraceRegs) PC() uint64 {
|
||||||
return uint64(uint32(r.Eip));
|
return uint64(uint32(r.Eip))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PtraceRegs) SetPC(pc uint64) {
|
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)))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
type PtraceRegs struct {
|
type PtraceRegs struct {
|
||||||
R0 uint64
|
R0 uint64
|
||||||
R1 uint64
|
R1 uint64
|
||||||
|
|
@ -39,9 +41,17 @@ type PtraceRegs struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PtraceRegs) PC() uint64 {
|
func (r *PtraceRegs) PC() uint64 {
|
||||||
return r.Pc;
|
return r.Pc
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PtraceRegs) SetPC(pc uint64) {
|
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)))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,20 @@
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
func (r *PtraceRegs) PC() uint64 {
|
func (r *PtraceRegs) PC() uint64 {
|
||||||
return r.Rip;
|
return r.Rip
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PtraceRegs) SetPC(pc uint64) {
|
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)))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue