[Lldb-commits] [lldb] [lldb] Improve error message in ResolveSDKPathFromDebugInfo (NFC) (PR #154607)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 20 13:33:01 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Dave Lee (kastiglione)
<details>
<summary>Changes</summary>
While debugging, I saw a log line of:
> Failed to resolve SDK path: Error while searching for SDK (XcodeSDK ''): Unrecognized SDK type:
Looking into how this might happen, it seems `ResolveSDKPathFromDebugInfo` appears to
(implicitly) assume there's at least one compile unit. This change adds a precondition
to return a meaningful error when there are no compile units.
---
Full diff: https://github.com/llvm/llvm-project/pull/154607.diff
1 Files Affected:
- (modified) lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (+6-1)
``````````diff
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 1db7bc78013d7..dc8b9437a64e4 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -1039,7 +1039,12 @@ ResolveSDKPathFromDebugInfo(lldb_private::Target *target) {
SymbolFile *sym_file = exe_module_sp->GetSymbolFile();
if (!sym_file)
- return llvm::createStringError("Failed to get symbol file from module");
+ return llvm::createStringError("Failed to get symbol file from executable");
+
+ if (sym_file->GetNumCompileUnits() == 0)
+ return llvm::createStringError(
+ "Failed to resolve SDK for target: executable's symbol file has no "
+ "compile units");
XcodeSDK merged_sdk;
for (unsigned i = 0; i < sym_file->GetNumCompileUnits(); ++i) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/154607
More information about the lldb-commits
mailing list