[Lldb-commits] [lldb] r133498 - in /lldb/trunk: include/lldb/API/SBDefines.h include/lldb/API/SBModule.h include/lldb/API/SBSymbolContextList.h include/lldb/API/SBTarget.h include/lldb/lldb-enumerations.h include/lldb/lldb-private-enumerations.h source/API/SBModule.cpp source/API/SBSymbolContextList.cpp source/API/SBTarget.cpp

Greg Clayton gclayton at apple.com
Mon Jun 20 18:34:41 PDT 2011


Author: gclayton
Date: Mon Jun 20 20:34:41 2011
New Revision: 133498

URL: http://llvm.org/viewvc/llvm-project?rev=133498&view=rev
Log:
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).


Modified:
    lldb/trunk/include/lldb/API/SBDefines.h
    lldb/trunk/include/lldb/API/SBModule.h
    lldb/trunk/include/lldb/API/SBSymbolContextList.h
    lldb/trunk/include/lldb/API/SBTarget.h
    lldb/trunk/include/lldb/lldb-enumerations.h
    lldb/trunk/include/lldb/lldb-private-enumerations.h
    lldb/trunk/source/API/SBModule.cpp
    lldb/trunk/source/API/SBSymbolContextList.cpp
    lldb/trunk/source/API/SBTarget.cpp

Modified: lldb/trunk/include/lldb/API/SBDefines.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDefines.h?rev=133498&r1=133497&r2=133498&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDefines.h (original)
+++ lldb/trunk/include/lldb/API/SBDefines.h Mon Jun 20 20:34:41 2011
@@ -53,6 +53,7 @@
 class SBStringList;
 class SBSymbol;
 class SBSymbolContext;
+class SBSymbolContextList;
 class SBTarget;
 class SBThread;
 class SBValue;

Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=133498&r1=133497&r2=133498&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Mon Jun 20 20:34:41 2011
@@ -74,6 +74,12 @@
     lldb::SBSymbol
     GetSymbolAtIndex (size_t idx);
 
+    uint32_t
+    FindFunctions (const char *name, 
+                   uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
+                   bool append, 
+                   lldb::SBSymbolContextList& sc_list);
+
 private:
     friend class SBAddress;
     friend class SBFrame;

Modified: lldb/trunk/include/lldb/API/SBSymbolContextList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbolContextList.h?rev=133498&r1=133497&r2=133498&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSymbolContextList.h (original)
+++ lldb/trunk/include/lldb/API/SBSymbolContextList.h Mon Jun 20 20:34:41 2011
@@ -38,8 +38,14 @@
     SBSymbolContext
     GetContextAtIndex (uint32_t idx);
 
+    void
+    Clear();
+
 protected:
 
+    friend class SBModule;
+    friend class SBTarget;
+
 #ifndef SWIG
 
     lldb_private::SymbolContextList*

Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=133498&r1=133497&r2=133498&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Mon Jun 20 20:34:41 2011
@@ -183,6 +183,12 @@
     lldb::SBModule
     FindModule (const lldb::SBFileSpec &file_spec);
 
+    uint32_t
+    FindFunctions (const char *name, 
+                   uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
+                   bool append, 
+                   lldb::SBSymbolContextList& sc_list);
+
     void
     Clear ();
 

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=133498&r1=133497&r2=133498&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Mon Jun 20 20:34:41 2011
@@ -472,6 +472,23 @@
         eEmulateInstructionOptionIgnoreConditions   = (1u << 1)
     } EmulateInstructionOptions;
 
+    typedef enum FunctionNameType 
+    {
+        eFunctionNameTypeNone       = 0u,
+        eFunctionNameTypeAuto       = (1u << 1),    // Automatically figure out which FunctionNameType
+                                                    // bits to set based on the function name.
+        eFunctionNameTypeFull       = (1u << 2),    // The function name.
+                                                    // For C this is the same as just the name of the function
+                                                    // For C++ this is the mangled or demangled version of the mangled name.
+                                                    // For ObjC this is the full function signature with the + or
+                                                    // - and the square brackets and the class and selector
+        eFunctionNameTypeBase       = (1u << 3),    // The function name only, no namespaces or arguments and no class 
+                                                    // methods or selectors will be searched.
+        eFunctionNameTypeMethod     = (1u << 4),    // Find function by method name (C++) with no namespace or arguments
+        eFunctionNameTypeSelector   = (1u << 5)     // Find function by selector name (ObjC) names
+    } FunctionNameType;
+    
+
 } // namespace lldb
 
 

Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-enumerations.h?rev=133498&r1=133497&r2=133498&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-private-enumerations.h Mon Jun 20 20:34:41 2011
@@ -75,22 +75,6 @@
     kNumArchTypes
 } ArchitectureType;
 
-typedef enum FunctionNameType 
-{
-    eFunctionNameTypeNone       = 0u,
-    eFunctionNameTypeAuto       = (1u << 1),    // Automatically figure out which FunctionNameType
-                                                // bits to set based on the function name.
-    eFunctionNameTypeFull       = (1u << 2),    // The function name.
-                                                // For C this is the same as just the name of the function
-                                                // For C++ this is the demangled version of the mangled name.
-                                                // For ObjC this is the full function signature with the + or
-                                                // - and the square brackets and the class and selector
-    eFunctionNameTypeBase       = (1u << 3),    // The function name only, no namespaces or arguments and no class 
-                                                // methods or selectors will be searched.
-    eFunctionNameTypeMethod     = (1u << 4),    // Find function by method name (C++) with no namespace or arguments
-    eFunctionNameTypeSelector   = (1u << 5)     // Find function by selector name (ObjC) names
-} FunctionNameType;
-
 //----------------------------------------------------------------------
 /// Settable state variable types.
 ///

Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=133498&r1=133497&r2=133498&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Mon Jun 20 20:34:41 2011
@@ -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;
+}
+

Modified: lldb/trunk/source/API/SBSymbolContextList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContextList.cpp?rev=133498&r1=133497&r2=133498&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbolContextList.cpp (original)
+++ lldb/trunk/source/API/SBSymbolContextList.cpp Mon Jun 20 20:34:41 2011
@@ -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

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=133498&r1=133497&r2=133498&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Mon Jun 20 20:34:41 2011
@@ -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;
+}
+





More information about the lldb-commits mailing list