LLVM  10.0.0svn
DWARFCompileUnit.cpp
Go to the documentation of this file.
1 //===-- DWARFCompileUnit.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 
12 #include "llvm/Support/Format.h"
14 
15 using namespace llvm;
16 
18  OS << format("0x%08" PRIx64, getOffset()) << ": Compile Unit:"
19  << " length = " << format("0x%08" PRIx64, getLength())
20  << " version = " << format("0x%04x", getVersion());
21  if (getVersion() >= 5)
22  OS << " unit_type = " << dwarf::UnitTypeString(getUnitType());
23  OS << " abbr_offset = "
24  << format("0x%04" PRIx64, 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%08" PRIx64, getNextUnitOffset())
29  << ")\n";
30 
31  if (DWARFDie CUDie = getUnitDIE(false))
32  CUDie.dump(OS, 0, DumpOpts);
33  else
34  OS << "<compile unit can't be parsed!>\n\n";
35 }
36 
37 // VTable anchor.
const DWARFAbbreviationDeclarationSet * getAbbreviations() const
Definition: DWARFUnit.cpp:761
uint64_t getNextUnitOffset() const
Definition: DWARFUnit.h:292
This class represents lattice values for constants.
Definition: AllocatorList.h:23
~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.
uint8_t getAddressByteSize() const
Definition: DWARFUnit.h:284
uint16_t getVersion() const
Definition: DWARFUnit.h:283
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
Optional< uint64_t > getDWOId()
Definition: DWARFUnit.h:401
uint64_t getOffset() const
Definition: DWARFUnit.h:279
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
Definition: DWARFUnit.h:386
StringRef UnitTypeString(unsigned)
Definition: Dwarf.cpp:529
uint8_t getUnitType() const
Definition: DWARFUnit.h:290
uint64_t getLength() 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