Line data Source code
1 : //===-- DWARFTypeUnit.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 :
10 : #include "llvm/DebugInfo/DWARFTypeUnit.h"
11 : #include "llvm/Support/Format.h"
12 : #include "llvm/Support/raw_ostream.h"
13 :
14 : using namespace llvm;
15 :
16 24 : bool DWARFTypeUnit::extractImpl(DataExtractor debug_info,
17 : uint32_t *offset_ptr) {
18 24 : if (!DWARFUnit::extractImpl(debug_info, offset_ptr))
19 : return false;
20 24 : TypeHash = debug_info.getU64(offset_ptr);
21 24 : TypeOffset = debug_info.getU32(offset_ptr);
22 24 : return TypeOffset < getLength();
23 : }
24 :
25 24 : void DWARFTypeUnit::dump(raw_ostream &OS) {
26 72 : OS << format("0x%08x", getOffset()) << ": Type Unit:"
27 72 : << " length = " << format("0x%08x", getLength())
28 72 : << " version = " << format("0x%04x", getVersion())
29 72 : << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
30 72 : << " addr_size = " << format("0x%02x", getAddressByteSize())
31 72 : << " type_signature = " << format("0x%16" PRIx64, TypeHash)
32 72 : << " type_offset = " << format("0x%04x", TypeOffset)
33 96 : << " (next unit at " << format("0x%08x", getNextUnitOffset())
34 24 : << ")\n";
35 :
36 48 : const DWARFDebugInfoEntryMinimal *CU = getCompileUnitDIE(false);
37 : assert(CU && "Null Compile Unit?");
38 24 : CU->dump(OS, this, -1U);
39 24 : }
|