本文整理汇总了C++中DWARFFormValue::getAsCString方法的典型用法代码示例。如果您正苦于以下问题:C++ DWARFFormValue::getAsCString方法的具体用法?C++ DWARFFormValue::getAsCString怎么用?C++ DWARFFormValue::getAsCString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DWARFFormValue
的用法示例。
在下文中一共展示了DWARFFormValue::getAsCString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dump
void DWARFTypeUnit::dump(raw_ostream &OS, bool SummarizeTypes) {
const DWARFDebugInfoEntryMinimal *TD =
getDIEForOffset(TypeOffset + getOffset());
DWARFFormValue NameVal;
const char *Name = "";
if (TD->getAttributeValue(this, llvm::dwarf::DW_AT_name, NameVal))
if (auto ON = NameVal.getAsCString(this))
Name = *ON;
if (SummarizeTypes) {
OS << "name = '" << Name << "'"
<< " type_signature = " << format("0x%16" PRIx64, TypeHash)
<< " length = " << format("0x%08x", getLength()) << '\n';
return;
}
OS << format("0x%08x", getOffset()) << ": Type Unit:"
<< " length = " << format("0x%08x", getLength())
<< " version = " << format("0x%04x", getVersion())
<< " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
<< " addr_size = " << format("0x%02x", getAddressByteSize())
<< " name = '" << Name << "'"
<< " type_signature = " << format("0x%16" PRIx64, TypeHash)
<< " type_offset = " << format("0x%04x", TypeOffset)
<< " (next unit at " << format("0x%08x", getNextUnitOffset()) << ")\n";
if (const DWARFDebugInfoEntryMinimal *TU = getUnitDIE(false))
TU->dump(OS, this, -1U);
else
OS << "<type unit can't be parsed!>\n\n";
}
示例2:
const char *DWARFDebugInfoEntryMinimal::getAttributeValueAsString(
const DWARFUnit *U, const uint16_t Attr, const char *FailValue) const {
DWARFFormValue FormValue;
if (!getAttributeValue(U, Attr, FormValue))
return FailValue;
Optional<const char *> Result = FormValue.getAsCString(U);
return Result.hasValue() ? Result.getValue() : FailValue;
}