Author: Adrian Prantl Date: 2024-02-23T15:26:14-08:00 New Revision: 3f91bdfdd50aa4eaf1d3e49cf797220cfeccaf16
URL: https://github.com/llvm/llvm-project/commit/3f91bdfdd50aa4eaf1d3e49cf797220cfeccaf16 DIFF: https://github.com/llvm/llvm-project/commit/3f91bdfdd50aa4eaf1d3e49cf797220cfeccaf16.diff LOG: Revert "Replace ArchSpec::PiecewiseCompare() with Triple::operator==()" This reverts commit 5e6bed8c0ea2f7fe380127763c8f753adae0fc1b while investigating the bots. Added: Modified: lldb/include/lldb/Utility/ArchSpec.h lldb/source/Target/Target.cpp lldb/source/Utility/ArchSpec.cpp Removed: lldb/test/API/macosx/arm64e-attach/Makefile lldb/test/API/macosx/arm64e-attach/TestArm64eAttach.py lldb/test/API/macosx/arm64e-attach/main.c ################################################################################ diff --git a/lldb/include/lldb/Utility/ArchSpec.h b/lldb/include/lldb/Utility/ArchSpec.h index 50830b889b9115..a226a3a5a9b71d 100644 --- a/lldb/include/lldb/Utility/ArchSpec.h +++ b/lldb/include/lldb/Utility/ArchSpec.h @@ -505,6 +505,11 @@ class ArchSpec { bool IsFullySpecifiedTriple() const; + void PiecewiseTripleCompare(const ArchSpec &other, bool &arch_ diff erent, + bool &vendor_ diff erent, bool &os_ diff erent, + bool &os_version_ diff erent, + bool &env_ diff erent) const; + /// Detect whether this architecture uses thumb code exclusively /// /// Some embedded ARM chips (e.g. the ARM Cortex M0-7 line) can only execute diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index e982a30a3ae4ff..e17bfcb5d5e2ad 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -1568,8 +1568,14 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec, bool set_platform, if (m_arch.GetSpec().IsCompatibleMatch(other)) { compatible_local_arch = true; + bool arch_changed, vendor_changed, os_changed, os_ver_changed, + env_changed; - if (m_arch.GetSpec().GetTriple() == other.GetTriple()) + m_arch.GetSpec().PiecewiseTripleCompare(other, arch_changed, + vendor_changed, os_changed, + os_ver_changed, env_changed); + + if (!arch_changed && !vendor_changed && !os_changed && !env_changed) replace_local_arch = false; } } diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp index 07ef435ef451d2..fb0e985a0d5657 100644 --- a/lldb/source/Utility/ArchSpec.cpp +++ b/lldb/source/Utility/ArchSpec.cpp @@ -1421,6 +1421,23 @@ bool ArchSpec::IsFullySpecifiedTriple() const { return true; } +void ArchSpec::PiecewiseTripleCompare( + const ArchSpec &other, bool &arch_ diff erent, bool &vendor_ diff erent, + bool &os_ diff erent, bool &os_version_ diff erent, bool &env_ diff erent) const { + const llvm::Triple &me(GetTriple()); + const llvm::Triple &them(other.GetTriple()); + + arch_ diff erent = (me.getArch() != them.getArch()); + + vendor_ diff erent = (me.getVendor() != them.getVendor()); + + os_ diff erent = (me.getOS() != them.getOS()); + + os_version_ diff erent = (me.getOSMajorVersion() != them.getOSMajorVersion()); + + env_ diff erent = (me.getEnvironment() != them.getEnvironment()); +} + bool ArchSpec::IsAlwaysThumbInstructions() const { std::string Status; if (GetTriple().getArch() == llvm::Triple::arm || diff --git a/lldb/test/API/macosx/arm64e-attach/Makefile b/lldb/test/API/macosx/arm64e-attach/Makefile deleted file mode 100644 index c9319d6e6888a4..00000000000000 --- a/lldb/test/API/macosx/arm64e-attach/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -C_SOURCES := main.c -include Makefile.rules diff --git a/lldb/test/API/macosx/arm64e-attach/TestArm64eAttach.py b/lldb/test/API/macosx/arm64e-attach/TestArm64eAttach.py deleted file mode 100644 index 0dc8700ed02dd8..00000000000000 --- a/lldb/test/API/macosx/arm64e-attach/TestArm64eAttach.py +++ /dev/null @@ -1,28 +0,0 @@ -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestArm64eAttach(TestBase): - NO_DEBUG_INFO_TESTCASE = True - - # On Darwin systems, arch arm64e means ARMv8.3 with ptrauth ABI used. - @skipIf(archs=no_match(["arm64e"])) - def test(self): - # Skip this test if not running on AArch64 target that supports PAC - if not self.isAArch64PAuth(): - self.skipTest("Target must support pointer authentication.") - self.build() - popen = self.spawnSubprocess(self.getBuildArtifact(), []) - error = lldb.SBError() - # This simulates how Xcode attaches to a process by pid/name. - target = self.dbg.CreateTarget("", "arm64", "", True, error) - listener = lldb.SBListener("my.attach.listener") - process = target.AttachToProcessWithID(listener, popen.pid, error) - self.assertSuccess(error) - self.assertTrue(process, PROCESS_IS_VALID) - self.assertEqual(target.GetTriple().split('-')[0], "arm64e", - "target triple is updated correctly") - error = process.Kill() - self.assertSuccess(error) diff --git a/lldb/test/API/macosx/arm64e-attach/main.c b/lldb/test/API/macosx/arm64e-attach/main.c deleted file mode 100644 index 7baf2ffd8f2899..00000000000000 --- a/lldb/test/API/macosx/arm64e-attach/main.c +++ /dev/null @@ -1,2 +0,0 @@ -int getchar(); -int main() { return getchar(); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits