コード例 #1
0
ファイル: DWARFTypeUnit.cpp プロジェクト: shepmaster/llvm
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
0
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;
}