LCOV - code coverage report
Current view: top level - lib/DebugInfo/DWARF - DWARFTypeUnit.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 21 22 95.5 %
Date: 2018-10-20 13:21:21 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          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/DWARF/DWARFTypeUnit.h"
      11             : #include "llvm/DebugInfo/DIContext.h"
      12             : #include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
      13             : #include "llvm/DebugInfo/DWARF/DWARFDie.h"
      14             : #include "llvm/DebugInfo/DWARF/DWARFUnit.h"
      15             : #include "llvm/Support/Format.h"
      16             : #include "llvm/Support/raw_ostream.h"
      17             : #include <cinttypes>
      18             : 
      19             : using namespace llvm;
      20             : 
      21          57 : void DWARFTypeUnit::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
      22         114 :   DWARFDie TD = getDIEForOffset(getTypeOffset() + getOffset());
      23          57 :   const char *Name = TD.getName(DINameKind::ShortName);
      24             : 
      25          57 :   if (DumpOpts.SummarizeTypes) {
      26           2 :     OS << "name = '" << Name << "'"
      27           2 :        << " type_signature = " << format("0x%016" PRIx64, getTypeHash())
      28           2 :        << " length = " << format("0x%08x", getLength()) << '\n';
      29           2 :     return;
      30             :   }
      31             : 
      32          55 :   OS << format("0x%08x", getOffset()) << ": Type Unit:"
      33          55 :      << " length = " << format("0x%08x", getLength())
      34          55 :      << " version = " << format("0x%04x", getVersion());
      35          55 :   if (getVersion() >= 5)
      36          14 :     OS << " unit_type = " << dwarf::UnitTypeString(getUnitType());
      37          55 :   OS << " abbr_offset = " << format("0x%04x", getAbbreviations()->getOffset())
      38          55 :      << " addr_size = " << format("0x%02x", getAddressByteSize())
      39          55 :      << " name = '" << Name << "'"
      40          55 :      << " type_signature = " << format("0x%016" PRIx64, getTypeHash())
      41          55 :      << " type_offset = " << format("0x%04x", getTypeOffset())
      42          55 :      << " (next unit at " << format("0x%08x", getNextUnitOffset()) << ")\n";
      43             : 
      44          55 :   if (DWARFDie TU = getUnitDIE(false))
      45          55 :     TU.dump(OS, 0, DumpOpts);
      46             :   else
      47           0 :     OS << "<type unit can't be parsed!>\n\n";
      48             : }

Generated by: LCOV version 1.13