summaryrefslogtreecommitdiff
path: root/lib/DebugInfo/DWARFDebugRangeList.cpp
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-09-04 08:12:33 +0000
committerAlexey Samsonov <samsonov@google.com>2012-09-04 08:12:33 +0000
commit5eae90d727c64ca5b4b43b110521b38dcd9f0de6 (patch)
treeb932b5a23ada1047a06817c055c1e97a469f39a9 /lib/DebugInfo/DWARFDebugRangeList.cpp
parent2d5c28da0d14883cd0cd6fcf38d7e28040b634c0 (diff)
downloadllvm-5eae90d727c64ca5b4b43b110521b38dcd9f0de6.tar.gz
llvm-5eae90d727c64ca5b4b43b110521b38dcd9f0de6.tar.bz2
llvm-5eae90d727c64ca5b4b43b110521b38dcd9f0de6.tar.xz
Add support for fetching inlining context (stack of source code locations)
by instruction address from DWARF. Add --inlining flag to llvm-dwarfdump to demonstrate and test this functionality, so that "llvm-dwarfdump --inlining --address=0x..." now works much like "addr2line -i 0x...", provided that the binary has debug info (Clang's -gline-tables-only *is* enough). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163128 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo/DWARFDebugRangeList.cpp')
-rw-r--r--lib/DebugInfo/DWARFDebugRangeList.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/DebugInfo/DWARFDebugRangeList.cpp b/lib/DebugInfo/DWARFDebugRangeList.cpp
index fa15bb0ee5..1806beee72 100644
--- a/lib/DebugInfo/DWARFDebugRangeList.cpp
+++ b/lib/DebugInfo/DWARFDebugRangeList.cpp
@@ -37,10 +37,7 @@ bool DWARFDebugRangeList::extract(DataExtractor data, uint32_t *offset_ptr) {
clear();
return false;
}
- // The end of any given range list is marked by an end of list entry,
- // which consists of a 0 for the beginning address offset
- // and a 0 for the ending address offset.
- if (entry.StartAddress == 0 && entry.EndAddress == 0)
+ if (entry.isEndOfListEntry())
break;
Entries.push_back(entry);
}
@@ -57,3 +54,14 @@ void DWARFDebugRangeList::dump(raw_ostream &OS) const {
}
OS << format("%08x <End of list>\n", Offset);
}
+
+bool DWARFDebugRangeList::containsAddress(uint64_t BaseAddress,
+ uint64_t Address) const {
+ for (int i = 0, n = Entries.size(); i != n; ++i) {
+ if (Entries[i].isBaseAddressSelectionEntry(AddressSize))
+ BaseAddress = Entries[i].EndAddress;
+ else if (Entries[i].containsAddress(BaseAddress, Address))
+ return true;
+ }
+ return false;
+}