Skip to content

Commit 0b98b27

Browse files
CodingCarpinchoadrian-prantl
authored andcommitted
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.
1 parent 17cb0a7 commit 0b98b27

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lldb/include/lldb/Host/posix/HostInfoPosix.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class HostInfoPosix : public HostInfoBase {
3939
static llvm::VersionTuple GetOSVersion();
4040
static std::optional<std::string> GetOSBuildString();
4141

42+
static llvm::Expected<llvm::StringRef> GetSDKRoot(SDKOptions options);
43+
4244
protected:
4345
static bool ComputeSupportExeDirectory(FileSpec &file_spec);
4446
static bool ComputeHeaderDirectory(FileSpec &file_spec);

lldb/source/Host/posix/HostInfoPosix.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ std::optional<std::string> PosixUserIDResolver::DoGetGroupName(id_t gid) {
140140
return std::nullopt;
141141
}
142142

143+
/// The SDK is the directory where the system C headers, libraries, can be
144+
/// found. On POSIX platforms this is simply the root directory.
145+
llvm::Expected<llvm::StringRef> HostInfoPosix::GetSDKRoot(SDKOptions options) {
146+
return "/";
147+
}
148+
143149
static llvm::ManagedStatic<PosixUserIDResolver> g_user_id_resolver;
144150

145151
UserIDResolver &HostInfoPosix::GetUserIDResolver() {

0 commit comments

Comments
 (0)