LLVM  7.0.0svn
DWARFTypeUnit.cpp
Go to the documentation of this file.
1 //===- DWARFTypeUnit.cpp --------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
15 #include "llvm/Support/Format.h"
17 #include <cinttypes>
18 
19 using namespace llvm;
20 
23  const char *Name = TD.getName(DINameKind::ShortName);
24 
25  if (DumpOpts.SummarizeTypes) {
26  OS << "name = '" << Name << "'"
27  << " type_signature = " << format("0x%016" PRIx64, getTypeHash())
28  << " length = " << format("0x%08x", getLength()) << '\n';
29  return;
30  }
31 
32  OS << format("0x%08x", getOffset()) << ": Type Unit:"
33  << " length = " << format("0x%08x", getLength())
34  << " version = " << format("0x%04x", getVersion());
35  if (getVersion() >= 5)
36  OS << " unit_type = " << dwarf::UnitTypeString(getUnitType());
37  OS << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
38  << " addr_size = " << format("0x%02x", getAddressByteSize())
39  << " name = '" << Name << "'"
40  << " type_signature = " << format("0x%016" PRIx64, getTypeHash())
41  << " type_offset = " << format("0x%04x", getTypeOffset())
42  << " (next unit at " << format("0x%08x", getNextUnitOffset()) << ")\n";
43 
44  if (DWARFDie TU = getUnitDIE(false))
45  TU.dump(OS, 0, DumpOpts);
46  else
47  OS << "<type unit can't be parsed!>\n\n";
48 }
const DWARFAbbreviationDeclarationSet * getAbbreviations() const
Definition: DWARFUnit.cpp:632
void dump(raw_ostream &OS, DIDumpOptions DumpOpts={})
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
uint32_t getTypeOffset() const
Definition: DWARFTypeUnit.h:38
uint32_t getNextUnitOffset() const
Definition: DWARFUnit.h:345
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:338
uint16_t getVersion() const
Definition: DWARFUnit.h:337
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:154
Utility class that carries the DWARF compile/type unit and the debug info entry in an object...
Definition: DWARFDie.h:43
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
Definition: DWARFUnit.h:438
const char * getName(DINameKind Kind) const
Return the DIE name resolving DW_AT_sepcification or DW_AT_abstract_origin references if necessary...
Definition: DWARFDie.cpp:444
StringRef UnitTypeString(unsigned)
Definition: Dwarf.cpp:480
uint32_t getLength() const
Definition: DWARFUnit.h:343
uint32_t getOffset() const
Definition: DWARFUnit.h:333
uint8_t getUnitType() const
Definition: DWARFUnit.h:344
DWARFDie getDIEForOffset(uint32_t Offset)
Return the DIE object for a given offset inside the unit&#39;s DIE vector.
Definition: DWARFUnit.h:519
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
uint64_t getTypeHash() const
Definition: DWARFTypeUnit.h:37