[RFA] fix gdbserver build in nat/linux-ptrace.c on arm-android

Message ID 1484655256-31563-1-git-send-email-brobecker@adacore.com
State New, archived
Headers

Commit Message

Joel Brobecker Jan. 17, 2017, 12:14 p.m. UTC
  Hello,

The following change replaced an include of gregset.h by
an include of <sys/procfs.h>:

    commit 39b22471578843019026c50fcdbe0483a6045970
    Date:   Thu Aug 11 12:01:22 2016 +0100
    Subject: Fix fallout from gdb/20413's fix
             (x32: linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER)

Unfortunately, this broke gdbserver on Android, because that file
does not exist on this platform.  This patch fixes the issue by
conditionalizing its include with HAVE_SYS_PROCFS_H (which we check
both in gdb/configure and gdbserver/configure).

gdb/ChangeLog:

        * nat/linux-ptrace.c: Only include <sys/procfs.h> if
        HAVE_SYS_PROCFS_H is defined.

Tested by rebuilding gdbserver on arm-android and GNU/Linux.

OK to push?
Thanks!
  

Comments

Yao Qi Jan. 18, 2017, 10:34 p.m. UTC | #1
On Tue, Jan 17, 2017 at 12:14 PM, Joel Brobecker <brobecker@adacore.com> wrote:
> gdb/ChangeLog:
>
>         * nat/linux-ptrace.c: Only include <sys/procfs.h> if
>         HAVE_SYS_PROCFS_H is defined.
>
> Tested by rebuilding gdbserver on arm-android and GNU/Linux.
>
> OK to push?

Yes, please.
  
Joel Brobecker Jan. 20, 2017, 8:47 a.m. UTC | #2
> > gdb/ChangeLog:
> >
> >         * nat/linux-ptrace.c: Only include <sys/procfs.h> if
> >         HAVE_SYS_PROCFS_H is defined.
> >
> > Tested by rebuilding gdbserver on arm-android and GNU/Linux.
> >
> > OK to push?
> 
> Yes, please.

Thanks, Yao. Pushed to master.
  

Patch

diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index 3447e07..3265b16 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -23,7 +23,9 @@ 
 #include "buffer.h"
 #include "gdb_wait.h"
 #include "gdb_ptrace.h"
+#ifdef HAVE_SYS_PROCFS_H
 #include <sys/procfs.h>
+#endif
 
 /* Stores the ptrace options supported by the running kernel.
    A value of -1 means we did not check for features yet.  A value