182af9438SZachary Turner //===-- DWARFCompileUnit.cpp ----------------------------------------------===//
282af9438SZachary Turner //
382af9438SZachary Turner //                     The LLVM Compiler Infrastructure
482af9438SZachary Turner //
582af9438SZachary Turner // This file is distributed under the University of Illinois Open Source
682af9438SZachary Turner // License. See LICENSE.TXT for details.
782af9438SZachary Turner //
882af9438SZachary Turner //===----------------------------------------------------------------------===//
982af9438SZachary Turner 
1082af9438SZachary Turner #include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
11570e39a2SEugene Zelenko #include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
12*c8c1032cSGreg Clayton #include "llvm/DebugInfo/DWARF/DWARFDie.h"
1382af9438SZachary Turner #include "llvm/Support/Format.h"
1482af9438SZachary Turner #include "llvm/Support/raw_ostream.h"
1582af9438SZachary Turner 
1682af9438SZachary Turner using namespace llvm;
1782af9438SZachary Turner 
1882af9438SZachary Turner void DWARFCompileUnit::dump(raw_ostream &OS) {
1982af9438SZachary Turner   OS << format("0x%08x", getOffset()) << ": Compile Unit:"
2082af9438SZachary Turner      << " length = " << format("0x%08x", getLength())
2182af9438SZachary Turner      << " version = " << format("0x%04x", getVersion())
2282af9438SZachary Turner      << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
2382af9438SZachary Turner      << " addr_size = " << format("0x%02x", getAddressByteSize())
2482af9438SZachary Turner      << " (next unit at " << format("0x%08x", getNextUnitOffset())
2582af9438SZachary Turner      << ")\n";
2682af9438SZachary Turner 
27*c8c1032cSGreg Clayton   if (DWARFDie CUDie = getUnitDIE(false))
28*c8c1032cSGreg Clayton     CUDie.dump(OS, -1U);
297a18c061SAlexey Samsonov   else
307a18c061SAlexey Samsonov     OS << "<compile unit can't be parsed!>\n\n";
3182af9438SZachary Turner }
3282af9438SZachary Turner 
3382af9438SZachary Turner // VTable anchor.
34570e39a2SEugene Zelenko DWARFCompileUnit::~DWARFCompileUnit() = default;
35