diff options
author | Greg Clayton <gclayton@apple.com> | 2013-04-03 02:00:15 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-04-03 02:00:15 +0000 |
commit | 43fe217b119998264be04a773c4770592663c306 (patch) | |
tree | 36b05c4a7a937c9a94c355dfe23c16a23bf9d824 /lldb/source/Core/ModuleList.cpp | |
parent | 1786cb2f018c8bce823ed5c3d36e1dbd773dee79 (diff) | |
download | bcm5719-llvm-43fe217b119998264be04a773c4770592663c306.tar.gz bcm5719-llvm-43fe217b119998264be04a773c4770592663c306.zip |
<rdar://problem/13506727>
Symbol table function names should support lookups like symbols with debug info.
To fix this I:
- Gutted the way FindFunctions is used, there used to be way too much smarts only in the DWARF plug-in
- Made it more efficient by chopping the name up once and using simpler queries so that SymbolFile and Symtab plug-ins don't need to do as much
- Filter the results at a higher level
- Make the lldb_private::Symtab able to chop up C++ mangled names and make as much sense out of them as possible and also be able to search by basename, fullname, method name, and selector name.
llvm-svn: 178608
Diffstat (limited to 'lldb/source/Core/ModuleList.cpp')
-rw-r--r-- | lldb/source/Core/ModuleList.cpp | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 8e79a455182..23cad43ff67 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -337,14 +337,64 @@ ModuleList::FindFunctions (const ConstString &name, if (!append) sc_list.Clear(); - Mutex::Locker locker(m_modules_mutex); - collection::const_iterator pos, end = m_modules.end(); - for (pos = m_modules.begin(); pos != end; ++pos) - { - (*pos)->FindFunctions (name, NULL, name_type_mask, include_symbols, include_inlines, true, sc_list); + const size_t old_size = sc_list.GetSize(); + + if (name_type_mask & eFunctionNameTypeAuto) + { + ConstString lookup_name; + uint32_t lookup_name_type_mask = 0; + bool match_name_after_lookup = false; + Module::PrepareForFunctionNameLookup (name, name_type_mask, + lookup_name, + lookup_name_type_mask, + match_name_after_lookup); + + Mutex::Locker locker(m_modules_mutex); + collection::const_iterator pos, end = m_modules.end(); + for (pos = m_modules.begin(); pos != end; ++pos) + { + (*pos)->FindFunctions (lookup_name, + NULL, + lookup_name_type_mask, + include_symbols, + include_inlines, + true, + sc_list); + } + + if (match_name_after_lookup) + { + SymbolContext sc; + size_t i = old_size; + while (i<sc_list.GetSize()) + { + if (sc_list.GetContextAtIndex(i, sc)) + { + const char *func_name = sc.GetFunctionName().GetCString(); + if (func_name && strstr (func_name, name.GetCString()) == NULL) + { + // Remove the current context + sc_list.RemoveContextAtIndex(i); + // Don't increment i and continue in the loop + continue; + } + } + ++i; + } + } + } + else + { - return sc_list.GetSize(); + Mutex::Locker locker(m_modules_mutex); + collection::const_iterator pos, end = m_modules.end(); + for (pos = m_modules.begin(); pos != end; ++pos) + { + (*pos)->FindFunctions (name, NULL, name_type_mask, include_symbols, include_inlines, true, sc_list); + } + } + return sc_list.GetSize() - old_size; } size_t |