blob: 39a7c772dc76f4d65c9d2499f230ab44c4814ad5 [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"
Benjamin Krameraa2f78f2011-09-13 19:42:23 +000011#include "llvm/Support/Format.h"
12#include "llvm/Support/raw_ostream.h"
David Blaikie07e22442013-09-23 22:44:40 +000013
Benjamin Krameraa2f78f2011-09-13 19:42:23 +000014using namespace llvm;
Benjamin Krameraa2f78f2011-09-13 19:42:23 +000015
16void DWARFCompileUnit::dump(raw_ostream &OS) {
David Blaikie07e22442013-09-23 22:44:40 +000017 OS << format("0x%08x", getOffset()) << ": Compile Unit:"
18 << " length = " << format("0x%08x", getLength())
19 << " version = " << format("0x%04x", getVersion())
20 << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
21 << " addr_size = " << format("0x%02x", getAddressByteSize())
22 << " (next unit at " << format("0x%08x", getNextUnitOffset())
Benjamin Krameraa2f78f2011-09-13 19:42:23 +000023 << ")\n";
24
Alexey Samsonov7a18c062015-05-19 21:54:32 +000025 if (const DWARFDebugInfoEntryMinimal *CU = getUnitDIE(false))
26 CU->dump(OS, this, -1U);
27 else
28 OS << "<compile unit can't be parsed!>\n\n";
Benjamin Krameraa2f78f2011-09-13 19:42:23 +000029}
30
David Blaikie07e22442013-09-23 22:44:40 +000031// VTable anchor.
32DWARFCompileUnit::~DWARFCompileUnit() {
Alexey Samsonove16e16a2012-07-19 07:03:58 +000033}