diff options
| author | Greg Clayton <gclayton@apple.com> | 2011-06-19 04:02:02 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2011-06-19 04:02:02 +0000 |
| commit | 5861d3e6f08190e43f00f33622f7db797c6a4c6a (patch) | |
| tree | 8a451e398e11c99e7fe4dd6db2cf41cd29b819d4 /lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp | |
| parent | 090d098fc263713b84999b37d6ac95a90cccd789 (diff) | |
| download | bcm5719-llvm-5861d3e6f08190e43f00f33622f7db797c6a4c6a.tar.gz bcm5719-llvm-5861d3e6f08190e43f00f33622f7db797c6a4c6a.zip | |
Make sure we have a valid object file before we try getting the symbol table
so we avoid crashing.
llvm-svn: 133376
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp index d0550622092..5148751755d 100644 --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp @@ -76,43 +76,45 @@ uint32_t SymbolFileSymtab::GetAbilities () { uint32_t abilities = 0; - const Symtab *symtab = m_obj_file->GetSymtab(); - if (symtab) + if (m_obj_file) { - - //---------------------------------------------------------------------- - // The snippet of code below will get the indexes the module symbol - // table entries that are code, data, or function related (debug info), - // sort them by value (address) and dump the sorted symbols. - //---------------------------------------------------------------------- - symtab->AppendSymbolIndexesWithType(eSymbolTypeSourceFile, m_source_indexes); - if (!m_source_indexes.empty()) - { - abilities |= CompileUnits; - } - symtab->AppendSymbolIndexesWithType(eSymbolTypeCode, Symtab::eDebugYes, Symtab::eVisibilityAny, m_func_indexes); - if (!m_func_indexes.empty()) + const Symtab *symtab = m_obj_file->GetSymtab(); + if (symtab) { - symtab->SortSymbolIndexesByValue(m_func_indexes, true); - abilities |= Functions; - } - symtab->AppendSymbolIndexesWithType(eSymbolTypeCode, Symtab::eDebugNo, Symtab::eVisibilityAny, m_code_indexes); - if (!m_code_indexes.empty()) - { - symtab->SortSymbolIndexesByValue(m_code_indexes, true); - abilities |= Labels; - } + //---------------------------------------------------------------------- + // The snippet of code below will get the indexes the module symbol + // table entries that are code, data, or function related (debug info), + // sort them by value (address) and dump the sorted symbols. + //---------------------------------------------------------------------- + symtab->AppendSymbolIndexesWithType(eSymbolTypeSourceFile, m_source_indexes); + if (!m_source_indexes.empty()) + { + abilities |= CompileUnits; + } + symtab->AppendSymbolIndexesWithType(eSymbolTypeCode, Symtab::eDebugYes, Symtab::eVisibilityAny, m_func_indexes); + if (!m_func_indexes.empty()) + { + symtab->SortSymbolIndexesByValue(m_func_indexes, true); + abilities |= Functions; + } + + symtab->AppendSymbolIndexesWithType(eSymbolTypeCode, Symtab::eDebugNo, Symtab::eVisibilityAny, m_code_indexes); + if (!m_code_indexes.empty()) + { + symtab->SortSymbolIndexesByValue(m_code_indexes, true); + abilities |= Labels; + } - symtab->AppendSymbolIndexesWithType(eSymbolTypeData, m_data_indexes); + symtab->AppendSymbolIndexesWithType(eSymbolTypeData, m_data_indexes); - if (!m_data_indexes.empty()) - { - symtab->SortSymbolIndexesByValue(m_data_indexes, true); - abilities |= GlobalVariables; + if (!m_data_indexes.empty()) + { + symtab->SortSymbolIndexesByValue(m_data_indexes, true); + abilities |= GlobalVariables; + } } } - return abilities; } |

