LLVM  8.0.1
DWARFCompileUnit.cpp
Go to the documentation of this file.
1 //===-- DWARFCompileUnit.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 
13 #include "llvm/Support/Format.h"
15 
16 using namespace llvm;
17 
19  OS << format("0x%08x", getOffset()) << ": Compile Unit:"
20  << " length = " << format("0x%08x", getLength())
21  << " version = " << format("0x%04x", getVersion());
22  if (getVersion() >= 5)
23  OS << " unit_type = " << dwarf::UnitTypeString(getUnitType());
24  OS << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
25  << " addr_size = " << format("0x%02x", getAddressByteSize());
26  if (getVersion() >= 5 && getUnitType() != dwarf::DW_UT_compile)
27  OS << " DWO_id = " << format("0x%016" PRIx64, *getDWOId());
28  OS << " (next unit at " << format("0x%08x", getNextUnitOffset()) << ")\n";
29 
30  if (DWARFDie CUDie = getUnitDIE(false))
31  CUDie.dump(OS, 0, DumpOpts);
32  else
33  OS << "<compile unit can't be parsed!>\n\n";
34 }
35 
36 // VTable anchor.
const DWARFAbbreviationDeclarationSet * getAbbreviations() const
Definition: DWARFUnit.cpp:742
This class represents lattice values for constants.
Definition: AllocatorList.h:24
~DWARFCompileUnit() override
VTable anchor.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
void dump(raw_ostream &OS, DIDumpOptions DumpOpts) override
Dump this compile unit to OS.
uint32_t getNextUnitOffset() const
Definition: DWARFUnit.h:288
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:280
uint16_t getVersion() const
Definition: DWARFUnit.h:279
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:159
Utility class that carries the DWARF compile/type unit and the debug info entry in an object...
Definition: DWARFDie.h:43
Optional< uint64_t > getDWOId()
Definition: DWARFUnit.h:389
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
Definition: DWARFUnit.h:381
StringRef UnitTypeString(unsigned)
Definition: Dwarf.cpp:510
uint32_t getLength() const
Definition: DWARFUnit.h:285
uint32_t getOffset() const
Definition: DWARFUnit.h:275
uint8_t getUnitType() const
Definition: DWARFUnit.h:286
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46