diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index 39f5da721533..13d02bd6dae5 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -22,23 +22,24 @@ class SymbolFile : public PluginInterface { public: + //------------------------------------------------------------------ + // Symbol file ability bits. + // + // Each symbol file can claim to support one or more symbol file + // abilities. These get returned from SymbolFile::GetAbilities(). + // These help us to determine which plug-in will be best to load + // the debug information found in files. + //------------------------------------------------------------------ enum Abilities { - Labels = (1 << 0), - AddressAcceleratorTable = (1 << 1), - FunctionAcceleratorTable = (1 << 2), - TypeAcceleratorTable = (1 << 3), - MacroInformation = (1 << 4), - CallFrameInformation = (1 << 5), - RuntimeTypes = (1 << 6), - CompileUnits = (1 << 7), - LineTables = (1 << 8), - LineColumns = (1 << 9), - Functions = (1 << 10), - Blocks = (1 << 11), - GlobalVariables = (1 << 12), - LocalVariables = (1 << 13), - VariableTypes = (1 << 14) + CompileUnits = (1u << 0), + LineTables = (1u << 1), + Functions = (1u << 2), + Blocks = (1u << 3), + GlobalVariables = (1u << 4), + LocalVariables = (1u << 5), + VariableTypes = (1u << 6), + kAllAbilities =((1u << 7) - 1u) }; static SymbolFile * diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp index 129ef6cd5a2b..ff135806f289 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp @@ -61,7 +61,12 @@ AppleObjCSymbolVendor::FindTypes (const SymbolContext& sc, SymbolFile *symbol_file = image->GetSymbolVendor()->GetSymbolFile(); - if (!symbol_file || !(symbol_file->GetAbilities() & SymbolFile::RuntimeTypes)) + // Don't use a symbol file if it actually has types. We are specifically + // looking for something in runtime information, not from debug information, + // as the data in debug information will get parsed by the debug info + // symbol files. So we veto any symbol file that has actual variable + // type parsing abilities. + if (symbol_file == NULL || (symbol_file->GetAbilities() & SymbolFile::VariableTypes)) continue; const bool inferior_append = true; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 93f86bb2e251..9a386f474af0 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -508,21 +508,6 @@ SymbolFileDWARF::CalculateAbilities () if (debug_line_file_size > 0) abilities |= LineTables; - - if (debug_aranges_file_size > 0) - abilities |= AddressAcceleratorTable; - - if (debug_pubnames_file_size > 0) - abilities |= FunctionAcceleratorTable; - - if (debug_pubtypes_file_size > 0) - abilities |= TypeAcceleratorTable; - - if (debug_macinfo_file_size > 0) - abilities |= MacroInformation; - - if (debug_frame_file_size > 0) - abilities |= CallFrameInformation; } return abilities; } diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp index b21343dc6d81..5404ab0f8fd7 100644 --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp @@ -106,7 +106,6 @@ SymbolFileSymtab::CalculateAbilities () if (symtab->AppendSymbolIndexesWithType(eSymbolTypeCode, Symtab::eDebugNo, Symtab::eVisibilityAny, m_code_indexes)) { symtab->SortSymbolIndexesByValue(m_code_indexes, true); - abilities |= Labels; } if (symtab->AppendSymbolIndexesWithType(eSymbolTypeData, m_data_indexes)) @@ -118,7 +117,6 @@ SymbolFileSymtab::CalculateAbilities () lldb_private::Symtab::IndexCollection objc_class_indexes; if (symtab->AppendSymbolIndexesWithType (eSymbolTypeObjCClass, objc_class_indexes)) { - abilities |= RuntimeTypes; symtab->AppendSymbolNamesToMap (objc_class_indexes, true, true, @@ -150,14 +148,7 @@ SymbolFileSymtab::ParseCompileUnitAtIndex(uint32_t idx) // If we don't have any source file symbols we will just have one compile unit for // the entire object file -// if (m_source_indexes.empty()) -// { -// const FileSpec &obj_file_spec = m_obj_file->GetFileSpec(); -// if (obj_file_spec) -// cu_sp.reset(new CompileUnit(m_obj_file->GetModule(), NULL, obj_file_spec, 0, eLanguageTypeUnknown)); -// -// } - /* else */ if (idx < m_source_indexes.size()) + if (idx < m_source_indexes.size()) { const Symbol *cu_symbol = m_obj_file->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]); if (cu_symbol) diff --git a/lldb/source/Symbol/SymbolFile.cpp b/lldb/source/Symbol/SymbolFile.cpp index 92af5f255407..808830e1f155 100644 --- a/lldb/source/Symbol/SymbolFile.cpp +++ b/lldb/source/Symbol/SymbolFile.cpp @@ -27,9 +27,6 @@ SymbolFile::FindPlugin (ObjectFile* obj_file) // TODO: Load any plug-ins in the appropriate plug-in search paths and // iterate over all of them to find the best one for the job. - //---------------------------------------------------------------------- - // We currently only have one debug symbol parser... - //---------------------------------------------------------------------- uint32_t best_symfile_abilities = 0; SymbolFileCreateInstance create_callback; @@ -39,11 +36,15 @@ SymbolFile::FindPlugin (ObjectFile* obj_file) if (curr_symfile_ap.get()) { - uint32_t sym_file_abilities = curr_symfile_ap->GetAbilities(); + const uint32_t sym_file_abilities = curr_symfile_ap->GetAbilities(); if (sym_file_abilities > best_symfile_abilities) { best_symfile_abilities = sym_file_abilities; best_symfile_ap = curr_symfile_ap; + // If any symbol file parser has all of the abilities, then + // we should just stop looking. + if ((kAllAbilities & sym_file_abilities) == kAllAbilities) + break; } } }