HomePhabricator

[lldb][AArch64] Add MTE memory tag reading to lldb

Authored by DavidSpickett on Feb 19 2021, 7:57 AM.

Description

[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

Details

Committed
DavidSpickettJun 24 2021, 9:17 AM
Reviewer
omjavaid
Differential Revision
D95602: [lldb][AArch64] Add MTE memory tag reading to lldb
Parents
rGa224c5199b32: [LLD][LLVM] CG Graph profile using relocations
Branches
Unknown
Tags
Unknown