[lldb] Use symbol context module to determine SDK as fallback when creating SwiftASTContext - #13918
Open
kastiglione wants to merge 3 commits into
Conversation
Author
|
@swift-ci test |
1 similar comment
Author
|
@swift-ci test |
| // module. This avoids silently defaulting to the public SDK, which can | ||
| // cause problems when when debugging a binary that uses an internal SDK. | ||
| if (auto sdk_or_err = | ||
| platform_sp->GetSDKPathFromDebugInfo(*exe_module_sp)) { |
There was a problem hiding this comment.
instead of picking the executable module, would getting the module from sc and feeding that into GetSDKPathFromDebugInfo() also work? That should be safer in a heterogeneous app (think of an app where the executable is arm64-apple-ios-macabi but the dylib the breakpoint is in is arm64-apple-macos.
Author
|
@swift-ci test |
augusto2112
approved these changes
Aug 18, 2026
Author
|
@swift-ci test |
adrian-prantl
approved these changes
Aug 18, 2026
| LOG_PRINTF(GetLog(LLDBLog::Types), "Using precise SDK: %s", | ||
| sdk->GetString().str().c_str()); | ||
| } | ||
| } else if (module_sp) { |
There was a problem hiding this comment.
We might still want to fallback to the executable if module_sp is not available.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When creating a SwiftASTContext, use the SDK of the module from the symbol context, as fallback when there is no compile unit. This can avoid a case where the default SDK is incorrect.
rdar://184747912