summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-dwarfdump/Statistics.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-11-05 14:46:54 +0100
committerPavel Labath <pavel@labath.sk>2019-11-15 13:38:00 +0100
commit0908093977b2b80d00baa12f0b2f1424dde096fb (patch)
treefb4b665cad7f163289f1caa963afeb501a880406 /llvm/tools/llvm-dwarfdump/Statistics.cpp
parentc953e061b410163bc54771f186176a92aac04008 (diff)
downloadbcm5719-llvm-0908093977b2b80d00baa12f0b2f1424dde096fb.tar.gz
bcm5719-llvm-0908093977b2b80d00baa12f0b2f1424dde096fb.zip
DWARFDebugLoc(v4): Add an incremental parsing function
Summary: This adds a visitLocationList function to the DWARF v4 location lists, similar to what already exists for DWARF v5. It follows the approach outlined in previous patches (D69672), where the parsed form is always stored in the DWARF v5 format, which makes it easier for generic code to be built on top of that. v4 location lists are "upgraded" during parsing, and then this upgrade is undone while dumping. Both "inline" and section-based dumping is rewritten to reuse the existing "generic" location list dumper. This means that the output format is consistent for all location lists (the only thing one needs to implement is the function which prints the "raw" form of a location list), and that debug_loc dumping correctly processes base address selection entries, etc. The previous existing debug_loc functionality (e.g., parseOneLocationList) is rewritten on top of the new API, but it is not removed as there is still code which uses them. This will be done in follow-up patches, after I build the API to access the "interpreted" location lists in a generic way (as that is what those users really want). Reviewers: dblaikie, probinson, JDevlieghere, aprantl, SouraVX Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69847
Diffstat (limited to 'llvm/tools/llvm-dwarfdump/Statistics.cpp')
-rw-r--r--llvm/tools/llvm-dwarfdump/Statistics.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/tools/llvm-dwarfdump/Statistics.cpp b/llvm/tools/llvm-dwarfdump/Statistics.cpp
index c29ad783a9e..8b92aab194d 100644
--- a/llvm/tools/llvm-dwarfdump/Statistics.cpp
+++ b/llvm/tools/llvm-dwarfdump/Statistics.cpp
@@ -249,15 +249,22 @@ static void collectStatsForDie(DWARFDie Die, uint64_t UnitLowPC, std::string FnP
// Get PC coverage.
if (auto DebugLocOffset = FormValue->getAsSectionOffset()) {
auto *DebugLoc = Die.getDwarfUnit()->getContext().getDebugLoc();
+ // TODO: This code does not handle DWARF5 nor DWARF4 base address
+ // selection entries. This should use a higher-level API which abstracts
+ // these away.
if (auto List = DebugLoc->getLocationListAtOffset(*DebugLocOffset)) {
- for (auto Entry : List->Entries) {
- uint64_t BytesEntryCovered = Entry.End - Entry.Begin;
+ ArrayRef<DWARFLocationEntry> Entries = List->Entries;
+ // Ignore end-of-list entries
+ Entries = Entries.drop_back();
+
+ for (auto Entry : Entries) {
+ uint64_t BytesEntryCovered = Entry.Value1 - Entry.Value0;
BytesCovered += BytesEntryCovered;
if (IsEntryValue(Entry.Loc))
BytesEntryValuesCovered += BytesEntryCovered;
}
- if (List->Entries.size()) {
- uint64_t FirstDef = List->Entries[0].Begin;
+ if (Entries.size()) {
+ uint64_t FirstDef = Entries[0].Value0;
uint64_t UnitOfs = UnitLowPC;
// Ranges sometimes start before the lexical scope.
if (UnitOfs + FirstDef >= ScopeLowPC)
OpenPOWER on IntegriCloud