[Lldb-commits] [lldb] r120814 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Greg Clayton gclayton at apple.com
Fri Dec 3 09:49:14 PST 2010


Author: gclayton
Date: Fri Dec  3 11:49:14 2010
New Revision: 120814

URL: http://llvm.org/viewvc/llvm-project?rev=120814&view=rev
Log:
Fixed an issue that would cause an assertion to fire when an inlined function was found during a regex function find call.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=120814&r1=120813&r2=120814&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Dec  3 11:49:14 2010
@@ -2025,20 +2025,52 @@
             curr_cu->ExtractDIEsIfNeeded (false);
 
         die = curr_cu->GetDIEAtIndexUnchecked(die_info_array[i].die_idx);
+        
+        const DWARFDebugInfoEntry* inlined_die = NULL;
+        if (die->Tag() == DW_TAG_inlined_subroutine)
+        {
+            inlined_die = die;
+            
+            while ((die = die->GetParent()) != NULL)
+            {
+                if (die->Tag() == DW_TAG_subprogram)
+                    break;
+            }
+        }
+        assert (die->Tag() == DW_TAG_subprogram);
         if (GetFunction (curr_cu, die, sc))
         {
-            // We found the function, so we should find the line table
-            // and line table entry as well
-            LineTable *line_table = sc.comp_unit->GetLineTable();
-            if (line_table == NULL)
+            Address addr;
+            // Parse all blocks if needed
+            if (inlined_die)
             {
-                if (ParseCompileUnitLineTable(sc))
-                    line_table = sc.comp_unit->GetLineTable();
+                sc.block = sc.function->GetBlock (true).FindBlockByID (inlined_die->GetOffset());
+                assert (sc.block != NULL);
+                if (sc.block->GetStartAddress (addr) == false)
+                    addr.Clear();
+            }
+            else 
+            {
+                sc.block = NULL;
+                addr = sc.function->GetAddressRange().GetBaseAddress();
             }
-            if (line_table != NULL)
-                line_table->FindLineEntryByAddress (sc.function->GetAddressRange().GetBaseAddress(), sc.line_entry);
 
-            sc_list.Append(sc);
+            if (addr.IsValid())
+            {
+            
+                // We found the function, so we should find the line table
+                // and line table entry as well
+                LineTable *line_table = sc.comp_unit->GetLineTable();
+                if (line_table == NULL)
+                {
+                    if (ParseCompileUnitLineTable(sc))
+                        line_table = sc.comp_unit->GetLineTable();
+                }
+                if (line_table != NULL)
+                    line_table->FindLineEntryByAddress (addr, sc.line_entry);
+
+                sc_list.Append(sc);
+            }
         }
     }
 }





More information about the lldb-commits mailing list