[lldb][AArch64] Add MTE memory tag reading to lldb
authorDavid Spickett <david.spickett@linaro.org>
Fri, 19 Feb 2021 15:57:29 +0000 (15:57 +0000)
committerDavid Spickett <david.spickett@linaro.org>
Thu, 24 Jun 2021 16:17:10 +0000 (17:17 +0100)
commit5d3436200147a999670f754288a03c4ac5a15aeb
treeda76b9ce3b2c8713516a424623760a42bb7d10b4
parenta224c5199b327ed0efcdcd87b6dbf950cf4d9ee1
[lldb][AArch64] Add MTE memory tag reading to lldb

This adds GDB client support for the qMemTags packet
which reads memory tags. Following the design
which was recently committed to GDB.

https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html#General-Query-Packets
(look for qMemTags)

lldb commands will use the new Process methods
GetMemoryTagManager and ReadMemoryTags.

The former takes a range and checks that:
* The current process architecture has an architecture plugin
* That plugin provides a MemoryTagManager
* That the range of memory requested lies in a tagged range
  (it will expand it to granules for you)

If all that was true you get a MemoryTagManager you
can give to ReadMemoryTags.

This two step process is done to allow commands to get the
tag manager without having to read tags as well. For example
you might just want to remove a logical tag, or error early
if a range with tagged addresses is inverted.

Note that getting a MemoryTagManager doesn't mean that the process
or a specific memory range is tagged. Those are seperate checks.
Having a tag manager just means this architecture *could* have
a tagging feature enabled.

An architecture plugin has been added for AArch64 which
will return a MemoryTagManagerAArch64MTE, which was added in a
previous patch.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D95602
12 files changed:
lldb/include/lldb/Core/Architecture.h
lldb/include/lldb/Target/Process.h
lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp [new file with mode: 0644]
lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h [new file with mode: 0644]
lldb/source/Plugins/Architecture/AArch64/CMakeLists.txt [new file with mode: 0644]
lldb/source/Plugins/Architecture/CMakeLists.txt
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/source/Target/Process.cpp
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp