Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [pushed] Fix aarch64-linux-hw-point.c build problem
Date: Wed, 24 Feb 2021 12:59:45 -0700	[thread overview]
Message-ID: <20210224195945.2135883-1-kevinb@redhat.com> (raw)

Due to a recent glibc header file change, the file
nat/aarch64-linux-hw-point.c no longer builds on Fedora rawhide.

An enum for PTRACE_SYSEMU is now provided by <sys/ptrace.h>.  In the
past, PTRACE_SYSEMU was defined only in <asm/ptrace.h>.  This is
what it looks like...

In <asm/ptrace.h>:

 #define PTRACE_SYSEMU		  31

In <sys/ptrace.h>:

enum __ptrace_request
{
  ...
  PTRACE_SYSEMU = 31,
 #define PT_SYSEMU PTRACE_SYSEMU

  ...
}

When <asm/ptrace.h> and <sys/ptrace.h> are both included in a source
file, we run into the following build problem when the former is
included before the latter:

In file included from nat/aarch64-linux-hw-point.c:26:
/usr/include/sys/ptrace.h:86:3: error: expected identifier before numeric constant
   86 |   PTRACE_SYSEMU = 31,
      |   ^~~~~~~~~~~~~

(There are more errors after this one too.)

The file builds without error when <asm/ptrace.h> is included after
<sys/ptrace.h>.  I found that this is already done in
nat/aarch64-sve-linux-ptrace.h (which is included by
nat/aarch64-linux-ptrace.c).

I've tested this change on Fedora rawhide and Fedora 33, both
running on an aarch64 machine.

gdb/ChangeLog:

	* nat/aarch64-linux-hw-point.c: Include <asm/ptrace.h> after
	<sys/ptrace.h>.
---
 gdb/ChangeLog                    | 5 +++++
 gdb/nat/aarch64-linux-hw-point.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 00a71fe9025..f7052421935 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2021-02-24  Kevin Buettner  <kevinb@redhat.com>
+
+	* nat/aarch64-linux-hw-point.c: Include <asm/ptrace.h> after
+	<sys/ptrace.h>.
+
 2021-02-24  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* exec.c (set_section_command): Move variable declarations into
diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
index 73e4edd68cb..0278ac2bb28 100644
--- a/gdb/nat/aarch64-linux-hw-point.c
+++ b/gdb/nat/aarch64-linux-hw-point.c
@@ -23,8 +23,8 @@
 #include "aarch64-linux-hw-point.h"
 
 #include <sys/uio.h>
-#include <asm/ptrace.h>
 #include <sys/ptrace.h>
+#include <asm/ptrace.h>
 #include <elf.h>
 
 /* Number of hardware breakpoints/watchpoints the target supports.
-- 
2.29.2


             reply	other threads:[~2021-02-24 20:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 19:59 Kevin Buettner via Gdb-patches [this message]
2021-02-24 20:52 ` Tom Tromey
2021-02-24 21:52   ` Kevin Buettner via Gdb-patches
2021-02-24 23:22     ` Christian Biesinger via Gdb-patches
2021-02-25 22:49       ` Kevin Buettner via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210224195945.2135883-1-kevinb@redhat.com \
    --to=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox