aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Utility/StringExtractorGDBRemote.cpp
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2021-02-19 15:57:59 +0000
committerDavid Spickett <david.spickett@linaro.org>2021-06-24 17:02:55 +0100
commitda2e614f56b196b37175e2babfac8ed7b43ab624 (patch)
tree104b8c39110298f74d39f3d164c099511f833c38 /lldb/source/Utility/StringExtractorGDBRemote.cpp
parentf6ba845da3f89ca1f9591d42ae48f6fb29079096 (diff)
downloadllvm-da2e614f56b196b37175e2babfac8ed7b43ab624.zip
llvm-da2e614f56b196b37175e2babfac8ed7b43ab624.tar.gz
llvm-da2e614f56b196b37175e2babfac8ed7b43ab624.tar.bz2
[lldb][AArch64] Add memory tag reading to lldb-server
This adds memory tag reading using the new "qMemTags" packet and ptrace on AArch64 Linux. This new packet is following the one used by GDB. (https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html) On AArch64 Linux we use ptrace's PEEKMTETAGS to read tags and we assume that lldb has already checked that the memory region actually has tagging enabled. We do not assume that lldb has expanded the requested range to granules and expand it again to be sure. (although lldb will be sending aligned ranges because it happens to need them client side anyway) Also we don't assume untagged addresses. So for AArch64 we'll remove the top byte before using them. (the top byte includes MTE and other non address data) To do the ptrace read NativeProcessLinux will ask the native register context for a memory tag manager based on the type in the packet. This also gives you the ptrace numbers you need. (it's called a register context but it also has non register data, so it saves adding another per platform sub class) The only supported platform for this is AArch64 Linux and the only supported tag type is MTE allocation tags. Anything else will error. Ptrace can return a partial result but for lldb-server we will be treating that as an error. To succeed we need to get all the tags we expect. (Note that the protocol leaves room for logical tags to be read via qMemTags but this is not going to be implemented for lldb at this time.) Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D95601
Diffstat (limited to 'lldb/source/Utility/StringExtractorGDBRemote.cpp')
-rw-r--r--lldb/source/Utility/StringExtractorGDBRemote.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lldb/source/Utility/StringExtractorGDBRemote.cpp b/lldb/source/Utility/StringExtractorGDBRemote.cpp
index ea4b9ef..bcc40f4 100644
--- a/lldb/source/Utility/StringExtractorGDBRemote.cpp
+++ b/lldb/source/Utility/StringExtractorGDBRemote.cpp
@@ -223,6 +223,8 @@ StringExtractorGDBRemote::GetServerPacketType() const {
return eServerPacketType_qMemoryRegionInfoSupported;
if (PACKET_STARTS_WITH("qModuleInfo:"))
return eServerPacketType_qModuleInfo;
+ if (PACKET_STARTS_WITH("qMemTags:"))
+ return eServerPacketType_qMemTags;
break;
case 'P':