LLVM  10.0.0svn
DWARFTypeUnit.cpp
Go to the documentation of this file.
1 //===- DWARFTypeUnit.cpp --------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
14 #include "llvm/Support/Format.h"
16 #include <cinttypes>
17 
18 using namespace llvm;
19 
22  const char *Name = TD.getName(DINameKind::ShortName);
23 
24  if (DumpOpts.SummarizeTypes) {
25  OS << "name = '" << Name << "'"
26  << " type_signature = " << format("0x%016" PRIx64, getTypeHash())
27  << " length = " << format("0x%08x", getLength()) << '\n';
28  return;
29  }
30 
31  OS << format("0x%08" PRIx64, getOffset()) << ": Type Unit:"
32  << " length = " << format("0x%08x", getLength())
33  << " version = " << format("0x%04x", getVersion());
34  if (getVersion() >= 5)
35  OS << " unit_type = " << dwarf::UnitTypeString(getUnitType());
36  OS << " abbr_offset = "
37  << format("0x%04" PRIx64, 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%08" PRIx64, getNextUnitOffset())
43  << ")\n";
44 
45  if (DWARFDie TU = getUnitDIE(false))
46  TU.dump(OS, 0, DumpOpts);
47  else
48  OS << "<type unit can't be parsed!>\n\n";
49 }
const DWARFAbbreviationDeclarationSet * getAbbreviations() const
Definition: DWARFUnit.cpp:758
uint64_t getNextUnitOffset() const
Definition: DWARFUnit.h:291
This class represents lattice values for constants.
Definition: AllocatorList.h:23
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
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:37
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:283
uint16_t getVersion() const
Definition: DWARFUnit.h:282
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:171
Utility class that carries the DWARF compile/type unit and the debug info entry in an object...
Definition: DWARFDie.h:42
void dump(raw_ostream &OS, DIDumpOptions DumpOpts={}) override
uint64_t getOffset() const
Definition: DWARFUnit.h:278
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
Definition: DWARFUnit.h:385
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:526
DWARFDie getDIEForOffset(uint64_t Offset)
Return the DIE object for a given offset inside the unit&#39;s DIE vector.
Definition: DWARFUnit.h:473
StringRef UnitTypeString(unsigned)
Definition: Dwarf.cpp:515
uint32_t getLength() const
Definition: DWARFUnit.h:288
uint8_t getUnitType() const
Definition: DWARFUnit.h:289
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
uint64_t getTypeHash() const
Definition: DWARFTypeUnit.h:36