summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/Module.h4
-rw-r--r--lldb/include/lldb/Core/ModuleList.h41
-rw-r--r--lldb/source/Core/Module.cpp23
-rw-r--r--lldb/source/Core/ModuleList.cpp22
4 files changed, 77 insertions, 13 deletions
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 9de406d59eb..5298cac5e3e 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -283,8 +283,8 @@ public:
/// @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.
diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h
index 70f49da083c..ef3ddd80669 100644
--- a/lldb/include/lldb/Core/ModuleList.h
+++ b/lldb/include/lldb/Core/ModuleList.h
@@ -270,7 +270,46 @@ public:
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);
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 3d0b9820117..9887cc96336 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -303,16 +303,19 @@ Module::FindFunctions(const RegularExpression& regex, bool append, SymbolContext
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)
//{
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 1c974c87120..37357c373ca 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -290,6 +290,28 @@ ModuleList::FindModule (lldb_private::Module *module_ptr)
}
+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)
{
OpenPOWER on IntegriCloud