[Lldb-commits] [lldb] r110093 - in /lldb/trunk: include/lldb/Core/Module.h include/lldb/Core/ModuleList.h source/Core/Module.cpp source/Core/ModuleList.cpp

Greg Clayton gclayton at apple.com
Mon Aug 2 18:26:16 PDT 2010


Author: gclayton
Date: Mon Aug  2 20:26:16 2010
New Revision: 110093

URL: http://llvm.org/viewvc/llvm-project?rev=110093&view=rev
Log:
Added FindTypes to Module and ModuleList.

Modified:
    lldb/trunk/include/lldb/Core/Module.h
    lldb/trunk/include/lldb/Core/ModuleList.h
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Core/ModuleList.cpp

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=110093&r1=110092&r2=110093&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Mon Aug  2 20:26:16 2010
@@ -283,8 +283,8 @@
     /// @return
     ///     The number of matches added to \a type_list.
     //------------------------------------------------------------------
-//  uint32_t
-//  FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& type_list);
+    uint32_t
+    FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types);
 
     //------------------------------------------------------------------
     /// Find types by name.

Modified: lldb/trunk/include/lldb/Core/ModuleList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=110093&r1=110092&r2=110093&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ModuleList.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleList.h Mon Aug  2 20:26:16 2010
@@ -270,7 +270,46 @@
                                 lldb::SymbolType symbol_type,
                                 SymbolContextList &sc_list);
 
-
+    //------------------------------------------------------------------
+    /// Find types by name.
+    ///
+    /// @param[in] sc
+    ///     A symbol context that scopes where to extract a type list
+    ///     from.
+    ///
+    /// @param[in] name
+    ///     The name of the type we are looking for.
+    ///
+    /// @param[in] append
+    ///     If \b true, any matches will be appended to \a
+    ///     variable_list, else matches replace the contents of
+    ///     \a variable_list.
+    ///
+    /// @param[in] max_matches
+    ///     Allow the number of matches to be limited to \a
+    ///     max_matches. Specify UINT_MAX to get all possible matches.
+    ///
+    /// @param[in] encoding
+    ///     Limit the search to specific types, or get all types if
+    ///     set to Type::invalid.
+    ///
+    /// @param[in] udt_name
+    ///     If the encoding is a user defined type, specify the name
+    ///     of the user defined type ("struct", "union", "class", etc).
+    ///
+    /// @param[out] type_list
+    ///     A type list gets populated with any matches.
+    ///
+    /// @return
+    ///     The number of matches added to \a type_list.
+    //------------------------------------------------------------------
+    uint32_t
+    FindTypes (const SymbolContext& sc, 
+               const ConstString &name, 
+               bool append, 
+               uint32_t max_matches, 
+               TypeList& types);
+    
     bool
     Remove (lldb::ModuleSP &module_sp);
 

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=110093&r1=110092&r2=110093&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Mon Aug  2 20:26:16 2010
@@ -303,16 +303,19 @@
     return 0;
 }
 
-//uint32_t
-//Module::FindTypes(const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& types)
-//{
-//  Timer scoped_timer(__PRETTY_FUNCTION__);
-//  SymbolVendor *symbols = GetSymbolVendor ();
-//  if (symbols)
-//      return symbols->FindTypes(sc, name, append, max_matches, encoding, udt_name, types);
-//  return 0;
-//}
-//
+uint32_t
+Module::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
+{
+    Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
+    if (sc.module_sp.get() == NULL || sc.module_sp.get() == this)
+    {
+        SymbolVendor *symbols = GetSymbolVendor ();
+        if (symbols)
+            return symbols->FindTypes(sc, name, append, max_matches, types);
+    }
+    return 0;
+}
+
 //uint32_t
 //Module::FindTypes(const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& types)
 //{

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=110093&r1=110092&r2=110093&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Mon Aug  2 20:26:16 2010
@@ -290,6 +290,28 @@
 }
 
 
+uint32_t
+ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
+{
+    Mutex::Locker locker(m_modules_mutex);
+    
+    if (!append)
+        types.Clear();
+
+    uint32_t total_matches = 0;
+    collection::const_iterator pos, end = m_modules.end();
+    for (pos = m_modules.begin(); pos != end; ++pos)
+    {
+        if (sc.module_sp.get() == NULL || sc.module_sp.get() == (*pos).get())
+            total_matches += (*pos)->FindTypes (sc, name, true, max_matches, types);
+
+        if (total_matches >= max_matches)
+            break;
+    }
+    return total_matches;
+}
+
+
 ModuleSP
 ModuleList::FindFirstModuleForFileSpec (const FileSpec &file_spec, const ConstString *object_name)
 {





More information about the lldb-commits mailing list