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);


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);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to