本文整理汇总了C++中DWARFAddressRangesVector::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ DWARFAddressRangesVector::empty方法的具体用法?C++ DWARFAddressRangesVector::empty怎么用?C++ DWARFAddressRangesVector::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DWARFAddressRangesVector
的用法示例。
在下文中一共展示了DWARFAddressRangesVector::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verifyDieRanges
unsigned DWARFVerifier::verifyDieRanges(const DWARFDie &Die,
DieRangeInfo &ParentRI) {
unsigned NumErrors = 0;
if (!Die.isValid())
return NumErrors;
DWARFAddressRangesVector Ranges = Die.getAddressRanges();
// Build RI for this DIE and check that ranges within this DIE do not
// overlap.
DieRangeInfo RI(Die);
for (auto Range : Ranges) {
if (!Range.valid()) {
++NumErrors;
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() << "DIE has overlapping address ranges: " << Range << " and "
<< *IntersectingRange << "\n";
break;
}
}
// Verify that children don't intersect.
const auto IntersectingChild = ParentRI.insert(RI);
if (IntersectingChild != ParentRI.Children.end()) {
++NumErrors;
error() << "DIEs have overlapping address ranges:";
Die.dump(OS, 0);
IntersectingChild->Die.dump(OS, 0);
OS << "\n";
}
// Verify that ranges are contained within their parent.
bool ShouldBeContained = !Ranges.empty() && !ParentRI.Ranges.empty() &&
!(Die.getTag() == DW_TAG_subprogram &&
ParentRI.Die.getTag() == DW_TAG_subprogram);
if (ShouldBeContained && !ParentRI.contains(RI)) {
++NumErrors;
error() << "DIE address ranges are not "
"contained in its parent's ranges:";
Die.dump(OS, 0);
ParentRI.Die.dump(OS, 0);
OS << "\n";
}
// Recursively check children.
for (DWARFDie Child : Die)
NumErrors += verifyDieRanges(Child, RI);
return NumErrors;
}
示例2: dumpRanges
static void dumpRanges(raw_ostream &OS, const DWARFAddressRangesVector& Ranges,
unsigned AddressSize, unsigned Indent) {
if (Ranges.empty())
return;
for (const auto &Range: Ranges) {
OS << '\n';
OS.indent(Indent);
OS << format("[0x%0*" PRIx64 " - 0x%0*" PRIx64 ")",
AddressSize*2, Range.first,
AddressSize*2, Range.second);
}
}