Add comment regarding include order of <sys/ptrace.h> and <asm/ptrace.h>
authorKevin Buettner <kevinb@redhat.com>
Wed, 24 Feb 2021 21:35:07 +0000 (14:35 -0700)
committerKevin Buettner <kevinb@redhat.com>
Wed, 24 Feb 2021 21:35:07 +0000 (14:35 -0700)
gdb/ChangeLog:

* nat/aarch64-linux-hw-point.c: Add comment regarding include
order for <sys/ptrace.h> and <asm/ptrace.h>.

gdb/ChangeLog
gdb/nat/aarch64-linux-hw-point.c

index f7052421935a6f9c55871c9c2cf7c058c7ce41bc..23055128014279afaf374337f96dfaebe0e9f706 100644 (file)
@@ -1,3 +1,8 @@
+2021-02-24  Kevin Buettner  <kevinb@redhat.com>
+
+       * nat/aarch64-linux-hw-point.c: Add comment regarding include
+       order for <sys/ptrace.h> and <asm/ptrace.h>.
+
 2021-02-24  Kevin Buettner  <kevinb@redhat.com>
 
        * nat/aarch64-linux-hw-point.c: Include <asm/ptrace.h> after
index 0278ac2bb28632b35e77f027b7b4661800a4612a..af2cc4254e275aaa8835ff6057242051c2a7930a 100644 (file)
 #include "aarch64-linux-hw-point.h"
 
 #include <sys/uio.h>
+
+/* The order in which <sys/ptrace.h> and <asm/ptrace.h> are included
+   can be important.  <sys/ptrace.h> often declares various PTRACE_*
+   enums.  <asm/ptrace.h> often defines preprocessor constants for
+   these very same symbols.  When that's the case, build errors will
+   result when <asm/ptrace.h> is included before <sys/ptrace.h>.  */
 #include <sys/ptrace.h>
 #include <asm/ptrace.h>
+
 #include <elf.h>
 
 /* Number of hardware breakpoints/watchpoints the target supports.