summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRainer Schuetze <r.sagitario@gmx.de>2015-06-09 07:20:06 (GMT)
committerRainer Schuetze <r.sagitario@gmx.de>2015-06-09 07:20:06 (GMT)
commit31af08b9e88552b8329d7956d862a578bfb19aa6 (patch)
tree09a584e6c64f4d7f1f14fcb279ab4007db7f1ba7 /src
parent6b9170a86e46f0a24f4c18d605caf31a085fd217 (diff)
downloadcv2pdb-31af08b9e88552b8329d7956d862a578bfb19aa6.zip
cv2pdb-31af08b9e88552b8329d7956d862a578bfb19aa6.tar.gz
cv2pdb-31af08b9e88552b8329d7956d862a578bfb19aa6.tar.bz2
DWARF: fix displaying locals if there are no function arguments
Diffstat (limited to 'src')
-rw-r--r--src/dwarf2pdb.cpp11
-rw-r--r--src/readDwarf.cpp6
-rw-r--r--src/readDwarf.h3
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);