Index: lldb/trunk/include/lldb/Core/ArchSpec.h =================================================================== --- lldb/trunk/include/lldb/Core/ArchSpec.h +++ lldb/trunk/include/lldb/Core/ArchSpec.h @@ -625,6 +625,7 @@ protected: bool IsEqualTo(const ArchSpec &rhs, bool exact_match) const; + void UpdateCore(); llvm::Triple m_triple; Core m_core = kCore_invalid; Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py @@ -39,7 +39,6 @@ super(LinuxCoreTestCase, self).tearDown() @skipIf(oslist=['windows']) - @skipIfDarwin # , fails started happening with r299199 @skipIf(triple='^mips') def test_i386(self): """Test that lldb can read the process information from an i386 linux core file.""" @@ -58,21 +57,18 @@ self.do_test("linux-mips64el-gnuabi64", self._mips64_n64_pid, self._mips_regions) @skipIf(oslist=['windows']) - @skipIfDarwin # , fails started happening with r299199 @skipIf(triple='^mips') def test_x86_64(self): """Test that lldb can read the process information from an x86_64 linux core file.""" self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions) @skipIf(oslist=['windows']) - @skipIfDarwin # , fails started happening with r299199 @skipIf(triple='^mips') def test_s390x(self): """Test that lldb can read the process information from an s390x linux core file.""" self.do_test("linux-s390x", self._s390x_pid, self._s390x_regions) @skipIf(oslist=['windows']) - @skipIfDarwin # , fails started happening with r299199 @skipIf(triple='^mips') def test_same_pid_running(self): """Test that we read the information from the core correctly even if we have a running @@ -102,7 +98,6 @@ self.RemoveTempFile("linux-x86_64-pid.core") @skipIf(oslist=['windows']) - @skipIfDarwin # , fails started happening with r299199 @skipIf(triple='^mips') def test_two_cores_same_pid(self): """Test that we handle the situation if we have two core files with the same PID @@ -132,7 +127,6 @@ self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions) @skipIf(oslist=['windows']) - @skipIfDarwin # , fails started happening with r299199 @skipIf(triple='^mips') def test_FPR_SSE(self): # check x86_64 core file Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py @@ -23,14 +23,12 @@ _x86_64_pid = 5669 @skipIf(oslist=['windows']) - @skipIfDarwin # , fails started happening with r299199 @skipIf(triple='^mips') def test_i386(self): """Test that lldb can read the process information from an i386 linux core file.""" self.do_test("linux-i386", self._i386_pid) @skipIf(oslist=['windows']) - @skipIfDarwin # , fails started happening with r299199 @skipIf(triple='^mips') def test_x86_64(self): """Test that lldb can read the process information from an x86_64 linux core file.""" Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py @@ -27,14 +27,12 @@ _x86_64_tid = 5250 @skipIf(oslist=['windows']) - @skipIfDarwin # , fails started happening with r299199 @skipIf(triple='^mips') def test_i386(self): """Test that lldb can read the process information from an i386 linux core file.""" self.do_test("linux-i386", self._i386_pid, self._i386_tid) @skipIf(oslist=['windows']) - @skipIfDarwin # , fails started happening with r299199 @skipIf(triple='^mips') def test_x86_64(self): """Test that lldb can read the process information from an x86_64 linux core file.""" Index: lldb/trunk/source/Core/ArchSpec.cpp =================================================================== --- lldb/trunk/source/Core/ArchSpec.cpp +++ lldb/trunk/source/Core/ArchSpec.cpp @@ -834,19 +834,7 @@ bool ArchSpec::SetTriple(const llvm::Triple &triple) { m_triple = triple; - - llvm::StringRef arch_name(m_triple.getArchName()); - const CoreDefinition *core_def = FindCoreDefinition(arch_name); - if (core_def) { - m_core = core_def->core; - // Set the byte order to the default byte order for an architecture. - // This can be modified if needed for cases when cores handle both - // big and little endian - m_byte_order = core_def->default_byte_order; - } else { - Clear(); - } - + UpdateCore(); return IsValid(); } @@ -994,8 +982,10 @@ GetTriple().setVendor(other.GetTriple().getVendor()); if (TripleOSIsUnspecifiedUnknown() && !other.TripleOSIsUnspecifiedUnknown()) GetTriple().setOS(other.GetTriple().getOS()); - if (GetTriple().getArch() == llvm::Triple::UnknownArch) + if (GetTriple().getArch() == llvm::Triple::UnknownArch) { GetTriple().setArch(other.GetTriple().getArch()); + UpdateCore(); + } if (GetTriple().getEnvironment() == llvm::Triple::UnknownEnvironment && !TripleVendorWasSpecified()) { if (other.TripleVendorWasSpecified()) @@ -1190,6 +1180,20 @@ return false; } +void ArchSpec::UpdateCore() { + llvm::StringRef arch_name(m_triple.getArchName()); + const CoreDefinition *core_def = FindCoreDefinition(arch_name); + if (core_def) { + m_core = core_def->core; + // Set the byte order to the default byte order for an architecture. + // This can be modified if needed for cases when cores handle both + // big and little endian + m_byte_order = core_def->default_byte_order; + } else { + Clear(); + } +} + //===----------------------------------------------------------------------===// // Helper methods. Index: lldb/trunk/unittests/Core/ArchSpecTest.cpp =================================================================== --- lldb/trunk/unittests/Core/ArchSpecTest.cpp +++ lldb/trunk/unittests/Core/ArchSpecTest.cpp @@ -134,3 +134,22 @@ AS = ArchSpec(); EXPECT_FALSE(AS.SetTriple("")); } + +TEST(ArchSpecTest, MergeFrom) { + ArchSpec A; + ArchSpec B("x86_64-pc-linux"); + + EXPECT_FALSE(A.IsValid()); + ASSERT_TRUE(B.IsValid()); + EXPECT_EQ(llvm::Triple::ArchType::x86_64, B.GetTriple().getArch()); + EXPECT_EQ(llvm::Triple::VendorType::PC, B.GetTriple().getVendor()); + EXPECT_EQ(llvm::Triple::OSType::Linux, B.GetTriple().getOS()); + EXPECT_EQ(ArchSpec::eCore_x86_64_x86_64, B.GetCore()); + + A.MergeFrom(B); + ASSERT_TRUE(A.IsValid()); + EXPECT_EQ(llvm::Triple::ArchType::x86_64, A.GetTriple().getArch()); + EXPECT_EQ(llvm::Triple::VendorType::PC, A.GetTriple().getVendor()); + EXPECT_EQ(llvm::Triple::OSType::Linux, A.GetTriple().getOS()); + EXPECT_EQ(ArchSpec::eCore_x86_64_x86_64, A.GetCore()); +}