diff options
author | Greg Clayton <gclayton@apple.com> | 2013-02-05 18:40:36 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-02-05 18:40:36 +0000 |
commit | 61f39ce8b8ac2e91bfec149248a5a64b5773a11b (patch) | |
tree | 6cc11b9ed9ce62f57858aeed3c1d04f5dec258a9 /lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp | |
parent | d53b25b47e13ae4ef28f3adc285223df78082b33 (diff) | |
download | bcm5719-llvm-61f39ce8b8ac2e91bfec149248a5a64b5773a11b.tar.gz bcm5719-llvm-61f39ce8b8ac2e91bfec149248a5a64b5773a11b.zip |
<rdar://problem/12866706>
Removed asserts and replaced them with conditional code and appropriate errors that prompt for a bug to be filed.
llvm-svn: 174420
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp')
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 0999b44b5d2..5b16157e04c 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -390,30 +390,44 @@ SymbolFileDWARFDebugMap::InitOSO() for (uint32_t i=0; i<oso_index_count; ++i) { - const Symbol *so_symbol = symtab->SymbolAtIndex(oso_indexes[i] - 1); - const Symbol *oso_symbol = symtab->SymbolAtIndex(oso_indexes[i]); - assert (so_symbol); - assert (oso_symbol); - assert (so_symbol->GetType() == eSymbolTypeSourceFile); - assert (oso_symbol->GetType() == eSymbolTypeObjectFile); - m_compile_unit_infos[i].so_file.SetFile(so_symbol->GetName().AsCString(), true); - m_compile_unit_infos[i].oso_file.SetFile(oso_symbol->GetName().AsCString(), true); - uint32_t sibling_idx = so_symbol->GetSiblingIndex(); - // The sibling index can't be less that or equal to the current index "i" - if (sibling_idx <= i) + const uint32_t oso_idx = oso_indexes[i]; + const Symbol *so_symbol = symtab->SymbolAtIndex(oso_idx - 1); + const Symbol *oso_symbol = symtab->SymbolAtIndex(oso_idx); + if (so_symbol && + oso_symbol && + so_symbol->GetType() == eSymbolTypeSourceFile && + oso_symbol->GetType() == eSymbolTypeObjectFile) { - m_obj_file->GetModule()->ReportError ("N_SO in symbol with UID %u has invalid sibling in debug map, please file a bug and attach the binary listed in this error", so_symbol->GetID()); + m_compile_unit_infos[i].so_file.SetFile(so_symbol->GetName().AsCString(), true); + m_compile_unit_infos[i].oso_file.SetFile(oso_symbol->GetName().AsCString(), true); + uint32_t sibling_idx = so_symbol->GetSiblingIndex(); + // The sibling index can't be less that or equal to the current index "i" + if (sibling_idx <= i) + { + m_obj_file->GetModule()->ReportError ("N_SO in symbol with UID %u has invalid sibling in debug map, please file a bug and attach the binary listed in this error", so_symbol->GetID()); + } + else + { + const Symbol* last_symbol = symtab->SymbolAtIndex (sibling_idx - 1); + m_compile_unit_infos[i].first_symbol_index = symtab->GetIndexForSymbol(so_symbol); + m_compile_unit_infos[i].last_symbol_index = symtab->GetIndexForSymbol(last_symbol); + m_compile_unit_infos[i].first_symbol_id = so_symbol->GetID(); + m_compile_unit_infos[i].last_symbol_id = last_symbol->GetID(); + + if (log) + log->Printf("Initialized OSO 0x%8.8x: file=%s", i, oso_symbol->GetName().GetCString()); + } } else { - const Symbol* last_symbol = symtab->SymbolAtIndex (sibling_idx - 1); - m_compile_unit_infos[i].first_symbol_index = symtab->GetIndexForSymbol(so_symbol); - m_compile_unit_infos[i].last_symbol_index = symtab->GetIndexForSymbol(last_symbol); - m_compile_unit_infos[i].first_symbol_id = so_symbol->GetID(); - m_compile_unit_infos[i].last_symbol_id = last_symbol->GetID(); - - if (log) - log->Printf("Initialized OSO 0x%8.8x: file=%s", i, oso_symbol->GetName().GetCString()); + if (oso_symbol == NULL) + m_obj_file->GetModule()->ReportError ("N_OSO symbol[%u] can't be found, please file a bug and attach the binary listed in this error", oso_idx); + else if (so_symbol == NULL) + m_obj_file->GetModule()->ReportError ("N_SO not found for N_OSO symbol[%u], please file a bug and attach the binary listed in this error", oso_idx); + else if (so_symbol->GetType() != eSymbolTypeSourceFile) + m_obj_file->GetModule()->ReportError ("N_SO has incorrect symbol type (%u) for N_OSO symbol[%u], please file a bug and attach the binary listed in this error", so_symbol->GetType(), oso_idx); + else if (oso_symbol->GetType() != eSymbolTypeSourceFile) + m_obj_file->GetModule()->ReportError ("N_OSO has incorrect symbol type (%u) for N_OSO symbol[%u], please file a bug and attach the binary listed in this error", oso_symbol->GetType(), oso_idx); } } } |