aboutsummaryrefslogtreecommitdiff
path: root/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2020-08-17 15:02:04 +0100
committerDavid Spickett <david.spickett@linaro.org>2020-11-20 11:21:59 +0000
commit32541685b2a980290c320adb289b56395a88d4c3 (patch)
treebb0909a6a45e5be0bd31acaf83d35d261eb5d306 /lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
parenta86a9b5ef777552d1683e2b9031e2045d39de2f0 (diff)
downloadllvm-32541685b2a980290c320adb289b56395a88d4c3.zip
llvm-32541685b2a980290c320adb289b56395a88d4c3.tar.gz
llvm-32541685b2a980290c320adb289b56395a88d4c3.tar.bz2
[lldb][AArch64/Linux] Show memory tagged memory regions
This extends the "memory region" command to show tagged regions on AArch64 Linux when the MTE extension is enabled. (lldb) memory region the_page [0x0000fffff7ff8000-0x0000fffff7ff9000) rw- memory tagging: enabled This is done by adding an optional "flags" field to the qMemoryRegion packet. The only supported flag is "mt" but this can be extended. This "mt" flag is read from /proc/{pid}/smaps on Linux, other platforms will leave out the "flags" field. Where this "mt" flag is received "memory region" will show that it is enabled. If it is not or the target doesn't support memory tagging, the line is not shown. (since majority of the time tagging will not be enabled) Testing is added for the existing /proc/{pid}/maps parsing and the new smaps parsing. Minidump parsing has been updated where needed, though it only uses maps not smaps. Target specific tests can be run with QEMU and I have added MTE flags to the existing helper scripts. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D87442
Diffstat (limited to 'lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp')
-rw-r--r--lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index adfead6..2cca197 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -343,6 +343,25 @@ TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfo) {
EXPECT_EQ(MemoryRegionInfo::eNo, region_info.GetWritable());
EXPECT_EQ(MemoryRegionInfo::eYes, region_info.GetExecutable());
EXPECT_EQ("/foo/bar.so", region_info.GetName().GetStringRef());
+ EXPECT_EQ(MemoryRegionInfo::eDontKnow, region_info.GetMemoryTagged());
+
+ result = std::async(std::launch::async, [&] {
+ return client.GetMemoryRegionInfo(addr, region_info);
+ });
+
+ HandlePacket(server, "qMemoryRegionInfo:a000",
+ "start:a000;size:2000;flags:;");
+ EXPECT_TRUE(result.get().Success());
+ EXPECT_EQ(MemoryRegionInfo::eNo, region_info.GetMemoryTagged());
+
+ result = std::async(std::launch::async, [&] {
+ return client.GetMemoryRegionInfo(addr, region_info);
+ });
+
+ HandlePacket(server, "qMemoryRegionInfo:a000",
+ "start:a000;size:2000;flags: mt zz mt ;");
+ EXPECT_TRUE(result.get().Success());
+ EXPECT_EQ(MemoryRegionInfo::eYes, region_info.GetMemoryTagged());
}
TEST_F(GDBRemoteCommunicationClientTest, GetMemoryRegionInfoInvalidResponse) {