https://github.com/adrian-prantl updated https://github.com/llvm/llvm-project/pull/146963
>From 16b7748cf38aaade5185a1073d2755abb2c40d12 Mon Sep 17 00:00:00 2001 From: CodingCarpincho <codingcapyb...@apple.com> Date: Thu, 3 Jul 2025 13:54:46 -0700 Subject: [PATCH] Use the root directory as the SDK root on POSIX platforms LLDB has the concept of an "SDK root", which expresses where the system libraries and so which are necessary for debugging can be found. On POSIX platforms, the SDK root is just the root of the file system, or /. We need to implement the appropriate method on HostInfoPosix to prevent the use of the default implementation for which just returns an error. This change is needed to support the Swift REPL but may be useful for other use cases as well. --- lldb/include/lldb/Host/posix/HostInfoPosix.h | 2 ++ lldb/source/Host/posix/HostInfoPosix.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lldb/include/lldb/Host/posix/HostInfoPosix.h b/lldb/include/lldb/Host/posix/HostInfoPosix.h index 779b67bd66eda..c4a7f13674f40 100644 --- a/lldb/include/lldb/Host/posix/HostInfoPosix.h +++ b/lldb/include/lldb/Host/posix/HostInfoPosix.h @@ -39,6 +39,8 @@ class HostInfoPosix : public HostInfoBase { static llvm::VersionTuple GetOSVersion(); static std::optional<std::string> GetOSBuildString(); + static llvm::Expected<llvm::StringRef> GetSDKRoot(SDKOptions options); + protected: static bool ComputeSupportExeDirectory(FileSpec &file_spec); static bool ComputeHeaderDirectory(FileSpec &file_spec); diff --git a/lldb/source/Host/posix/HostInfoPosix.cpp b/lldb/source/Host/posix/HostInfoPosix.cpp index 879dccfd353be..704f77891c829 100644 --- a/lldb/source/Host/posix/HostInfoPosix.cpp +++ b/lldb/source/Host/posix/HostInfoPosix.cpp @@ -140,6 +140,12 @@ std::optional<std::string> PosixUserIDResolver::DoGetGroupName(id_t gid) { return std::nullopt; } +/// The SDK is the directory where the system C headers, libraries, can be +/// found. On POSIX platforms this is simply the root directory. +llvm::Expected<llvm::StringRef> HostInfoPosix::GetSDKRoot(SDKOptions options) { + return "/"; +} + static llvm::ManagedStatic<PosixUserIDResolver> g_user_id_resolver; UserIDResolver &HostInfoPosix::GetUserIDResolver() { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits