From 8d58fbd09efb443d92842a0d101348cda06d7253 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Fri, 19 Feb 2021 15:32:09 +0000 Subject: [lldb][AArch64] Add memory-tagging qSupported feature This feature "memory-tagging+" indicates that lldb-server supports memory tagging packets. (added in a later patch) We check HWCAP2_MTE to decide whether to enable this feature for Linux. Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D97282 --- .../Plugins/Process/Linux/NativeProcessLinux.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp') diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 62c2a725779e..2d53972b69b7 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -53,11 +53,20 @@ #include #include +#ifdef __aarch64__ +#include +#include +#endif + // Support hardware breakpoints in case it has not been defined #ifndef TRAP_HWBKPT #define TRAP_HWBKPT 4 #endif +#ifndef HWCAP2_MTE +#define HWCAP2_MTE (1 << 18) +#endif + using namespace lldb; using namespace lldb_private; using namespace lldb_private::process_linux; @@ -283,8 +292,17 @@ NativeProcessLinux::Factory::Attach( NativeProcessLinux::Extension NativeProcessLinux::Factory::GetSupportedExtensions() const { - return Extension::multiprocess | Extension::fork | Extension::vfork | - Extension::pass_signals | Extension::auxv | Extension::libraries_svr4; + NativeProcessLinux::Extension supported = + Extension::multiprocess | Extension::fork | Extension::vfork | + Extension::pass_signals | Extension::auxv | Extension::libraries_svr4; + +#ifdef __aarch64__ + // At this point we do not have a process so read auxv directly. + if ((getauxval(AT_HWCAP2) & HWCAP2_MTE)) + supported |= Extension::memory_tagging; +#endif + + return supported; } // Public Instance Methods -- cgit v1.2.3