[Lldb-commits] [lldb] r138646 - /lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Greg Clayton gclayton at apple.com
Fri Aug 26 13:01:35 PDT 2011


Author: gclayton
Date: Fri Aug 26 15:01:35 2011
New Revision: 138646

URL: http://llvm.org/viewvc/llvm-project?rev=138646&view=rev
Log:
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.


Modified:
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=138646&r1=138645&r2=138646&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Fri Aug 26 15:01:35 2011
@@ -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;





More information about the lldb-commits mailing list