[Lldb-commits] [lldb] r133376 - /lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
Greg Clayton
gclayton at apple.com
Sat Jun 18 21:02:02 PDT 2011
Author: gclayton
Date: Sat Jun 18 23:02:02 2011
New Revision: 133376
URL: http://llvm.org/viewvc/llvm-project?rev=133376&view=rev
Log:
Make sure we have a valid object file before we try getting the symbol table
so we avoid crashing.
Modified:
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=133376&r1=133375&r2=133376&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Sat Jun 18 23:02:02 2011
@@ -76,43 +76,45 @@
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;
}
More information about the lldb-commits
mailing list