summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-04-19 15:28:58 +0000
committerDehao Chen <dehao@google.com>2017-04-19 15:28:58 +0000
commite0b77b24d966e8ffff87f35130161106446e3938 (patch)
tree9000e26b09c40a14012a7979aed1db634a943b1e /llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
parent333b2bf2ed997fe84ec65c007315048b0281a194 (diff)
downloadbcm5719-llvm-e0b77b24d966e8ffff87f35130161106446e3938.tar.gz
bcm5719-llvm-e0b77b24d966e8ffff87f35130161106446e3938.zip
Revert r300697 which causes buildbot failure.
llvm-svn: 300708
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDie.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDie.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index 24039eb3520..b88cc636d84 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -352,6 +352,32 @@ void DWARFDie::dump(raw_ostream &OS, unsigned RecurseDepth,
}
}
+void DWARFDie::getInlinedChainForAddress(
+ const uint64_t Address, SmallVectorImpl<DWARFDie> &InlinedChain) const {
+ if (isNULL())
+ return;
+ DWARFDie DIE(*this);
+ while (DIE) {
+ // Append current DIE to inlined chain only if it has correct tag
+ // (e.g. it is not a lexical block).
+ if (DIE.isSubroutineDIE())
+ InlinedChain.push_back(DIE);
+
+ // Try to get child which also contains provided address.
+ DWARFDie Child = DIE.getFirstChild();
+ while (Child) {
+ if (Child.addressRangeContainsAddress(Address)) {
+ // Assume there is only one such child.
+ break;
+ }
+ Child = Child.getSibling();
+ }
+ DIE = Child;
+ }
+ // Reverse the obtained chain to make the root of inlined chain last.
+ std::reverse(InlinedChain.begin(), InlinedChain.end());
+}
+
DWARFDie DWARFDie::getParent() const {
if (isValid())
return U->getParent(Die);
OpenPOWER on IntegriCloud