diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dwarf2pdb.cpp | 11 | ||||
-rw-r--r-- | src/readDwarf.cpp | 6 | ||||
-rw-r--r-- | src/readDwarf.h | 3 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/dwarf2pdb.cpp b/src/dwarf2pdb.cpp index 6113b75..beabddd 100644 --- a/src/dwarf2pdb.cpp +++ b/src/dwarf2pdb.cpp @@ -297,15 +297,20 @@ bool CV2PDB::addDWARFProc(DWARF_InfoData& procid, DWARF_CompilationUnit* cu, DIE cursor = lexicalBlocks.back();
lexicalBlocks.pop_back();
- while (cursor.readSibling(id))
+ L_nextBlock:
+ if (cursor.readNext(id))
{
+ L_nextSibling:
if (id.tag == DW_TAG_lexical_block)
{
if (id.hasChild && id.pchi != id.pclo)
{
appendLexicalBlock(id, pclo + codeSegOff);
- lexicalBlocks.push_back(cursor);
+ DIECursor next = cursor;
+ next.gotoSibling();
+ lexicalBlocks.push_back(next);
cursor = cursor.getSubtreeCursor();
+ goto L_nextBlock;
}
}
else if (id.tag == DW_TAG_variable)
@@ -317,6 +322,8 @@ bool CV2PDB::addDWARFProc(DWARF_InfoData& procid, DWARF_CompilationUnit* cu, DIE appendStackVar(id.name, getTypeByDWARFPtr(cu, id.type), loc);
}
}
+ if (cursor.readSibling(id))
+ goto L_nextSibling;
}
appendEnd();
}
diff --git a/src/readDwarf.cpp b/src/readDwarf.cpp index f0890bb..46be7b6 100644 --- a/src/readDwarf.cpp +++ b/src/readDwarf.cpp @@ -318,7 +318,7 @@ DIECursor::DIECursor(DWARF_CompilationUnit* cu_, byte* ptr_) }
-bool DIECursor::readSibling(DWARF_InfoData& id)
+void DIECursor::gotoSibling()
{
if (sibling)
{
@@ -337,7 +337,11 @@ bool DIECursor::readSibling(DWARF_InfoData& id) while (level > currLevel)
readNext(dummy);
}
+}
+bool DIECursor::readSibling(DWARF_InfoData& id)
+{
+ gotoSibling();
return readNext(id, true);
}
diff --git a/src/readDwarf.h b/src/readDwarf.h index 813c1fd..71b43a2 100644 --- a/src/readDwarf.h +++ b/src/readDwarf.h @@ -356,6 +356,9 @@ public: // Create a new DIECursor
DIECursor(DWARF_CompilationUnit* cu_, byte* ptr);
+ // Goto next sibling DIE. If the last read DIE had any children, they will be skipped over.
+ void gotoSibling();
+
// Reads next sibling DIE. If the last read DIE had any children, they will be skipped over.
// Returns 'false' upon reaching the last sibling on the current level.
bool readSibling(DWARF_InfoData& id);
|