vsk created this revision.
vsk added reviewers: aprantl, JDevlieghere.
vsk requested review of this revision.
Herald added a project: LLDB.
GetXcodeSDK() consistently takes over 1 second to complete if the
queried SDK is missing, because `xcrun` doesn't cache negative lookups.
Because there are multiple simulator platforms, this can add 4+ seconds
to `lldb -b some_object_file.o`.
To work around this, skip the call to GetXcodeSDK() when setting up
simulator platforms if the specified arch doesn't have what looks like a
simulator triple.
Some other ways to fix this:
- Fix caching in xcrun (rdar://74882205)
- Test for arch compat before calling SomePlatform::CreateInstance() (much
larger change)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D98272
Files:
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
Index: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
@@ -530,6 +530,8 @@
}
static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ if (arch && arch->IsValid() && !arch->TripleEnvironmentWasSpecified())
+ return nullptr; // Avoid very slow xcrun query for non-simulator archs.
llvm::StringRef sdk;
sdk = HostInfo::GetXcodeSDKPath(XcodeSDK("iPhoneSimulator.Internal.sdk"));
if (sdk.empty())
@@ -578,6 +580,8 @@
}
static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ if (arch && arch->IsValid() && !arch->TripleEnvironmentWasSpecified())
+ return nullptr; // Avoid very slow xcrun query for non-simulator archs.
return PlatformAppleSimulator::CreateInstance(
"PlatformAppleTVSimulator", g_tvos_description,
ConstString(g_tvos_plugin_name),
@@ -619,6 +623,8 @@
}
static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ if (arch && arch->IsValid() && !arch->TripleEnvironmentWasSpecified())
+ return nullptr; // Avoid very slow xcrun query for non-simulator archs.
return PlatformAppleSimulator::CreateInstance(
"PlatformAppleWatchSimulator", g_watchos_description,
ConstString(g_watchos_plugin_name),
Index: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
@@ -530,6 +530,8 @@
}
static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ if (arch && arch->IsValid() && !arch->TripleEnvironmentWasSpecified())
+ return nullptr; // Avoid very slow xcrun query for non-simulator archs.
llvm::StringRef sdk;
sdk = HostInfo::GetXcodeSDKPath(XcodeSDK("iPhoneSimulator.Internal.sdk"));
if (sdk.empty())
@@ -578,6 +580,8 @@
}
static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ if (arch && arch->IsValid() && !arch->TripleEnvironmentWasSpecified())
+ return nullptr; // Avoid very slow xcrun query for non-simulator archs.
return PlatformAppleSimulator::CreateInstance(
"PlatformAppleTVSimulator", g_tvos_description,
ConstString(g_tvos_plugin_name),
@@ -619,6 +623,8 @@
}
static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ if (arch && arch->IsValid() && !arch->TripleEnvironmentWasSpecified())
+ return nullptr; // Avoid very slow xcrun query for non-simulator archs.
return PlatformAppleSimulator::CreateInstance(
"PlatformAppleWatchSimulator", g_watchos_description,
ConstString(g_watchos_plugin_name),
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits