diff --git a/lldb/include/lldb/Target/MemoryTagManager.h b/lldb/include/lldb/Target/MemoryTagManager.h --- a/lldb/include/lldb/Target/MemoryTagManager.h +++ b/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 diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/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 diff --git a/lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.h b/lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.h --- a/lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.h +++ b/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; diff --git a/lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp b/lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp --- a/lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp +++ b/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. diff --git a/lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp b/lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp --- a/lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp +++ b/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) {