|
12 | 12 | package unix
|
13 | 13 |
|
14 | 14 | import (
|
15 |
| - "debug/elf" |
16 | 15 | "encoding/binary"
|
17 | 16 | "strconv"
|
18 | 17 | "syscall"
|
@@ -1700,18 +1699,23 @@ func PtracePokeUser(pid int, addr uintptr, data []byte) (count int, err error) {
|
1700 | 1699 | return ptracePoke(PTRACE_POKEUSR, PTRACE_PEEKUSR, pid, addr, data)
|
1701 | 1700 | }
|
1702 | 1701 |
|
| 1702 | +// elfNT_PRSTATUS is a copy of the debug/elf.NT_PRSTATUS constant so |
| 1703 | +// x/sys/unix doesn't need to depend on debug/elf and thus |
| 1704 | +// compress/zlib, debug/dwarf, and other packages. |
| 1705 | +const elfNT_PRSTATUS = 1 |
| 1706 | + |
1703 | 1707 | func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
|
1704 | 1708 | var iov Iovec
|
1705 | 1709 | iov.Base = (*byte)(unsafe.Pointer(regsout))
|
1706 | 1710 | iov.SetLen(int(unsafe.Sizeof(*regsout)))
|
1707 |
| - return ptracePtr(PTRACE_GETREGSET, pid, uintptr(elf.NT_PRSTATUS), unsafe.Pointer(&iov)) |
| 1711 | + return ptracePtr(PTRACE_GETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov)) |
1708 | 1712 | }
|
1709 | 1713 |
|
1710 | 1714 | func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
|
1711 | 1715 | var iov Iovec
|
1712 | 1716 | iov.Base = (*byte)(unsafe.Pointer(regs))
|
1713 | 1717 | iov.SetLen(int(unsafe.Sizeof(*regs)))
|
1714 |
| - return ptracePtr(PTRACE_SETREGSET, pid, uintptr(elf.NT_PRSTATUS), unsafe.Pointer(&iov)) |
| 1718 | + return ptracePtr(PTRACE_SETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov)) |
1715 | 1719 | }
|
1716 | 1720 |
|
1717 | 1721 | func PtraceSetOptions(pid int, options int) (err error) {
|
|
0 commit comments