Added the ability to find functions from either a SBModule (find functions
only in a specific module), or in a SBTarget (all modules for a target).



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@133498 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp
index 427850e..f497fd1 100644
--- a/source/API/SBModule.cpp
+++ b/source/API/SBModule.cpp
@@ -10,8 +10,8 @@
 #include "lldb/API/SBModule.h"
 #include "lldb/API/SBAddress.h"
 #include "lldb/API/SBFileSpec.h"
-#include "lldb/API/SBFileSpec.h"
 #include "lldb/API/SBStream.h"
+#include "lldb/API/SBSymbolContextList.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/StreamString.h"
@@ -285,3 +285,24 @@
     }
     return sb_symbol;
 }
+
+uint32_t
+SBModule::FindFunctions (const char *name, 
+                         uint32_t name_type_mask, 
+                         bool append, 
+                         lldb::SBSymbolContextList& sc_list)
+{
+    if (!append)
+        sc_list.Clear();
+    if (m_opaque_sp)
+    {
+        const bool symbols_ok = true;
+        return m_opaque_sp->FindFunctions (ConstString(name), 
+                                           name_type_mask, 
+                                           symbols_ok, 
+                                           append, 
+                                           *sc_list);
+    }
+    return 0;
+}
+
diff --git a/source/API/SBSymbolContextList.cpp b/source/API/SBSymbolContextList.cpp
index a787179..ca6c80c 100644
--- a/source/API/SBSymbolContextList.cpp
+++ b/source/API/SBSymbolContextList.cpp
@@ -14,15 +14,13 @@
 using namespace lldb_private;
 
 SBSymbolContextList::SBSymbolContextList () :
-    m_opaque_ap ()
+    m_opaque_ap (new SymbolContextList())
 {
 }
 
 SBSymbolContextList::SBSymbolContextList (const SBSymbolContextList& rhs) :
-    m_opaque_ap ()
+    m_opaque_ap (new SymbolContextList(*rhs.m_opaque_ap))
 {
-    if (rhs.IsValid())
-        *m_opaque_ap = *rhs.m_opaque_ap;
 }
 
 SBSymbolContextList::~SBSymbolContextList ()
@@ -34,8 +32,7 @@
 {
     if (this != &rhs)
     {
-        if (rhs.IsValid())
-            m_opaque_ap.reset (new lldb_private::SymbolContextList(*rhs.m_opaque_ap.get()));
+        *m_opaque_ap = *rhs.m_opaque_ap;
     }
     return *this;
 }
@@ -63,6 +60,13 @@
     return sb_sc;
 }
 
+void
+SBSymbolContextList::Clear()
+{
+    if (m_opaque_ap.get())
+        m_opaque_ap->Clear();
+}
+
 
 bool
 SBSymbolContextList::IsValid () const
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index 03333d9..8ed525e 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -14,6 +14,7 @@
 #include "lldb/API/SBFileSpec.h"
 #include "lldb/API/SBModule.h"
 #include "lldb/API/SBStream.h"
+#include "lldb/API/SBSymbolContextList.h"
 #include "lldb/Breakpoint/BreakpointID.h"
 #include "lldb/Breakpoint/BreakpointIDList.h"
 #include "lldb/Breakpoint/BreakpointList.h"
@@ -784,3 +785,25 @@
     
     return true;
 }
+
+
+uint32_t
+SBTarget::FindFunctions (const char *name, 
+                         uint32_t name_type_mask, 
+                         bool append, 
+                         lldb::SBSymbolContextList& sc_list)
+{
+    if (!append)
+        sc_list.Clear();
+    if (m_opaque_sp)
+    {
+        const bool symbols_ok = true;
+        return m_opaque_sp->GetImages().FindFunctions (ConstString(name), 
+                                                       name_type_mask, 
+                                                       symbols_ok, 
+                                                       append, 
+                                                       *sc_list);
+    }
+    return 0;
+}
+