summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2021-02-19 15:32:09 +0000
committerDavid Spickett <david.spickett@linaro.org>2021-06-24 15:43:20 +0100
commit8d58fbd09efb443d92842a0d101348cda06d7253 (patch)
treefc57fbc0f45425718fabe537a7bea3632ca633f5 /lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
parentd57a5879ab6781a58020d3a878c617266d939e51 (diff)
[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
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp')
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp22
1 files changed, 20 insertions, 2 deletions
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 <sys/user.h>
#include <sys/wait.h>
+#ifdef __aarch64__
+#include <asm/hwcap.h>
+#include <sys/auxv.h>
+#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