diff options
author | Greg Clayton <gclayton@apple.com> | 2011-08-12 17:54:33 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-08-12 17:54:33 +0000 |
commit | dd7feaf664969541280dd7d2bbe49a444fed7431 (patch) | |
tree | b1677cfcfe444fe811440aa035e88b55d17ccc81 | |
parent | 5ec04a51faff5af0824b48a7ba469950ca2f90bc (diff) | |
download | bcm5719-llvm-dd7feaf664969541280dd7d2bbe49a444fed7431.tar.gz bcm5719-llvm-dd7feaf664969541280dd7d2bbe49a444fed7431.zip |
Fixed the issue of a DW_TAG_subprogram in a DW_TAG_subprogram correctly this
time after recently backing out another fix.
llvm-svn: 137475
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 43 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h | 3 |
2 files changed, 27 insertions, 19 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index ba45a34c9b9..3a6ebc4cd35 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1010,8 +1010,7 @@ SymbolFileDWARF::ParseFunctionBlocks 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 @@ SymbolFileDWARF::ParseFunctionBlocks 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 @@ SymbolFileDWARF::ParseFunctionBlocks ++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 @@ SymbolFileDWARF::ParseFunctionBlocks 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 @@ SymbolFileDWARF::ParseFunctionBlocks (const SymbolContext &sc) 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); } } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index 052e4e169e6..8f6ef045c70 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -244,8 +244,7 @@ protected: 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); |