[lldb][AArch64/Linux] Show memory tagged memory regions
authorDavid Spickett <david.spickett@linaro.org>
Mon, 17 Aug 2020 14:02:04 +0000 (15:02 +0100)
committerDavid Spickett <david.spickett@linaro.org>
Fri, 20 Nov 2020 11:21:59 +0000 (11:21 +0000)
commit32541685b2a980290c320adb289b56395a88d4c3
treebb0909a6a45e5be0bd31acaf83d35d261eb5d306
parenta86a9b5ef777552d1683e2b9031e2045d39de2f0
[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
21 files changed:
lldb/docs/lldb-gdb-remote.txt
lldb/docs/use/qemu-testing.rst
lldb/include/lldb/Target/MemoryRegionInfo.h
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
lldb/scripts/lldb-test-qemu/run-qemu.sh
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/source/Plugins/Process/Utility/LinuxProcMaps.cpp
lldb/source/Plugins/Process/Utility/LinuxProcMaps.h
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/source/Target/MemoryRegionInfo.cpp
lldb/test/API/linux/aarch64/mte_memory_region/Makefile [new file with mode: 0644]
lldb/test/API/linux/aarch64/mte_memory_region/TestAArch64LinuxMTEMemoryRegion.py [new file with mode: 0644]
lldb/test/API/linux/aarch64/mte_memory_region/main.c [new file with mode: 0644]
lldb/unittests/Process/Utility/CMakeLists.txt
lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp [new file with mode: 0644]
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
lldb/unittests/Process/minidump/MinidumpParserTest.cpp