diff options
author | Michael Sartain <mikesart@valvesoftware.com> | 2013-07-11 16:40:56 +0000 |
---|---|---|
committer | Michael Sartain <mikesart@valvesoftware.com> | 2013-07-11 16:40:56 +0000 |
commit | cc791bbfab548d302e8e9584c8e532e8f596dd31 (patch) | |
tree | f228620c2b21b63afd309614b28c960915594023 /lldb/source/Core/ModuleList.cpp | |
parent | 29e787d45651294f3658e6e02bda15504bdffe6c (diff) | |
download | bcm5719-llvm-cc791bbfab548d302e8e9584c8e532e8f596dd31.tar.gz bcm5719-llvm-cc791bbfab548d302e8e9584c8e532e8f596dd31.zip |
Fix "source list -n printf" on Linux (printf is symbol alias for __printf)
Differential Revision: http://llvm-reviews.chandlerc.com/D1109
llvm-svn: 186104
Diffstat (limited to 'lldb/source/Core/ModuleList.cpp')
-rw-r--r-- | lldb/source/Core/ModuleList.cpp | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 07b20b8d91e..6c94a501da9 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -386,7 +386,6 @@ ModuleList::FindFunctions (const ConstString &name, } else { - Mutex::Locker locker(m_modules_mutex); collection::const_iterator pos, end = m_modules.end(); for (pos = m_modules.begin(); pos != end; ++pos) @@ -398,6 +397,67 @@ ModuleList::FindFunctions (const ConstString &name, } size_t +ModuleList::FindFunctionSymbols (const ConstString &name, + uint32_t name_type_mask, + SymbolContextList& 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)->FindFunctionSymbols (lookup_name, + lookup_name_type_mask, + 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 + { + Mutex::Locker locker(m_modules_mutex); + collection::const_iterator pos, end = m_modules.end(); + for (pos = m_modules.begin(); pos != end; ++pos) + { + (*pos)->FindFunctionSymbols (name, name_type_mask, sc_list); + } + } + + return sc_list.GetSize() - old_size; +} + +size_t ModuleList::FindCompileUnits (const FileSpec &path, bool append, SymbolContextList &sc_list) const |