blob: faa51e0d5fd27b98788141eb95b29f37c2ed072d [file] [log] [blame]
Benjamin Krameraa2f78f2011-09-13 19:42:23 +00001//===-- 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
Zachary Turner82af9432015-01-30 18:07:45 +000010#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
Eugene Zelenko570e39a2016-11-23 23:16:32 +000011#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
12#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
Benjamin Krameraa2f78f2011-09-13 19:42:23 +000013#include "llvm/Support/Format.h"
14#include "llvm/Support/raw_ostream.h"
David Blaikie07e22442013-09-23 22:44:40 +000015
Benjamin Krameraa2f78f2011-09-13 19:42:23 +000016using namespace llvm;
Benjamin Krameraa2f78f2011-09-13 19:42:23 +000017
18void DWARFCompileUnit::dump(raw_ostream &OS) {
David Blaikie07e22442013-09-23 22:44:40 +000019 OS << format("0x%08x", getOffset()) << ": Compile Unit:"
20 << " length = " << format("0x%08x", getLength())
21 << " version = " << format("0x%04x", getVersion())
22 << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
23 << " addr_size = " << format("0x%02x", getAddressByteSize())
24 << " (next unit at " << format("0x%08x", getNextUnitOffset())
Benjamin Krameraa2f78f2011-09-13 19:42:23 +000025 << ")\n";
26
Alexey Samsonov7a18c062015-05-19 21:54:32 +000027 if (const DWARFDebugInfoEntryMinimal *CU = getUnitDIE(false))
28 CU->dump(OS, this, -1U);
29 else
30 OS << "<compile unit can't be parsed!>\n\n";
Benjamin Krameraa2f78f2011-09-13 19:42:23 +000031}
32
David Blaikie07e22442013-09-23 22:44:40 +000033// VTable anchor.
Eugene Zelenko570e39a2016-11-23 23:16:32 +000034DWARFCompileUnit::~DWARFCompileUnit() = default;