From bf5ddcecc07c2d89e824851f5f940ebe7e2af0fd Mon Sep 17 00:00:00 2001 From: Luis Machado Date: Tue, 21 Jun 2022 09:44:00 +0100 Subject: [PATCH] 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. --- gdb/nat/aarch64-cap-linux.h | 18 +++++++++--------- 1 file 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. -- 2.47.2