Skip to content

Commit 4728a4b

Browse files
Merge pull request #7697 from adrian-prantl/cherry-pick-swift-release-5.10-Add-error-logging-when-xcrun-fails-to-find-an-SDK
[Cherry-pick into swift/release/5.10] Add error logging when xcrun fails to find an SDK
2 parents edd1b96 + fde6839 commit 4728a4b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,16 @@ static std::string GetSDKPath(std::string m_description, XcodeSDK sdk) {
17191719
}
17201720

17211721
std::string sdk_path = sdk_path_or_err->str();
1722-
LOG_PRINTF(GetLog(LLDBLog::Types), "Host SDK path: `%s` (XcodeSDK: %s)",
1722+
// GetSDKRoot reports no SDK as an empty string.
1723+
if (sdk_path.empty()) {
1724+
std::string sdk_spec = sdk.GetString().str();
1725+
Debugger::ReportError("LLDB couldn't find an SDK for \"" + sdk_spec + "\".");
1726+
HEALTH_LOG_PRINTF("Could not find an SDK for \"%s\". Try to verify that "
1727+
"\"xcrun --show-sdk-path --sdk %s\" works.",
1728+
sdk_spec.c_str(), sdk_spec.c_str());
1729+
return {};
1730+
}
1731+
LOG_PRINTF(GetLog(LLDBLog::Types), "Host SDK path: \"%s\" (XcodeSDK: %s)",
17231732
sdk_path.c_str(), sdk.GetString().str().c_str());
17241733
return sdk_path;
17251734
}

0 commit comments

Comments
 (0)