[Lldb-commits] [PATCH] D117550: [lldb] Introduce SBPlatform::SetSDKRoot
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 19 03:50:21 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG903424532f0b: [lldb] Introduce SBPlatform::SetSDKRoot (authored by labath).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117550/new/
https://reviews.llvm.org/D117550
Files:
lldb/bindings/interface/SBPlatform.i
lldb/include/lldb/API/SBPlatform.h
lldb/source/API/SBDebugger.cpp
lldb/source/API/SBPlatform.cpp
lldb/source/Target/Platform.cpp
lldb/test/API/python_api/sbplatform/TestSBPlatform.py
Index: lldb/test/API/python_api/sbplatform/TestSBPlatform.py
===================================================================
--- lldb/test/API/python_api/sbplatform/TestSBPlatform.py
+++ lldb/test/API/python_api/sbplatform/TestSBPlatform.py
@@ -20,3 +20,11 @@
cmd = lldb.SBPlatformShellCommand(self.getBuildArtifact("a.out"))
self.assertTrue(plat.Run(cmd).Success())
self.assertIn("MY_TEST_ENV_VAR=SBPlatformAPICase.test_run", cmd.GetOutput())
+
+ def test_SetSDKRoot(self):
+ plat = lldb.SBPlatform("remote-linux") # arbitrary choice
+ self.assertTrue(plat)
+ plat.SetSDKRoot(self.getBuildDir())
+ self.dbg.SetCurrentPlatform("remote-linux")
+ self.expect("platform status",
+ substrs=["Sysroot:", self.getBuildDir()])
Index: lldb/source/Target/Platform.cpp
===================================================================
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -428,6 +428,9 @@
strm.Printf(" Connected: %s\n", is_connected ? "yes" : "no");
}
+ if (GetSDKRootDirectory()) {
+ strm.Format(" Sysroot: {0}\n", GetSDKRootDirectory());
+ }
if (GetWorkingDirectory()) {
strm.Printf("WorkingDir: %s\n", GetWorkingDirectory().GetCString());
}
Index: lldb/source/API/SBPlatform.cpp
===================================================================
--- lldb/source/API/SBPlatform.cpp
+++ lldb/source/API/SBPlatform.cpp
@@ -513,6 +513,12 @@
return version.getSubminor().getValueOr(UINT32_MAX);
}
+void SBPlatform::SetSDKRoot(const char *sysroot) {
+ LLDB_RECORD_METHOD(void, SBPlatform, SetSDKRoot, (const char *), sysroot);
+ if (PlatformSP platform_sp = GetSP())
+ platform_sp->SetSDKRootDirectory(ConstString(sysroot));
+}
+
SBError SBPlatform::Get(SBFileSpec &src, SBFileSpec &dst) {
LLDB_RECORD_METHOD(lldb::SBError, SBPlatform, Get,
(lldb::SBFileSpec &, lldb::SBFileSpec &), src, dst);
Index: lldb/source/API/SBDebugger.cpp
===================================================================
--- lldb/source/API/SBDebugger.cpp
+++ lldb/source/API/SBDebugger.cpp
@@ -1533,18 +1533,9 @@
LLDB_RECORD_METHOD(bool, SBDebugger, SetCurrentPlatformSDKRoot,
(const char *), sysroot);
- Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
- if (m_opaque_sp) {
- PlatformSP platform_sp(
- m_opaque_sp->GetPlatformList().GetSelectedPlatform());
-
- if (platform_sp) {
- if (log && sysroot)
- LLDB_LOGF(log, "SBDebugger::SetCurrentPlatformSDKRoot (\"%s\")",
- sysroot);
- platform_sp->SetSDKRootDirectory(ConstString(sysroot));
- return true;
- }
+ if (SBPlatform platform = GetSelectedPlatform()) {
+ platform.SetSDKRoot(sysroot);
+ return true;
}
return false;
}
Index: lldb/include/lldb/API/SBPlatform.h
===================================================================
--- lldb/include/lldb/API/SBPlatform.h
+++ lldb/include/lldb/API/SBPlatform.h
@@ -137,6 +137,8 @@
uint32_t GetOSUpdateVersion();
+ void SetSDKRoot(const char *sysroot);
+
SBError Put(SBFileSpec &src, SBFileSpec &dst);
SBError Get(SBFileSpec &src, SBFileSpec &dst);
Index: lldb/bindings/interface/SBPlatform.i
===================================================================
--- lldb/bindings/interface/SBPlatform.i
+++ lldb/bindings/interface/SBPlatform.i
@@ -177,6 +177,9 @@
uint32_t
GetOSUpdateVersion ();
+ void
+ SetSDKRoot(const char *sysroot);
+
lldb::SBError
Get (lldb::SBFileSpec &src, lldb::SBFileSpec &dst);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117550.401164.patch
Type: text/x-patch
Size: 3614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220119/b3b60efb/attachment-0001.bin>
More information about the lldb-commits
mailing list