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" 12c8c1032cSGreg 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 18*318d1195SAdrian Prantl void DWARFCompileUnit::dump(raw_ostream &OS, DIDumpOptions DumpOpts) { 1982af9438SZachary Turner OS << format("0x%08x", getOffset()) << ": Compile Unit:" 2082af9438SZachary Turner << " length = " << format("0x%08x", getLength()) 21cddd6044SPaul Robinson << " version = " << format("0x%04x", getVersion()); 22cddd6044SPaul Robinson if (getVersion() >= 5) 23cddd6044SPaul Robinson OS << " unit_type = " << dwarf::UnitTypeString(getUnitType()); 24cddd6044SPaul Robinson OS << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset()) 2582af9438SZachary Turner << " addr_size = " << format("0x%02x", getAddressByteSize()) 2682af9438SZachary Turner << " (next unit at " << format("0x%08x", getNextUnitOffset()) 2782af9438SZachary Turner << ")\n"; 2882af9438SZachary Turner 29c8c1032cSGreg Clayton if (DWARFDie CUDie = getUnitDIE(false)) 30*318d1195SAdrian Prantl CUDie.dump(OS, -1U, 0, DumpOpts); 317a18c061SAlexey Samsonov else 327a18c061SAlexey Samsonov OS << "<compile unit can't be parsed!>\n\n"; 3382af9438SZachary Turner } 3482af9438SZachary Turner 3582af9438SZachary Turner // VTable anchor. 36570e39a2SEugene Zelenko DWARFCompileUnit::~DWARFCompileUnit() = default; 37