Fixed an assertion that could happen if we happened to parse a mach-o object
file that had a symbol that had a section specified where the section had
zero size. We now honor this section definition for the symbol and don't
assert anymore.
llvm-svn: 138646
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 083cb1f..4229cb7 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -686,7 +686,18 @@
}
}
if (m_section_infos[n_sect].vm_range.Contains(file_addr))
+ {
+ // Symbol is in section.
return m_section_infos[n_sect].section;
+ }
+ else if (m_section_infos[n_sect].vm_range.GetByteSize () == 0 &&
+ m_section_infos[n_sect].vm_range.GetBaseAddress() == file_addr)
+ {
+ // Symbol is in section with zero size, but has the same start
+ // address as the section. This can happen with linker symbols
+ // (symbols that start with the letter 'l' or 'L'.
+ return m_section_infos[n_sect].section;
+ }
}
return m_section_list->FindSectionContainingFileAddress(file_addr).get();
}
@@ -1162,7 +1173,13 @@
case NListTypeSection: // N_SECT
symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
- assert(symbol_section != NULL);
+ if (symbol_section == NULL)
+ {
+ // TODO: warn about this?
+ add_nlist = false;
+ break;
+ }
+
if (TEXT_eh_frame_sectID == nlist.n_sect)
{
type = eSymbolTypeException;