[Lldb-commits] [lldb] r137475 - in /lldb/trunk/source/Plugins/SymbolFile/DWARF: SymbolFileDWARF.cpp SymbolFileDWARF.h

Greg Clayton gclayton at apple.com
Fri Aug 12 10:54:33 PDT 2011


Author: gclayton
Date: Fri Aug 12 12:54:33 2011
New Revision: 137475

URL: http://llvm.org/viewvc/llvm-project?rev=137475&view=rev
Log:
Fixed the issue of a DW_TAG_subprogram in a DW_TAG_subprogram correctly this
time after recently backing out another fix.


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

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=137475&r1=137474&r2=137475&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Aug 12 12:54:33 2011
@@ -1010,8 +1010,7 @@
     DWARFCompileUnit* dwarf_cu,
     const DWARFDebugInfoEntry *die,
     addr_t subprogram_low_pc,
-    bool parse_siblings,
-    bool parse_children
+    uint32_t depth
 )
 {
     size_t blocks_added = 0;
@@ -1025,20 +1024,27 @@
         case DW_TAG_subprogram:
         case DW_TAG_lexical_block:
             {
-                DWARFDebugRanges::RangeList ranges;
-                const char *name = NULL;
-                const char *mangled_name = NULL;
                 Block *block = NULL;
-                if (tag != DW_TAG_subprogram)
+                if (tag == DW_TAG_subprogram)
                 {
-                    BlockSP block_sp(new Block (die->GetOffset()));
-                    parent_block->AddChild(block_sp);
-                    block = block_sp.get();
+                    // Skip any DW_TAG_subprogram DIEs that are inside
+                    // of a normal or inlined functions. These will be 
+                    // parsed on their own as separate entities.
+
+                    if (depth > 0)
+                        break;
+
+                    block = parent_block;
                 }
                 else
                 {
-                    block = parent_block;
+                    BlockSP block_sp(new Block (die->GetOffset()));
+                    parent_block->AddChild(block_sp);
+                    block = block_sp.get();
                 }
+                DWARFDebugRanges::RangeList ranges;
+                const char *name = NULL;
+                const char *mangled_name = NULL;
 
                 int decl_file = 0;
                 int decl_line = 0;
@@ -1094,15 +1100,14 @@
 
                     ++blocks_added;
 
-                    if (parse_children && die->HasChildren())
+                    if (die->HasChildren())
                     {
                         blocks_added += ParseFunctionBlocks (sc, 
                                                              block, 
                                                              dwarf_cu, 
                                                              die->GetFirstChild(), 
                                                              subprogram_low_pc, 
-                                                             true, 
-                                                             true);
+                                                             depth + 1);
                     }
                 }
             }
@@ -1111,10 +1116,14 @@
             break;
         }
 
-        if (parse_siblings)
-            die = die->GetSibling();
-        else
+        // Only parse siblings of the block if we are not at depth zero. A depth
+        // of zero indicates we are currently parsing the top level 
+        // DW_TAG_subprogram DIE
+        
+        if (depth == 0)
             die = NULL;
+        else
+            die = die->GetSibling();
     }
     return blocks_added;
 }
@@ -4020,7 +4029,7 @@
         const DWARFDebugInfoEntry *function_die = dwarf_cu->GetDIEPtr(function_die_offset);
         if (function_die)
         {
-            ParseFunctionBlocks(sc, &sc.function->GetBlock (false), dwarf_cu, function_die, LLDB_INVALID_ADDRESS, false, true);
+            ParseFunctionBlocks(sc, &sc.function->GetBlock (false), dwarf_cu, function_die, LLDB_INVALID_ADDRESS, 0);
         }
     }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=137475&r1=137474&r2=137475&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Fri Aug 12 12:54:33 2011
@@ -244,8 +244,7 @@
                                                  DWARFCompileUnit* dwarf_cu,
                                                  const DWARFDebugInfoEntry *die,
                                                  lldb::addr_t subprogram_low_pc,
-                                                 bool parse_siblings,
-                                                 bool parse_children);
+                                                 uint32_t depth);
     size_t                  ParseTypes (const lldb_private::SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die, bool parse_siblings, bool parse_children);
     lldb::TypeSP            ParseType (const lldb_private::SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die, bool *type_is_new);
 





More information about the lldb-commits mailing list