Skip to content

Commit 682c94b

Browse files
committed
[lldb][Module] Only log SDK search error once per debugger session (llvm#171820)
Currently if we are debugging an app that was compiled against an SDK that we don't know about on the host, then every time we evaluate an expression we get following spam on the console: ``` error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> error: Error while searching for Xcode SDK: Unrecognized SDK type: <some SDK> ``` It is not a fatal error but the way we spam it pretty much ruins the debugging experience. This patch makes it so we only log this error once per debugger session. Not sure how to best test it since we'd need to build a program with a particular SDK and then make it unrecognized by LLDB. Confirmed manually that the error only gets reported once after this patch. (cherry picked from commit 1b7f272)
1 parent 8eb6025 commit 682c94b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lldb/source/Core/Module.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,9 @@ void Module::RegisterXcodeSDK(llvm::StringRef sdk_name,
17061706

17071707
if (!sdk_path_or_err) {
17081708
Debugger::ReportError("Error while searching for Xcode SDK: " +
1709-
toString(sdk_path_or_err.takeError()));
1709+
toString(sdk_path_or_err.takeError()),
1710+
/*debugger_id=*/std::nullopt,
1711+
GetDiagnosticOnceFlag(sdk_name));
17101712
return;
17111713
}
17121714

0 commit comments

Comments
 (0)