diff options
author | Greg Clayton <gclayton@apple.com> | 2011-01-27 06:44:37 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-01-27 06:44:37 +0000 |
commit | 931180e644bc086a16dcad43713b0ac5b7d0a83f (patch) | |
tree | eb89d8a5cf048706e1c7246bb2fbc2c40a4453be /lldb/source/Core/Module.cpp | |
parent | ebd8db7d0032f881cbdfdb4bbceead2052562141 (diff) | |
download | bcm5719-llvm-931180e644bc086a16dcad43713b0ac5b7d0a83f.tar.gz bcm5719-llvm-931180e644bc086a16dcad43713b0ac5b7d0a83f.zip |
Changed the SymbolFile::FindFunction() function calls to only return
lldb_private::Function objects. Previously the SymbolFileSymtab subclass
would return lldb_private::Symbol objects when it was asked to find functions.
The Module::FindFunctions (...) now take a boolean "bool include_symbols" so
that the module can track down functions and symbols, yet functions are found
by the SymbolFile plug-ins (through the SymbolVendor class), and symbols are
gotten through the ObjectFile plug-ins.
Fixed and issue where the DWARF parser might run into incomplete class member
function defintions which would make clang mad when we tried to make certain
member functions with invalid number of parameters (such as an operator=
operator that had no parameters). Now we just avoid and don't complete these
incomplete functions.
llvm-svn: 124359
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r-- | lldb/source/Core/Module.cpp | 79 |
1 files changed, 73 insertions, 6 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 6226fb26f2a..ef8e3938a6e 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -321,21 +321,88 @@ Module::FindGlobalVariables(const RegularExpression& regex, bool append, uint32_ } uint32_t -Module::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) +Module::FindFunctions (const ConstString &name, + uint32_t name_type_mask, + bool include_symbols, + bool append, + SymbolContextList& sc_list) { + if (!append) + sc_list.Clear(); + + const uint32_t start_size = sc_list.GetSize(); + + // Find all the functions (not symbols, but debug information functions... SymbolVendor *symbols = GetSymbolVendor (); if (symbols) - return symbols->FindFunctions(name, name_type_mask, append, sc_list); - return 0; + symbols->FindFunctions(name, name_type_mask, append, sc_list); + + // Now check our symbol table for symbols that are code symbols if requested + if (include_symbols) + { + ObjectFile *objfile = GetObjectFile(); + if (objfile) + { + Symtab *symtab = objfile->GetSymtab(); + if (symtab) + { + std::vector<uint32_t> symbol_indexes; + symtab->FindAllSymbolsWithNameAndType (name, eSymbolTypeCode, Symtab::eDebugAny, Symtab::eVisibilityAny, symbol_indexes); + const uint32_t num_matches = symbol_indexes.size(); + if (num_matches) + { + SymbolContext sc(this); + for (uint32_t i=0; i<num_matches; i++) + { + sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]); + sc_list.AppendIfUnique (sc); + } + } + } + } + } + return sc_list.GetSize() - start_size; } uint32_t -Module::FindFunctions(const RegularExpression& regex, bool append, SymbolContextList& sc_list) -{ +Module::FindFunctions (const RegularExpression& regex, + bool include_symbols, + bool append, + SymbolContextList& sc_list) +{ + if (!append) + sc_list.Clear(); + + const uint32_t start_size = sc_list.GetSize(); + SymbolVendor *symbols = GetSymbolVendor (); if (symbols) return symbols->FindFunctions(regex, append, sc_list); - return 0; + // Now check our symbol table for symbols that are code symbols if requested + if (include_symbols) + { + ObjectFile *objfile = GetObjectFile(); + if (objfile) + { + Symtab *symtab = objfile->GetSymtab(); + if (symtab) + { + std::vector<uint32_t> symbol_indexes; + symtab->AppendSymbolIndexesMatchingRegExAndType (regex, eSymbolTypeCode, Symtab::eDebugAny, Symtab::eVisibilityAny, symbol_indexes); + const uint32_t num_matches = symbol_indexes.size(); + if (num_matches) + { + SymbolContext sc(this); + for (uint32_t i=0; i<num_matches; i++) + { + sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]); + sc_list.AppendIfUnique (sc); + } + } + } + } + } + return sc_list.GetSize() - start_size; } uint32_t |