jasonmolenda created this revision. jasonmolenda added a reviewer: JDevlieghere. jasonmolenda added a project: LLDB. Herald added subscribers: pengfei, kristof.beyls. Herald added a project: All. jasonmolenda requested review of this revision. Herald added a subscriber: lldb-commits.
PlatformDarwinKernel had an old idiom in its GetSupportedArchitectures method, which would turn the list of supported architectures based on the compile-time debug host. This doesn't make any sense; you can debug an arm kernel from an x86 mac, but it usually didn't cause any obvious problems so it went unnoticed. Fix that. Also some NFC changes to Target::SetArchitecture log messages, to make it easier to track the Target's architecture as it is refined/updated. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D137301 Files: lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/source/Target/Target.cpp Index: lldb/source/Target/Target.cpp =================================================================== --- lldb/source/Target/Target.cpp +++ lldb/source/Target/Target.cpp @@ -1436,7 +1436,8 @@ if (!m_arch.GetSpec().IsValid()) { m_arch = executable_sp->GetArchitecture(); LLDB_LOG(log, - "setting architecture to {0} ({1}) based on executable file", + "Target::SetExecutableModule setting architecture to {0} ({1}) " + "based on executable file", m_arch.GetSpec().GetArchitectureName(), m_arch.GetSpec().GetTriple().getTriple()); } @@ -1536,7 +1537,9 @@ // specified if (replace_local_arch) m_arch = other; - LLDB_LOG(log, "set architecture to {0} ({1})", + LLDB_LOG(log, + "Target::SetArchitecture merging compatible arch; arch " + "is now {0} ({1})", m_arch.GetSpec().GetArchitectureName(), m_arch.GetSpec().GetTriple().getTriple()); return true; @@ -1544,9 +1547,13 @@ // If we have an executable file, try to reset the executable to the desired // architecture - LLDB_LOGF(log, "Target::SetArchitecture changing architecture to %s (%s)", - arch_spec.GetArchitectureName(), - arch_spec.GetTriple().getTriple().c_str()); + LLDB_LOGF( + log, + "Target::SetArchitecture changing architecture to %s (%s) from %s (%s)", + arch_spec.GetArchitectureName(), + arch_spec.GetTriple().getTriple().c_str(), + m_arch.GetSpec().GetArchitectureName(), + m_arch.GetSpec().GetTriple().getTriple().c_str()); m_arch = other; ModuleSP executable_sp = GetExecutableModule(); Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -986,11 +986,8 @@ std::vector<ArchSpec> PlatformDarwinKernel::GetSupportedArchitectures( const ArchSpec &process_host_arch) { std::vector<ArchSpec> result; -#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) ARMGetSupportedArchitectures(result); -#else x86GetSupportedArchitectures(result); -#endif return result; }
Index: lldb/source/Target/Target.cpp =================================================================== --- lldb/source/Target/Target.cpp +++ lldb/source/Target/Target.cpp @@ -1436,7 +1436,8 @@ if (!m_arch.GetSpec().IsValid()) { m_arch = executable_sp->GetArchitecture(); LLDB_LOG(log, - "setting architecture to {0} ({1}) based on executable file", + "Target::SetExecutableModule setting architecture to {0} ({1}) " + "based on executable file", m_arch.GetSpec().GetArchitectureName(), m_arch.GetSpec().GetTriple().getTriple()); } @@ -1536,7 +1537,9 @@ // specified if (replace_local_arch) m_arch = other; - LLDB_LOG(log, "set architecture to {0} ({1})", + LLDB_LOG(log, + "Target::SetArchitecture merging compatible arch; arch " + "is now {0} ({1})", m_arch.GetSpec().GetArchitectureName(), m_arch.GetSpec().GetTriple().getTriple()); return true; @@ -1544,9 +1547,13 @@ // If we have an executable file, try to reset the executable to the desired // architecture - LLDB_LOGF(log, "Target::SetArchitecture changing architecture to %s (%s)", - arch_spec.GetArchitectureName(), - arch_spec.GetTriple().getTriple().c_str()); + LLDB_LOGF( + log, + "Target::SetArchitecture changing architecture to %s (%s) from %s (%s)", + arch_spec.GetArchitectureName(), + arch_spec.GetTriple().getTriple().c_str(), + m_arch.GetSpec().GetArchitectureName(), + m_arch.GetSpec().GetTriple().getTriple().c_str()); m_arch = other; ModuleSP executable_sp = GetExecutableModule(); Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -986,11 +986,8 @@ std::vector<ArchSpec> PlatformDarwinKernel::GetSupportedArchitectures( const ArchSpec &process_host_arch) { std::vector<ArchSpec> result; -#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) ARMGetSupportedArchitectures(result); -#else x86GetSupportedArchitectures(result); -#endif return result; }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits