[Lldb-commits] [PATCH] D95602: [lldb][AArch64] Add MTE memory tag reading for lldb
David Spickett via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jan 28 01:45:50 PST 2021
DavidSpickett created this revision.
Herald added subscribers: danielkiss, kristof.beyls, mgorny.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
This commit adds a new command "memory tag read".
It looks much like "memory read" and mirrors its basic
behaviour.
(lldb) memory tag read new_buf_ptr new_buf_ptr+32
Logical tag: 0x9
Allocation tags:
[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 of
the architecture plugin.
Meaning, to use this command you must have a specific architecture plugin
and that plugin must give you a valid tag handler. Otherwise memory
tagging is not supported.
During transport tags are packed in target specific ways so
lldb uses the handler to unpack those into individual tags.
For MTE ptrace already gives us one tag per byte so this is trivial.
(but you could imagine a situation where you get 2 4 bit tags
per byte and had to split them up in lldb)
In addition to getting a tag handler lldb will check that
the memory range asked for is tagged. It does this by looking
for the "mt" flag on the containing memory region.
(this lookup is done with untagged addresses and the
range is aligned to the effective range we need to read)
Target specific tests have been added to test/API/linux/aarch64/
and a test for targets that do not support memory tagging in
test/API/functionalities/memory/tag/.
The reason to split these is that the target specific test program
needs a specific toolchain, compiler arguments and includes.
It is not possible to write it in such a way that it can be used for
all the tests.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D95602
Files:
lldb/include/lldb/Core/Architecture.h
lldb/include/lldb/Target/MemoryTagHandler.h
lldb/include/lldb/Target/Process.h
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/source/Commands/CMakeLists.txt
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Commands/CommandObjectMemoryTag.cpp
lldb/source/Commands/CommandObjectMemoryTag.h
lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.cpp
lldb/source/Plugins/Architecture/AArch64/ArchitectureAArch64.h
lldb/source/Plugins/Architecture/AArch64/CMakeLists.txt
lldb/source/Plugins/Architecture/CMakeLists.txt
lldb/source/Plugins/Process/Utility/MemoryTagHandlerAArch64MTE.cpp
lldb/source/Plugins/Process/Utility/MemoryTagHandlerAArch64MTE.h
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/test/API/functionalities/memory/tag/Makefile
lldb/test/API/functionalities/memory/tag/TestMemoryTag.py
lldb/test/API/functionalities/memory/tag/main.cpp
lldb/test/API/linux/aarch64/mte_tag_read/Makefile
lldb/test/API/linux/aarch64/mte_tag_read/TestAArch64LinuxMTEMemoryTagRead.py
lldb/test/API/linux/aarch64/mte_tag_read/main.c
lldb/unittests/Process/Utility/MemoryTagHandlerAArch64MTETest.cpp
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95602.319792.patch
Type: text/x-patch
Size: 49713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210128/ae048e24/attachment-0001.bin>
More information about the lldb-commits
mailing list