[Lldb-commits] [lldb] 0b98b27 - Use the root directory as the SDK root on POSIX platforms
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 3 14:20:38 PDT 2025
Author: CodingCarpincho
Date: 2025-07-03T14:20:31-07:00
New Revision: 0b98b27930dad5ff59de050605c3f101330a2b5c
URL: https://github.com/llvm/llvm-project/commit/0b98b27930dad5ff59de050605c3f101330a2b5c
DIFF: https://github.com/llvm/llvm-project/commit/0b98b27930dad5ff59de050605c3f101330a2b5c.diff
LOG: 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.
Added:
Modified:
lldb/include/lldb/Host/posix/HostInfoPosix.h
lldb/source/Host/posix/HostInfoPosix.cpp
Removed:
################################################################################
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() {
More information about the lldb-commits
mailing list