DavidSpickett created this revision. Herald added a subscriber: kristof.beyls. DavidSpickett requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
This better describes the intent of the method. Which for AArch64 is removing the top byte which includes the memory tags. It does not include pointer signatures, for those we need to use the ABI plugin. The rename makes this a little more clear. It's a bit awkward that the memory tag manager is removing the whole top byte not just the memory tags but it's an improvement for now. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D117671 Files: lldb/include/lldb/Target/MemoryTagManager.h lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.h lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
Index: lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp =================================================================== --- lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp +++ lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp @@ -247,16 +247,17 @@ ASSERT_EQ(*got, expected_range); } -TEST(MemoryTagManagerAArch64MTETest, RemoveNonAddressBits) { +TEST(MemoryTagManagerAArch64MTETest, RemoveTagBits) { MemoryTagManagerAArch64MTE manager; ASSERT_EQ(0, 0); + // Removes the whole top byte ASSERT_EQ((lldb::addr_t)0x00ffeedd11223344, - manager.RemoveNonAddressBits(0x00ffeedd11223344)); + manager.RemoveTagBits(0x00ffeedd11223344)); ASSERT_EQ((lldb::addr_t)0x0000000000000000, - manager.RemoveNonAddressBits(0xFF00000000000000)); + manager.RemoveTagBits(0xff00000000000000)); ASSERT_EQ((lldb::addr_t)0x0055555566666666, - manager.RemoveNonAddressBits(0xee55555566666666)); + manager.RemoveTagBits(0xee55555566666666)); } TEST(MemoryTagManagerAArch64MTETest, AddressDiff) { Index: lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.h =================================================================== --- lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.h +++ lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.h @@ -27,7 +27,7 @@ size_t GetTagSizeInBytes() const override; lldb::addr_t GetLogicalTag(lldb::addr_t addr) const override; - lldb::addr_t RemoveNonAddressBits(lldb::addr_t addr) const override; + lldb::addr_t RemoveTagBits(lldb::addr_t addr) const override; ptrdiff_t AddressDiff(lldb::addr_t addr1, lldb::addr_t addr2) const override; TagRange ExpandToGranule(TagRange range) const override; Index: lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp =================================================================== --- lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp +++ lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp @@ -20,7 +20,7 @@ } lldb::addr_t -MemoryTagManagerAArch64MTE::RemoveNonAddressBits(lldb::addr_t addr) const { +MemoryTagManagerAArch64MTE::RemoveTagBits(lldb::addr_t addr) const { // Here we're ignoring the whole top byte. If you've got MTE // you must also have TBI (top byte ignore). // The other 4 bits could contain other extension bits or @@ -30,7 +30,7 @@ ptrdiff_t MemoryTagManagerAArch64MTE::AddressDiff(lldb::addr_t addr1, lldb::addr_t addr2) const { - return RemoveNonAddressBits(addr1) - RemoveNonAddressBits(addr2); + return RemoveTagBits(addr1) - RemoveTagBits(addr2); } lldb::addr_t MemoryTagManagerAArch64MTE::GetGranuleSize() const { @@ -84,7 +84,7 @@ // Region addresses will not have memory tags. So when searching // we must use an untagged address. - MemoryRegionInfo::RangeType tag_range(RemoveNonAddressBits(addr), len); + MemoryRegionInfo::RangeType tag_range(RemoveTagBits(addr), len); tag_range = ExpandToGranule(tag_range); // Make a copy so we can use the original for errors and the final return. Index: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp =================================================================== --- lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -1365,10 +1365,9 @@ // lldb will align the range it requests but it is not required to by // the protocol so we'll do it again just in case. - // Remove non address bits too. Ptrace calls may work regardless but that + // Remove tag bits too. Ptrace calls may work regardless but that // is not a guarantee. - MemoryTagManager::TagRange range(details->manager->RemoveNonAddressBits(addr), - len); + MemoryTagManager::TagRange range(details->manager->RemoveTagBits(addr), len); range = details->manager->ExpandToGranule(range); // Allocate enough space for all tags to be read @@ -1420,10 +1419,9 @@ // lldb will align the range it requests but it is not required to by // the protocol so we'll do it again just in case. - // Remove non address bits too. Ptrace calls may work regardless but that + // Remove tag bits too. Ptrace calls may work regardless but that // is not a guarantee. - MemoryTagManager::TagRange range(details->manager->RemoveNonAddressBits(addr), - len); + MemoryTagManager::TagRange range(details->manager->RemoveTagBits(addr), len); range = details->manager->ExpandToGranule(range); // Not checking number of tags here, we may repeat them below Index: lldb/include/lldb/Target/MemoryTagManager.h =================================================================== --- lldb/include/lldb/Target/MemoryTagManager.h +++ lldb/include/lldb/Target/MemoryTagManager.h @@ -35,8 +35,8 @@ // you get will have been shifted down 56 before being returned. virtual lldb::addr_t GetLogicalTag(lldb::addr_t addr) const = 0; - // Remove non address bits from a pointer - virtual lldb::addr_t RemoveNonAddressBits(lldb::addr_t addr) const = 0; + // Remove tag bits from a pointer + virtual lldb::addr_t RemoveTagBits(lldb::addr_t addr) const = 0; // Return the difference between two addresses, ignoring any logical tags they // have. If your tags are just part of a larger set of ignored bits, this
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits