-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
What version of Go are you using (go version)?
go version go1.8.1 linux/mips64le
What operating system and processor architecture are you using?
Debian Stretch mips64el
What did you do?
Run this:
package main
import (
"fmt"
"os/exec"
"runtime"
"syscall"
"golang.org/x/sys/unix"
)
func main() {
runtime.LockOSThread()
cmd := exec.Command("/bin/true")
cmd.SysProcAttr = &syscall.SysProcAttr{ Ptrace: true }
err := cmd.Start()
if err != nil {
return
}
var status unix.WaitStatus
_, err = unix.Wait4(cmd.Process.Pid, &status, 0, nil)
if err != nil {
return
}
var regs unix.PtraceRegs
err = unix.PtraceGetRegs(cmd.Process.Pid, ®s)
if err != nil {
return
}
fmt.Printf("%#016x\n", regs.PC())
}What did you expect to see?
The initial program counter of /bin/true.
What did you see instead?
Always 0x0000000000000000
Related: https://go-review.googlesource.com/c/43133/
The bug exists because the C structure unix.PtraceRegs is based on struct user but it should be using struct pt_regs on MIPS.
Reactions are currently unavailable