summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Machado <luis.machado@arm.com>2022-06-21 09:44:00 +0100
committerLuis Machado <luis.machado@arm.com>2022-06-22 15:46:22 +0100
commitbf5ddcecc07c2d89e824851f5f940ebe7e2af0fd (patch)
treec7f33cf2f50034efd0748f3810d5b976d2896440
parentad854c4c20b5c01ecd2784498c9a07a4c5c26b19 (diff)
downloadbinutils-gdb-bf5ddcecc07c2d89e824851f5f940ebe7e2af0fd.tar.gz
Conditionally define user_morello_state and user_cap structs
If we don't have the Morello kernel headers, we need to define our own structures to read capability registers and capabilities.
-rw-r--r--gdb/nat/aarch64-cap-linux.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/gdb/nat/aarch64-cap-linux.h b/gdb/nat/aarch64-cap-linux.h
index 3dc582a4c94..ff38bccaf6e 100644
--- a/gdb/nat/aarch64-cap-linux.h
+++ b/gdb/nat/aarch64-cap-linux.h
@@ -18,15 +18,10 @@
#ifndef NAT_AARCH64_CAP_LINUX_H
#define NAT_AARCH64_CAP_LINUX_H
-/* Morello-specific requests. */
-#ifndef PTRACE_PEEKCAP
-#define PTRACE_PEEKCAP 12
-#endif
-
-#ifndef PTRACE_POKECAP
-#define PTRACE_POKECAP 13
-#endif
-
+/* If we don't find PTRACE_POKECAP and PTRACE_PEEKCAP, we need to define
+ our own structures for reading capability registers and capabilities, as we
+ may be building GDB without the Morello kernel headers. */
+#if !defined(PTRACE_POKECAP) && !defined(PTRACE_PEEKCAP)
/* Struct defining the layout of the capability register set. */
struct user_morello_state {
/* General capability registers. */
@@ -58,6 +53,11 @@ struct user_cap {
uint8_t __reserved[15];
};
+/* Morello-specific requests. */
+#define PTRACE_PEEKCAP 12
+#define PTRACE_POKECAP 13
+#endif
+
/* From thread TID, read a capability from memory at ADDRESS and store
it into CAP.