LLVM API Documentation
00001 //===-- DWARFTypeUnit.cpp -------------------------------------------------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #include "DWARFTypeUnit.h" 00011 #include "llvm/Support/Format.h" 00012 #include "llvm/Support/raw_ostream.h" 00013 00014 using namespace llvm; 00015 00016 bool DWARFTypeUnit::extractImpl(DataExtractor debug_info, 00017 uint32_t *offset_ptr) { 00018 if (!DWARFUnit::extractImpl(debug_info, offset_ptr)) 00019 return false; 00020 TypeHash = debug_info.getU64(offset_ptr); 00021 TypeOffset = debug_info.getU32(offset_ptr); 00022 return TypeOffset < getLength(); 00023 } 00024 00025 void DWARFTypeUnit::dump(raw_ostream &OS) { 00026 OS << format("0x%08x", getOffset()) << ": Type Unit:" 00027 << " length = " << format("0x%08x", getLength()) 00028 << " version = " << format("0x%04x", getVersion()) 00029 << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset()) 00030 << " addr_size = " << format("0x%02x", getAddressByteSize()) 00031 << " type_signature = " << format("0x%16" PRIx64, TypeHash) 00032 << " type_offset = " << format("0x%04x", TypeOffset) 00033 << " (next unit at " << format("0x%08x", getNextUnitOffset()) 00034 << ")\n"; 00035 00036 const DWARFDebugInfoEntryMinimal *CU = getCompileUnitDIE(false); 00037 assert(CU && "Null Compile Unit?"); 00038 CU->dump(OS, this, -1U); 00039 }