A x32 gdb always issues this warning: (gdb) start Temporary breakpoint 1 at 0x4043e9: file foo.c, line 25. Starting program: a.bout 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) This is just a warning, and shouldn't affect debugging in any way. Still, it's annoying.
The master branch has been updated by Pedro Alves <palves@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=40c31709c6a51926fcb409611caa52b2da6515c0 commit 40c31709c6a51926fcb409611caa52b2da6515c0 Author: Pedro Alves <palves@redhat.com> Date: Tue Jul 26 19:35:40 2016 +0100 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.
Fixed in master.
Thanks Pedro for doing that.
This fix breaks NIOS GNU/Linux build. In file included from /scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../nat/linux-ptrace.c:26:0: /scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../gregset.h:27:23: error: unknown type name 'gregset_t' #define GDB_GREGSET_T gregset_t ^ /scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../gregset.h:34:9: note: in expansion of macro 'GDB_GREGSET_T' typedef GDB_GREGSET_T gdb_gregset_t; ^~~~~~~~~~~~~ /scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../gregset.h:31:24: error: unknown type name 'fpregset_t' #define GDB_FPREGSET_T fpregset_t ^ /scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../gregset.h:35:9: note: in expansion of macro 'GDB_FPREGSET_T' typedef GDB_FPREGSET_T gdb_fpregset_t; ^~~~~~~~~~~~~~ Makefile:624: recipe for target 'linux-ptrace.o' failed make: *** [linux-ptrace.o] Error 1 make: *** Waiting for unfinished jobs....
Does this fix it? diff --git c/gdb/nat/linux-ptrace.c w/gdb/nat/linux-ptrace.c index 980ed53..f00f179 100644 --- c/gdb/nat/linux-ptrace.c +++ w/gdb/nat/linux-ptrace.c @@ -23,7 +23,7 @@ #include "buffer.h" #include "gdb_wait.h" #include "gdb_ptrace.h" -#include "gregset.h" +#include <sys/procfs.h> /* Stores the ptrace options supported by the running kernel. A value of -1 means we did not check for features yet. A value
Hi Pedro, Yes, it fixes Nios GNU/Linux build as well as no regression found for x32 gdb server build also :)
The master branch has been updated by Pedro Alves <palves@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=39b22471578843019026c50fcdbe0483a6045970 commit 39b22471578843019026c50fcdbe0483a6045970 Author: Pedro Alves <palves@redhat.com> Date: Thu Aug 11 12:01:22 2016 +0100 Fix fallout from gdb/20413's fix (x32: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER) Fixes, on NIOS GNU/Linux: In file included from /scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../nat/linux-ptrace.c:26:0: /scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../gregset.h:27:23: error: unknown type name 'gregset_t' #define GDB_GREGSET_T gregset_t ^ Fix this by including sys/procfs.h directly. We shouldn't really be including a gdb-only header in a gdb/nat/ file, anyway. Whoops. gdb/ChangeLog: 2016-08-11 Pedro Alves <palves@redhat.com> PR gdb/20413 * nat/linux-ptrace.c: Include <sys/procfs.h> instead of "gregset.h".
The gdb-7.12-branch branch has been updated by Pedro Alves <palves@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e565c44e294111fdc2b84396917b0c4ffed916fb commit e565c44e294111fdc2b84396917b0c4ffed916fb Author: Pedro Alves <palves@redhat.com> Date: Thu Aug 11 12:03:18 2016 +0100 Fix fallout from gdb/20413's fix (x32: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER) Fixes, on NIOS GNU/Linux: In file included from /scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../nat/linux-ptrace.c:26:0: /scratch/mbilal/nois-lite/src/gdb-trunk/gdb/gdbserver/../gregset.h:27:23: error: unknown type name 'gregset_t' #define GDB_GREGSET_T gregset_t ^ Fix this by including sys/procfs.h directly. We shouldn't really be including a gdb-only header in a gdb/nat/ file, anyway. Whoops. gdb/ChangeLog: 2016-08-11 Pedro Alves <palves@redhat.com> PR gdb/20413 * nat/linux-ptrace.c: Include <sys/procfs.h> instead of "gregset.h".
Fixed. Thanks!