[PATCH] D38395: [dwarfdump][NFC] Consistent printing of address ranges
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 29 03:42:09 PDT 2017
JDevlieghere created this revision.
This implement the insertion operator for DWARF address ranges so they
are consistently printed as [LowPC, HighPC).
While a dump method might have felt more consistent, it is used
exclusively for printing error messages in the verifier and never used
for actual dumping. Hence this approach is more intuitive and creates
less clutter at the call sites.
Repository:
rL LLVM
https://reviews.llvm.org/D38395
Files:
include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
lib/DebugInfo/DWARF/DWARFVerifier.cpp
Index: lib/DebugInfo/DWARF/DWARFVerifier.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -315,21 +315,16 @@
for (auto Range : Ranges) {
if (!Range.valid()) {
++NumErrors;
- error() << format("Invalid address range [0x%08" PRIx64 " - 0x%08" PRIx64
- "].\n",
- Range.LowPC, Range.HighPC);
+ error() << "Invalid address range " << Range << "\n";
continue;
}
// Verify that ranges don't intersect.
const auto IntersectingRange = RI.insert(Range);
if (IntersectingRange != RI.Ranges.end()) {
++NumErrors;
- error() << format("DIE has overlapping address ranges: [0x%08" PRIx64
- " - 0x%08" PRIx64 "] and [0x%08" PRIx64
- " - 0x%08" PRIx64 "].\n",
- Range.LowPC, Range.HighPC, IntersectingRange->LowPC,
- IntersectingRange->HighPC);
+ error() << "DIE has overlapping address ranges: " << Range << " and "
+ << *IntersectingRange << "\n";
break;
}
}
Index: lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
+++ lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
@@ -17,6 +17,11 @@
using namespace llvm;
+raw_ostream &llvm::operator<<(raw_ostream &OS, const DWARFAddressRange &R) {
+ return OS << format("[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")", R.LowPC,
+ R.HighPC);
+}
+
void DWARFDebugRangeList::clear() {
Offset = -1U;
AddressSize = 0;
Index: include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
===================================================================
--- include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
+++ include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
@@ -57,6 +57,8 @@
return std::tie(LHS.LowPC, LHS.HighPC) < std::tie(RHS.LowPC, RHS.HighPC);
}
+raw_ostream &operator<<(raw_ostream &OS, const DWARFAddressRange &R);
+
/// DWARFAddressRangesVector - represents a set of absolute address ranges.
using DWARFAddressRangesVector = std::vector<DWARFAddressRange>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38395.117116.patch
Type: text/x-patch
Size: 2274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170929/6707919f/attachment.bin>
More information about the llvm-commits
mailing list