Skip to content

Commit 1b7f272

Browse files
authored
[lldb][Module] Only log SDK search error once per debugger session (#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.
1 parent c814ac1 commit 1b7f272

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
@@ -1569,7 +1569,9 @@ void Module::RegisterXcodeSDK(llvm::StringRef sdk_name,
15691569

15701570
if (!sdk_path_or_err) {
15711571
Debugger::ReportError("Error while searching for Xcode SDK: " +
1572-
toString(sdk_path_or_err.takeError()));
1572+
toString(sdk_path_or_err.takeError()),
1573+
/*debugger_id=*/std::nullopt,
1574+
GetDiagnosticOnceFlag(sdk_name));
15731575
return;
15741576
}
15751577

0 commit comments

Comments
 (0)