Skip to content

Commit fd2065b

Browse files
committed
Have GetSupportedArchitectures report all supported arches
PlatformDarwinKernel::GetSupportedArchitectures returns a list of architectures that are possible for this platform; it was using a compile-time check for the debug host to decide the list of arches that were valid. This was copied from a codepath doing native process debugging, and was clearly wrong for kernel debugging, but it had not happened to cause problems so it went unnoticed for a long time. Small NFC change to the logging messages of Target::SetArchitecture to make them a little more explicit about how the architecture is being modified/replaced. Differential Revision: https://reviews.llvm.org/D137301 rdar://101690111
1 parent 7e133eb commit fd2065b

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -986,11 +986,8 @@ bool PlatformDarwinKernel::LoadPlatformBinaryAndSetup(Process *process,
986986
std::vector<ArchSpec> PlatformDarwinKernel::GetSupportedArchitectures(
987987
const ArchSpec &process_host_arch) {
988988
std::vector<ArchSpec> result;
989-
#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
990989
ARMGetSupportedArchitectures(result);
991-
#else
992990
x86GetSupportedArchitectures(result);
993-
#endif
994991
return result;
995992
}
996993

lldb/source/Target/Target.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,8 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
14361436
if (!m_arch.GetSpec().IsValid()) {
14371437
m_arch = executable_sp->GetArchitecture();
14381438
LLDB_LOG(log,
1439-
"setting architecture to {0} ({1}) based on executable file",
1439+
"Target::SetExecutableModule setting architecture to {0} ({1}) "
1440+
"based on executable file",
14401441
m_arch.GetSpec().GetArchitectureName(),
14411442
m_arch.GetSpec().GetTriple().getTriple());
14421443
}
@@ -1536,17 +1537,23 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec, bool set_platform,
15361537
// specified
15371538
if (replace_local_arch)
15381539
m_arch = other;
1539-
LLDB_LOG(log, "set architecture to {0} ({1})",
1540+
LLDB_LOG(log,
1541+
"Target::SetArchitecture merging compatible arch; arch "
1542+
"is now {0} ({1})",
15401543
m_arch.GetSpec().GetArchitectureName(),
15411544
m_arch.GetSpec().GetTriple().getTriple());
15421545
return true;
15431546
}
15441547

15451548
// If we have an executable file, try to reset the executable to the desired
15461549
// architecture
1547-
LLDB_LOGF(log, "Target::SetArchitecture changing architecture to %s (%s)",
1548-
arch_spec.GetArchitectureName(),
1549-
arch_spec.GetTriple().getTriple().c_str());
1550+
LLDB_LOGF(
1551+
log,
1552+
"Target::SetArchitecture changing architecture to %s (%s) from %s (%s)",
1553+
arch_spec.GetArchitectureName(),
1554+
arch_spec.GetTriple().getTriple().c_str(),
1555+
m_arch.GetSpec().GetArchitectureName(),
1556+
m_arch.GetSpec().GetTriple().getTriple().c_str());
15501557
m_arch = other;
15511558
ModuleSP executable_sp = GetExecutableModule();
15521559

0 commit comments

Comments
 (0)