当前位置: 首页>>代码示例>>C++>>正文


C++ DWARFFormValue::getAsCString方法代码示例

本文整理汇总了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";
}
开发者ID:shepmaster,项目名称:llvm,代码行数:31,代码来源:DWARFTypeUnit.cpp

示例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;
}
开发者ID:Fairly,项目名称:opencor,代码行数:8,代码来源:DWARFDebugInfoEntry.cpp


注:本文中的DWARFFormValue::getAsCString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。