1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
David Blaikie cc1f2e9afd dwarfdump: First piece of support for DWP dumping
Just a tiny piece of index dumping - the header in this instance.

llvm-svn: 252781
2015-11-11 19:28:21 +00:00

42 lines
1.2 KiB
C++

//===-- DWARFUnitIndex.cpp ------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
namespace llvm {
bool DWARFUnitIndex::Header::parse(DataExtractor IndexData, uint32_t *OffsetPtr) {
Version = IndexData.getU32(OffsetPtr);
NumColumns = IndexData.getU32(OffsetPtr);
NumUnits = IndexData.getU32(OffsetPtr);
NumBuckets = IndexData.getU32(OffsetPtr);
return Version <= 2;
}
void DWARFUnitIndex::Header::dump(raw_ostream &OS) const {
OS << "Index header:\n" << format(" version: %u\n", Version)
<< format(" columns: %u\n", NumColumns)
<< format(" units: %u\n", NumUnits)
<< format(" buckets: %u\n", NumBuckets);
}
bool DWARFUnitIndex::parse(DataExtractor IndexData) {
uint32_t Offset = 0;
if (!Header.parse(IndexData, &Offset))
return false;
return true;
}
void DWARFUnitIndex::dump(raw_ostream &OS) const {
Header.dump(OS);
}
}