本文整理汇总了C++中DWARFDie::children方法的典型用法代码示例。如果您正苦于以下问题:C++ DWARFDie::children方法的具体用法?C++ DWARFDie::children怎么用?C++ DWARFDie::children使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DWARFDie
的用法示例。
在下文中一共展示了DWARFDie::children方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dumpArrayType
static void dumpArrayType(raw_ostream &OS, const DWARFDie &D) {
Optional<uint64_t> Bound;
for (const DWARFDie &C : D.children())
if (C.getTag() == DW_TAG_subrange_type) {
Optional<uint64_t> LB;
Optional<uint64_t> Count;
Optional<uint64_t> UB;
Optional<unsigned> DefaultLB;
if (Optional<DWARFFormValue> L = C.find(DW_AT_lower_bound))
LB = L->getAsUnsignedConstant();
if (Optional<DWARFFormValue> CountV = C.find(DW_AT_count))
Count = CountV->getAsUnsignedConstant();
if (Optional<DWARFFormValue> UpperV = C.find(DW_AT_upper_bound))
UB = UpperV->getAsUnsignedConstant();
if (Optional<DWARFFormValue> LV =
D.getDwarfUnit()->getUnitDIE().find(DW_AT_language))
if (Optional<uint64_t> LC = LV->getAsUnsignedConstant())
if ((DefaultLB =
LanguageLowerBound(static_cast<dwarf::SourceLanguage>(*LC))))
if (LB && *LB == *DefaultLB)
LB = None;
if (!LB && !Count && !UB)
OS << "[]";
else if (!LB && (Count || UB) && DefaultLB)
OS << '[' << (Count ? *Count : *UB - *DefaultLB + 1) << ']';
else {
OS << "[[";
if (LB)
OS << *LB;
else
OS << '?';
OS << ", ";
if (Count)
if (LB)
OS << *LB + *Count;
else
OS << "? + " << *Count;
else if (UB)
OS << *UB + 1;
else
OS << '?';
OS << ")]";
}
}
}
示例2: dumpTypeName
/// Recursively dump the DIE type name when applicable.
static void dumpTypeName(raw_ostream &OS, const DWARFDie &D) {
if (!D.isValid())
return;
if (const char *Name = D.getName(DINameKind::LinkageName)) {
OS << Name;
return;
}
// FIXME: We should have pretty printers per language. Currently we print
// everything as if it was C++ and fall back to the TAG type name.
const dwarf::Tag T = D.getTag();
switch (T) {
case DW_TAG_array_type:
case DW_TAG_pointer_type:
case DW_TAG_ptr_to_member_type:
case DW_TAG_reference_type:
case DW_TAG_rvalue_reference_type:
case DW_TAG_subroutine_type:
break;
default:
dumpTypeTagName(OS, T);
}
// Follow the DW_AT_type if possible.
DWARFDie TypeDie = D.getAttributeValueAsReferencedDie(DW_AT_type);
dumpTypeName(OS, TypeDie);
switch (T) {
case DW_TAG_subroutine_type: {
if (!TypeDie)
OS << "void";
OS << '(';
bool First = true;
for (const DWARFDie &C : D.children()) {
if (C.getTag() == DW_TAG_formal_parameter) {
if (!First)
OS << ", ";
First = false;
dumpTypeName(OS, C.getAttributeValueAsReferencedDie(DW_AT_type));
}
}
OS << ')';
break;
}
case DW_TAG_array_type: {
dumpArrayType(OS, D);
break;
}
case DW_TAG_pointer_type:
OS << '*';
break;
case DW_TAG_ptr_to_member_type:
if (DWARFDie Cont =
D.getAttributeValueAsReferencedDie(DW_AT_containing_type)) {
dumpTypeName(OS << ' ', Cont);
OS << "::";
}
OS << '*';
break;
case DW_TAG_reference_type:
OS << '&';
break;
case DW_TAG_rvalue_reference_type:
OS << "&&";
break;
default:
break;
}
}