[Lldb-commits] [lldb] r267237 - Fixed in issue with ObjectFileMachO where it would add empty sections to the section list that was used to try and cap symbols to the max address of the section in which it is contained. The empty sections would make cap the symbols and make their sizes zero. Also fixed a few other things that could cause problems in the SymbolFileDWARFDebugMap when zero sized symbols were found and used to make OSO range map entries.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 22 15:35:09 PDT 2016


Author: gclayton
Date: Fri Apr 22 17:35:08 2016
New Revision: 267237

URL: http://llvm.org/viewvc/llvm-project?rev=267237&view=rev
Log:
Fixed in issue with ObjectFileMachO where it would add empty sections to the section list that was used to try and cap symbols to the max address of the section in which it is contained. The empty sections would make cap the symbols and make their sizes zero. Also fixed a few other things that could cause problems in the SymbolFileDWARFDebugMap when zero sized symbols were found and used to make OSO range map entries.

<rdar://problem/25886773>


Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
    lldb/trunk/source/Symbol/Symtab.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=267237&r1=267236&r2=267237&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Fri Apr 22 17:35:08 2016
@@ -123,8 +123,9 @@ SymbolFileDWARFDebugMap::CompileUnitInfo
                                 // Add the inverse OSO file address to debug map entry mapping
                                 exe_symfile->AddOSOFileRange (this,
                                                               exe_symbol->GetAddressRef().GetFileAddress(),
+                                                              exe_symbol->GetByteSize(),
                                                               oso_fun_symbol->GetAddressRef().GetFileAddress(),
-                                                              std::min<addr_t>(exe_symbol->GetByteSize(), oso_fun_symbol->GetByteSize()));
+                                                              oso_fun_symbol->GetByteSize());
 
                             }
                         }
@@ -157,8 +158,9 @@ SymbolFileDWARFDebugMap::CompileUnitInfo
                                 // Add the inverse OSO file address to debug map entry mapping
                                 exe_symfile->AddOSOFileRange (this,
                                                               exe_symbol->GetAddressRef().GetFileAddress(),
+                                                              exe_symbol->GetByteSize(),
                                                               oso_gsym_symbol->GetAddressRef().GetFileAddress(),
-                                                              std::min<addr_t>(exe_symbol->GetByteSize(), oso_gsym_symbol->GetByteSize()));
+                                                              oso_gsym_symbol->GetByteSize());
                             }
                         }
                         break;
@@ -1456,6 +1458,7 @@ SymbolFileDWARFDebugMap::ParseDeclsForCo
 bool
 SymbolFileDWARFDebugMap::AddOSOFileRange (CompileUnitInfo *cu_info,
                                           lldb::addr_t exe_file_addr,
+                                          lldb::addr_t exe_byte_size,
                                           lldb::addr_t oso_file_addr,
                                           lldb::addr_t oso_byte_size)
 {
@@ -1464,7 +1467,14 @@ SymbolFileDWARFDebugMap::AddOSOFileRange
     {
         DebugMap::Entry *debug_map_entry = m_debug_map.FindEntryThatContains(exe_file_addr);
         debug_map_entry->data.SetOSOFileAddress(oso_file_addr);
-        cu_info->file_range_map.Append(FileRangeMap::Entry(oso_file_addr, oso_byte_size, exe_file_addr));
+        addr_t range_size = std::min<addr_t>(exe_byte_size, oso_byte_size);
+        if (range_size == 0)
+        {
+            range_size = std::max<addr_t>(exe_byte_size, oso_byte_size);
+            if (range_size == 0)
+                range_size = 1;
+        }
+        cu_info->file_range_map.Append(FileRangeMap::Entry(oso_file_addr, range_size, exe_file_addr));
         return true;
     }
     return false;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=267237&r1=267236&r2=267237&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Fri Apr 22 17:35:08 2016
@@ -349,6 +349,7 @@ protected:
     bool
     AddOSOFileRange (CompileUnitInfo *cu_info,
                      lldb::addr_t exe_file_addr,
+                     lldb::addr_t exe_byte_size,
                      lldb::addr_t oso_file_addr,
                      lldb::addr_t oso_byte_size);
     

Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=267237&r1=267236&r2=267237&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Fri Apr 22 17:35:08 2016
@@ -915,12 +915,15 @@ AddSectionsToRangeMap (SectionList *sect
             }
             else
             {
-                addr_t base_addr = sect_sp->GetFileAddress();
                 size_t size = sect_sp->GetByteSize();
-                RangeVector<addr_t, addr_t>::Entry entry;
-                entry.SetRangeBase (base_addr);
-                entry.SetByteSize (size);
-                section_ranges.Append (entry);
+                if (size > 0)
+                {
+                    addr_t base_addr = sect_sp->GetFileAddress();
+                    RangeVector<addr_t, addr_t>::Entry entry;
+                    entry.SetRangeBase (base_addr);
+                    entry.SetByteSize (size);
+                    section_ranges.Append (entry);
+                }
             }
         }
     }




More information about the lldb-commits mailing list