diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-05-26 19:39:56 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-05-26 19:39:56 +0000 |
commit | cb547cbb5cbe37f8481c4e61aaafa5cb1ec460ea (patch) | |
tree | 242120930b7421e47a7edb0c994e1b42e69a5fe4 /llvm/lib | |
parent | f99532faeedf86c62b80a0367929f49664db8759 (diff) | |
download | bcm5719-llvm-cb547cbb5cbe37f8481c4e61aaafa5cb1ec460ea.tar.gz bcm5719-llvm-cb547cbb5cbe37f8481c4e61aaafa5cb1ec460ea.zip |
[dwarfdump] Make -c and -p work together
When requesting to dump both the parent chain and children, we used to
print the DIE more than once because we propagated the dump options to
the parent without clearing the respective flags. This commit fixes this
oversight and adds a test.
rdar://39415292
Differential revision: https://reviews.llvm.org/D47263
llvm-svn: 333350
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index 64fa6e2c76a..a471d97d75d 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -475,8 +475,10 @@ void DWARFDie::dump(raw_ostream &OS, unsigned Indent, const uint32_t Offset = getOffset(); uint32_t offset = Offset; if (DumpOpts.ShowParents) { - DumpOpts.ShowParents = false; - Indent = dumpParentChain(getParent(), OS, Indent, DumpOpts); + DIDumpOptions ParentDumpOpts = DumpOpts; + ParentDumpOpts.ShowParents = false; + ParentDumpOpts.ShowChildren = false; + Indent = dumpParentChain(getParent(), OS, Indent, ParentDumpOpts); } if (debug_info_data.isValidOffset(offset)) { @@ -510,8 +512,10 @@ void DWARFDie::dump(raw_ostream &OS, unsigned Indent, DWARFDie child = getFirstChild(); if (DumpOpts.ShowChildren && DumpOpts.RecurseDepth > 0 && child) { DumpOpts.RecurseDepth--; + DIDumpOptions ChildDumpOpts = DumpOpts; + ChildDumpOpts.ShowParents = false; while (child) { - child.dump(OS, Indent + 2, DumpOpts); + child.dump(OS, Indent + 2, ChildDumpOpts); child = child.getSibling(); } } |