[Lldb-commits] [PATCH] D152962: [lldb] Fix SBPlatform after f4be9ff6458f

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 14 14:17:21 PDT 2023


bulbazord created this revision.
bulbazord added a reviewer: jingham.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

If you pass `nullptr` (or `None` from python) to SBPlatform::SetSDKRoot,
LLDB crashes. Let's be more resilient to `nullptr` here.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152962

Files:
  lldb/source/API/SBPlatform.cpp


Index: lldb/source/API/SBPlatform.cpp
===================================================================
--- lldb/source/API/SBPlatform.cpp
+++ lldb/source/API/SBPlatform.cpp
@@ -488,7 +488,7 @@
 void SBPlatform::SetSDKRoot(const char *sysroot) {
   LLDB_INSTRUMENT_VA(this, sysroot);
   if (PlatformSP platform_sp = GetSP())
-    platform_sp->SetSDKRootDirectory(sysroot);
+    platform_sp->SetSDKRootDirectory(llvm::StringRef(sysroot).str());
 }
 
 SBError SBPlatform::Get(SBFileSpec &src, SBFileSpec &dst) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152962.531512.patch
Type: text/x-patch
Size: 512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230614/1a9ac1ce/attachment.bin>


More information about the lldb-commits mailing list