summaryrefslogtreecommitdiff
path: root/lldb/source/Utility/XcodeSDK.cpp
AgeCommit message (Collapse)Author
2025-10-15[lldb] Correct bridgeOS -> BridgeOS spelling (#163479)Jonas Devlieghere
The BridgeOS SDK is capitalized, but previously failed to parse because we were looking for bridgeOS. This PR updates the enum value and the canonical spelling. rdar://162641896
2025-08-21[lldb] Remove unused XcodeSDK::SupportsSwift (NFC) (#154572)Dave Lee
2025-08-04[lldb][darwin] force BuiltinHeadersInSystemModules to be always false (#151535)Charles Zablit
This is a re-landing of https://github.com/llvm/llvm-project/pull/144913, which was reverted because of tests failing on Darwin. The bots were failing because the x64 bots run the macOS 14.0 SDKs whereas we assumed all the bots were running the macOS 15.0+ SDKs. To address this, we deactivated the failing tests on SDKs that are older than 15.0 in https://github.com/llvm/llvm-project/pull/147768. Now that this is merged, we can re-land https://github.com/llvm/llvm-project/pull/144913.
2025-06-26[lldb][Darwin] revert change to lang_opts.BuiltinHeadersInSystemModules ↵Charles Zablit
(#145864) Revert the changes made in the following PRs as they are causing bot failures: - https://github.com/llvm/llvm-project/pull/145744 - https://github.com/llvm/llvm-project/pull/144913
2025-06-25[lldb][darwin] force BuiltinHeadersInSystemModules to be always false (#144913)Charles Zablit
`SDKSupportsBuiltinModules` always returns true on newer versions of Darwin based OS. The only way for this call to return `false` would be to have a version mismatch between lldb and the SDK (recent lldb manually installed on macOS 14 for instance). This patch removes this check and hardcodes the value of `BuiltinHeadersInSystemModules` to `false`.
2025-03-11[lldb][XcodeSDK] Simplify logic that adjusts sysroot during XcodeSDK merging ↵Michael Buch
(#130640) The `DW_AT_APPLE_sdk` should always be equal to the filename of the `DW_AT_LLVM_sysroot`. We can use this property to simplify `XcodeSDK::Merge` to no longer manually adjust the sysroot filename. Instead we simply update the sysroot filename with merged SDK name. This should be an NFC change.
2025-03-04Reland "[lldb][HostInfoMacOSX] Try to use DW_AT_LLVM_sysroot instead of ↵Michael Buch
xcrun when looking up SDK" (#129621)" This reverts commit 6041c745f32e8fd60ed24e29e7d919d8d1c87ca6. Relands the original patch with the test-case data fixed. Weirldy the PR CI didn't seem to run the unit-tests? In any case, the problem was an incorrect expectation in the test-case data. Since we have both public and internal SDK in that test-case, we should `expect_mismatch` to be `true`.
2025-03-03Revert "[lldb][HostInfoMacOSX] Try to use DW_AT_LLVM_sysroot instead of ↵Augusto Noronha
xcrun when looking up SDK" (#129621) Reverts llvm/llvm-project#128712 ``` ******************** TEST 'lldb-unit :: SymbolFile/DWARF/./SymbolFileDWARFTests/10/14' FAILED ******************** Script(shard): -- GTEST_OUTPUT=json:/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/tools/lldb/unittests/SymbolFile/DWARF/./SymbolFileDWARFTests-lldb-unit-1021-10-14.json GTEST_SHUFFLE=1 GTEST_TOTAL_SHARDS=14 GTEST_SHARD_INDEX=10 GTEST_RANDOM_SEED=62233 /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/tools/lldb/unittests/SymbolFile/DWARF/./SymbolFileDWARFTests -- Script: -- /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/tools/lldb/unittests/SymbolFile/DWARF/./SymbolFileDWARFTests --gtest_filter=SDKPathParsingTests/SDKPathParsingMultiparamTests.TestSDKPathFromDebugInfo/6 -- /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp:265: Failure Expected equality of these values: found_mismatch Which is: true expect_mismatch Which is: false /Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp:265 Expected equality of these values: found_mismatch Which is: true expect_mismatch Which is: false ```
2025-03-03[lldb][HostInfoMacOSX] Try to use DW_AT_LLVM_sysroot instead of xcrun when ↵Michael Buch
looking up SDK (#128712) `GetSDKRoot` uses `xcrun` to find an SDK root path for a given SDK version string. But if the SDK doesn't exist in the Xcode installations, but instead lives in the `CommandLineTools`, `xcrun` will fail to find it. Negative searches for an SDK path cost a lot (a few seconds) each time `xcrun` is invoked. We do cache negative results in `find_cached_path` inside LLDB, but we would still pay the price on every new debug session the first time we evaluate an expression. This doesn't only cause a noticable delay in running the expression, but also generates following error: ``` error: Error while searching for Xcode SDK: timed out waiting for shell command to complete (int) $0 = 42 ``` In this patch we avoid these possibly expensive calls to `xcrun` by checking the `DW_AT_LLVM_sysroot`, and if it exists, using that as the SDK path. We need an explicit check for the `CommandLineTools` path before we call `RegisterXcodeSDK`, because that will try to call `xcrun`. This won't prevent other uses of `GetSDKRoot` popping up that cause us to make expensive `xcrun` calls, but for now this addresses the regression in the expression evaluator. We also had to adjust the `XcodeSDK::Merge` logic to update the sysroot. There is one case for which this wouldn't make sense: if a CU was compiled with `CommandLineTools` and a different one with an older internal SDK, in that case we would update the `CommandLineTools` sysroot with a `.Internal.sdk` prefix, which won't possibly exist for `CommandLineTools`. I added a unit-test for this. Not sure if we want to explicitly detect and disallow this, given it's quite a niche scenario. rdar://113619904 rdar://113619723
2024-08-09Reland "[lldb][ClangExpressionParser] Set BuiltinHeadersInSystemModules ↵Michael Buch
depending on SDK version (#102309)" (#102497) Depends on https://github.com/llvm/llvm-project/pull/102488 This reverts commit https://github.com/llvm/llvm-project/commit/cf56e265e4b74799aee72a04b634fcc261078084. The original change was reverted because it was causing linker failures in the unit-tests: ``` Undefined symbols for architecture arm64: "lldb_private::PlatformDarwin::GetSDKPathFromDebugInfo(lldb_private::Module&)", referenced from: lldb_private::ClangExpressionParser::ClangExpressionParser(lldb_private::ExecutionContextScope*, lldb_private::Expression&, bool, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>) in liblldbPluginExpressionParserClang.a[11](ClangExpressionParser.cpp.o) ld: symbol(s) not found for architecture arm64 c++: error: linker command failed with exit code 1 (use -v to see invocation) ``` The relanded version differs only in the fact that we now use the generic `Platform` abstraction to get to `GetSDKPathFromDebugInfo`.
2024-08-07Revert "[lldb][ClangExpressionParser] Set BuiltinHeadersInSystemModules ↵Jason Molenda
depending on SDK version (#102309)" This reverts commit 1cbcf74083e92021472ec9644b88418f377ce550. unittests do not build because liblldbPluginExpressionParserClang.a now depends on liblldbPluginPlatformMacOSX.a when built on macOS, reverting until we can straighten out the dependency.
2024-08-07[lldb][ClangExpressionParser] Set BuiltinHeadersInSystemModules depending on ↵Michael Buch
SDK version (#102309) This patch changes the way we initialize `BuiltinHeadersInSystemModules` which is one of the flags controlling Clang's behaviour when the Darwin module is split into more fine-grained modules. The ClangExpressionParser currently unconditionally sets `-fbuiltin-headers-in-system-modules` when evaluating expressions with the `target.import-std-module` setting. This flag should, however, be set depending on the SDK version (which is what the Clang Darwin toolchain does). Unfortunately, the compiler instance that we create with `ClangExpressionParser` never consults the Clang driver, and thus doesn't correctly infer `BuiltinHeadersInSystemModules`. Note, this isn't an issue with the `CompilerInstance` that the `ClangModulesDeclVendor` creates because it uses the `createInovcation` API, which calls into `Darwin::addClangTargetOptions`. This patch mimicks how `sdkSupportsBuiltinModules` is used in `Darwin::addClangTargetOptions`. This ensures that the `import-std-module` API tests run cleanly regardless of SDK version. The plan is to eventually make the `CompilerInstance` construction in `ClangExpressionParser` go through the driver, so we can avoid duplicating the logic in LLDB. But we aren't there yet. **Implementation** * We look for the `SDKSettings.json` in the sysroot directory that we found in DWARF (via `DW_AT_LLVM_sysroot`) * Then parse this file and extract the SDK version number out of it * Then mimick `sdkSupportsBuiltinModules` from `Toolchains/Darwin.cpp` and set `BuiltinHeadersInSystemModules` based on it rdar://116490281
2024-01-17[lldb] Upstream xros support in lldb (#78389)Jonas Devlieghere
Upstream support for debugging xros applications through LLDB.
2023-12-16[lldb] Use StringRef::{starts,ends}_with (NFC)Kazu Hirata
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. I'm planning to deprecate and eventually remove StringRef::{starts,ends}with.
2023-10-04[lldb] Mark operator== const to avoid ambiguity in C++20. (#68224)Samira Bazuzi
C++20 will automatically generate an operator== with reversed operand order, which is ambiguous with the written operator== when one argument is marked const and the other isn't. These operators currently trigger -Wambiguous-reversed-operator at usage sites lldb/source/Symbol/SymbolFileOnDemand.cpp:68 and lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp:1286.
2023-05-02[lldb] Remove FileSpec::GetLastPathComponentAlex Langford
As far as I can tell, this just computes the filename of the FileSpec, which is already conveniently stored in m_filename. We can use FileSpec::GetFilename() instead. Differential Revision: https://reviews.llvm.org/D149663
2023-02-07[NFC][TargetParser] Remove llvm/ADT/Triple.hArchibald Elliott
I also ran `git clang-format` to get the headers in the right order for the new location, which has changed the order of other headers in two files.
2022-03-31[LLDB] Applying clang-tidy modernize-use-equals-default over LLDBShafik Yaghmour
Applied modernize-use-equals-default clang-tidy check over LLDB. This check is already present in the lldb/.clang-tidy config. Differential Revision: https://reviews.llvm.org/D121844
2020-07-22[lldb] Eliminate unneeded value parameters in Utility (NFC)Jonas Devlieghere
Eliminates value parameter for types that are not trivially copyable.
2020-06-05Move GetXcode*Directory into HostInfo (NFC)Adrian Prantl
These functions really don't belong into PlatformDarwin, since they actualy query state of the Host and not of the remote platform.
2020-05-14[lldb] Fix a "missing return" warning in XcodeSDKPavel Labath
2020-05-08Add an API to construct an XcodeSDK from an SDK type.Adrian Prantl
Also, this moves numSDKs out of the actual enum, as to not mess with the switch-cases-covered warning. Differential Revision: https://reviews.llvm.org/D79603
2020-05-07Add a function to detect whether an Xcode SDK supports SwiftAdrian Prantl
Differential Revision: https://reviews.llvm.org/D79535
2020-05-07Add an XcodeSDK::GetSDKTypeForTriple functionAdrian Prantl
This is something used in swift-lldb, but of general usefulness. Differential Revision: https://reviews.llvm.org/D79538 <rdar://problem/62684906>
2020-05-07Reuse existing functionality in XcodeSDK::SDKSupportsModules (NFC)Adrian Prantl
Differential Revision: https://reviews.llvm.org/D79533
2020-04-24Fix a dangling-gsl warning and avoid transitively including string.Eric Christopher
2020-04-24Add an internal bit to the XcodeSDK class.Adrian Prantl
For developing the OS itself there exists an "internal" variant of each SDK. This patch adds support for these SDK directories to the XcodeSDK class. Differential Revision: https://reviews.llvm.org/D78675
2020-04-10Attempt to fix a compile error reported with older compilers and libstdc++Adrian Prantl
2020-04-06Remap the target (Xcode) SDK directory to the host SDK directory.Adrian Prantl
This is mostly useful for Swift support; it allows LLDB to substitute a matching SDK it shipped with instead of the sysroot path that was used at compile time. The goal of this is to make the Xcode SDK something that behaves more like the compiler's resource directory, as in that it ships with LLDB rather than with the debugged program. This important primarily for importing Swift and Clang modules in the expression evaluator, and getting at the APINotes from the SDK in Swift. For a cross-debugging scenario, this means you have to have an SDK for your target installed alongside LLDB. In Xcode this will always be the case. rdar://problem/60640017 Differential Revision: https://reviews.llvm.org/D76471