This commit adds a new command "memory tag read".adds GDB client support for the qMemTags packet
It looks much like "which reads memory read" and mirrors its basictags. Following GDB's design,
(lldb) memory tag read new_buf_ptr new_buf_ptr+32
Logical tag: 0x9
[0x900fffff7ffa000, 0x900fffff7ffa010): 0x9
[0x900fffff7ffa010, 0x900fffff7ffa020): 0x0
(end address is optional and we default to reading 1 tag if it is omitted)
This makes use of the MemoryTagHandler previously added.
In lldb the tag handler can be accessed as a sub plugin ofwhich is currently under review.
the architecture plugin.(https://sourceware.org/pipermail/gdb-patches/2021-January/175514.html)
Meaning, to use this command you must have a specific architecture plugin
and that plugin must give you a valid tag handler. Otherwise memorylldb commands will use the new Process methods
tagging is not supportedGetMemoryTagManager and ReadMemoryTags.
During transport tags are packed in target specific ways soThe former takes a range and checks that:
lldb uses the handler to unpack those into individual tags.* The current process architecture has an architecture plugin
For MTE ptrace already gives us one tag per byte so this is trivial.* That plugin provides a MemoryTagManager
(but you could imagine a situation where you get 2 4 bit tags* That the range of memory requested lies in a tagged range
per byte (it will expand hadit to split them up in lldbgranules for you)
In addition to getting a tag handler lldb will check thatIf all that was true you get a MemoryTagManager you
the mcan give to ReadMemory range asked forTags.
This two step process is tagged. It does this by lookingdone to allow commands to get the
for the "mt" flag on the containing memory region.tag manager without having to read tags as well. For example
(this lookup is done with untagged addresses and theyou might just want to remove a logical tag, or error early
range is aligned to the effective range we need to read)if a range with tagged addresses is inverted.
Target specific tests have been added to test/API/linux/aarch64/Note that getting a MemoryTagManager doesn't mean that the process
and a test for targets that do not support memory tagging inor a specific memory range is tagged. Those are seperate checks.
The reason to split these is that the target specific test programHaving a tag manager just means this architecture *could* have
needs a specific toolchain, compiler arguments and includes.a tagging feature enabled.
An architecture plugin has been added for AArch64 which
It is not possible to write it in such a way that it can be used forwill return a MemoryTagManagerAArch64MTE, which was added in a
all the testsprevious patch.