[Lldb-commits] [lldb] r174455 - Change ObjectFileMachO::ParseSymtab to read the external

Jason Molenda jmolenda at apple.com
Tue Feb 5 14:31:24 PST 2013


Author: jmolenda
Date: Tue Feb  5 16:31:24 2013
New Revision: 174455

URL: http://llvm.org/viewvc/llvm-project?rev=174455&view=rev
Log:
Change ObjectFileMachO::ParseSymtab to read the external
function stub routine addresses from an in-memory-only
MachO object file.  This was the only remaining part of
ParseSymtab() that was assuming a file exists.
<rdar://problem/13139585> 

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=174455&r1=174454&r2=174455&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Feb  5 16:31:24 2013
@@ -1290,6 +1290,7 @@ ObjectFileMachO::ParseSymtab (bool minim
         DataExtractor nlist_data (NULL, 0, byte_order, addr_byte_size);
         DataExtractor strtab_data (NULL, 0, byte_order, addr_byte_size);
         DataExtractor function_starts_data (NULL, 0, byte_order, addr_byte_size);
+        DataExtractor indirect_symbol_index_data (NULL, 0, byte_order, addr_byte_size);
         
         const addr_t nlist_data_byte_size = symtab_load_command.nsyms * nlist_byte_size;
         const addr_t strtab_data_byte_size = symtab_load_command.strsize;
@@ -1349,6 +1350,13 @@ ObjectFileMachO::ParseSymtab (bool minim
                     //DataBufferSP strtab_data_sp (ReadMemory (process_sp, strtab_addr, strtab_data_byte_size));
                     //if (strtab_data_sp)
                     //    strtab_data.SetData (strtab_data_sp, 0, strtab_data_sp->GetByteSize());
+                    if (m_dysymtab.nindirectsyms != 0)
+                    {
+                        const addr_t indirect_syms_addr = linkedit_load_addr + m_dysymtab.indirectsymoff - linkedit_file_offset;
+                        DataBufferSP indirect_syms_data_sp (ReadMemory (process_sp, indirect_syms_addr, m_dysymtab.nindirectsyms * 4));
+                        if (indirect_syms_data_sp)
+                            indirect_symbol_index_data.SetData (indirect_syms_data_sp, 0, indirect_syms_data_sp->GetByteSize());
+                    }
                     if (function_starts_load_command.cmd)
                     {
                         const addr_t func_start_addr = linkedit_load_addr + function_starts_load_command.dataoff - linkedit_file_offset;
@@ -1367,6 +1375,12 @@ ObjectFileMachO::ParseSymtab (bool minim
             strtab_data.SetData (m_data,
                                  symtab_load_command.stroff, 
                                  strtab_data_byte_size);
+            if (m_dysymtab.nindirectsyms != 0)
+            {
+                indirect_symbol_index_data.SetData (m_data, 
+                                                    m_dysymtab.indirectsymoff, 
+                                                    m_dysymtab.nindirectsyms * 4);
+            }
             if (function_starts_load_command.cmd)
             {
                 function_starts_data.SetData (m_data,
@@ -3168,8 +3182,6 @@ ObjectFileMachO::ParseSymtab (bool minim
         // Now synthesize indirect symbols
         if (m_dysymtab.nindirectsyms != 0)
         {
-            DataExtractor indirect_symbol_index_data (m_data, m_dysymtab.indirectsymoff, m_dysymtab.nindirectsyms * 4);
-
             if (indirect_symbol_index_data.GetByteSize())
             {
                 NListIndexToSymbolIndexMap::const_iterator end_index_pos = m_nlist_idx_to_sym_idx.end();





More information about the lldb-commits mailing list