[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.

Alexander Polyakov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 23 16:38:53 PDT 2018


polyakov.alex created this revision.
polyakov.alex added a reviewer: aprantl.
Herald added a subscriber: llvm-commits.

The new method adds to the current target a path to search for a shared objects.


Repository:
  rL LLVM

https://reviews.llvm.org/D47302

Files:
  include/lldb/API/SBDebugger.h
  source/API/SBDebugger.cpp


Index: source/API/SBDebugger.cpp
===================================================================
--- source/API/SBDebugger.cpp
+++ source/API/SBDebugger.cpp
@@ -1123,6 +1123,38 @@
   return false;
 }
 
+bool SBDebugger::AddCurrentTargetSharedObjectPath(const char *from,
+                                                  const char *to,
+                                                  lldb::SBError &sb_error) {
+  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+  auto target_sp = GetSelectedTarget().GetSP();
+
+  if (target_sp->IsValid()) {
+    if (from[0] && to[0]) {
+      if (log)
+        log->Printf("SBDebugger::AddCurrentPlatformSharedObjectPath: '%s' -> '%s'",
+                    from, to);
+      target_sp->GetImageSearchPathList().Append(
+          ConstString(from), ConstString(to), true);
+      return true;
+    } else {
+      if (from[0])
+        sb_error.SetErrorString("<new-path-prefix> can't be empty> "
+                                "(SBDebugger::AddCurrentPlatformSharedObjectPath) "
+                                "returned false");
+      else
+        sb_error.SetErrorString("<path-prefix> can't be empty> "
+                                "(SBDebugger::AddCurrentPlatformSharedObjectPath) "
+                                "returned false");
+      return false;
+    }
+  }
+  sb_error.SetErrorString("invalid target "
+                          "(SBDebugger::AddCurrentPlatformSharedObjectPath) "
+                          "returned false");
+  return false;
+}
+
 bool SBDebugger::GetCloseInputOnEOF() const {
   return (m_opaque_sp ? m_opaque_sp->GetCloseInputOnEOF() : false);
 }
Index: include/lldb/API/SBDebugger.h
===================================================================
--- include/lldb/API/SBDebugger.h
+++ include/lldb/API/SBDebugger.h
@@ -161,6 +161,10 @@
 
   bool SetCurrentPlatformSDKRoot(const char *sysroot);
 
+  bool AddCurrentTargetSharedObjectPath(const char *from,
+                                        const char *to,
+                                        lldb::SBError &error);
+
   // FIXME: Once we get the set show stuff in place, the driver won't need
   // an interface to the Set/Get UseExternalEditor.
   bool SetUseExternalEditor(bool input);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47302.148316.patch
Type: text/x-patch
Size: 2252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180523/b29fc3ba/attachment-0001.bin>


More information about the lldb-commits mailing list