Fix PR gdb/20413 - x32: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER
authorPedro Alves <palves@redhat.com>
Tue, 26 Jul 2016 18:35:40 +0000 (19:35 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 26 Jul 2016 18:38:13 +0000 (19:38 +0100)
commit40c31709c6a51926fcb409611caa52b2da6515c0
tree4b936b212e016bb58936f49178ce9d8a1136c19d
parent9cf12d57c58a82cfe3e6fee26d1ea55dfe49f9c4
Fix PR gdb/20413 - x32: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER

An x32 gdb always issues this warning:

 (gdb) start
 Temporary breakpoint 1 at 0x4043e9: file foo.c, line 25.
 Starting program: a.out
 warning: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER: Input/output error

 Temporary breakpoint 1, main (argc=1, argv=0xffffd544) at foo.c:25
 25      {
 (gdb)

As described in Linux commit 55283e253771 (x32: Add ptrace for x32):

    [...] PTRACE_PEEKUSR and PTRACE_POKEUSR are only allowed to access
    segment and debug registers. [...]

The fix is to use PTRACE_GETREGS instead.

gdb/ChangeLog:
2016-07-26  Pedro Alves  <palves@redhat.com>

* nat/linux-ptrace.c: Include "gregset.h".
(linux_ptrace_test_ret_to_nx): Use PTRACE_GETREGS instead of
PTRACE_PEEKUSER.
gdb/ChangeLog
gdb/nat/linux-ptrace.c