mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-17 03:30:28 +00:00
13a819cbad
Frequently you only want to iterate over children of a specific type (e.g. functions). Previously you would get back a generic interface that allowed iteration over the base symbol type, which you would have to dyn_cast<> each one of. With this patch, we allow the user to specify the concrete type as a template parameter, and it will return an iterator which returns instances of the concrete type directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228960 91177308-0d34-0410-b5e6-96231b3b80d8
68 lines
2.1 KiB
C++
68 lines
2.1 KiB
C++
//===- PDBSymbolData.cpp - PDB data (e.g. variable) accessors ---*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include <utility>
|
|
#include "llvm/DebugInfo/PDB/PDBExtras.h"
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
|
|
|
|
#include "llvm/Support/Format.h"
|
|
|
|
using namespace llvm;
|
|
|
|
PDBSymbolData::PDBSymbolData(const IPDBSession &PDBSession,
|
|
std::unique_ptr<IPDBRawSymbol> DataSymbol)
|
|
: PDBSymbol(PDBSession, std::move(DataSymbol)) {}
|
|
|
|
void PDBSymbolData::dump(raw_ostream &OS, int Indent,
|
|
PDB_DumpLevel Level) const {
|
|
OS.indent(Indent);
|
|
if (Level == PDB_DumpLevel::Compact) {
|
|
PDB_LocType Loc = getLocationType();
|
|
OS << Loc << " data [";
|
|
int Length;
|
|
switch (Loc) {
|
|
case PDB_LocType::Static:
|
|
OS << format_hex(getRelativeVirtualAddress(), 10);
|
|
Length = getLength();
|
|
break;
|
|
case PDB_LocType::TLS:
|
|
OS << getAddressSection() << ":" << format_hex(getAddressOffset(), 10);
|
|
break;
|
|
case PDB_LocType::RegRel:
|
|
OS << getRegisterId() << " + " << getOffset() << "]";
|
|
break;
|
|
case PDB_LocType::ThisRel:
|
|
OS << "this + " << getOffset() << "]";
|
|
break;
|
|
case PDB_LocType::Enregistered:
|
|
OS << getRegisterId() << "]";
|
|
break;
|
|
case PDB_LocType::BitField: {
|
|
uint32_t Offset = getOffset();
|
|
uint32_t BitPos = getBitPosition();
|
|
uint32_t Length = getLength();
|
|
uint32_t StartBits = 8 - BitPos;
|
|
uint32_t MiddleBytes = (Length - StartBits) / 8;
|
|
uint32_t EndBits = Length - StartBits - MiddleBytes * 8;
|
|
OS << format_hex(Offset, 10) << ":" << BitPos;
|
|
OS << " - " << format_hex(Offset + MiddleBytes, 10) << ":" << EndBits;
|
|
break;
|
|
}
|
|
case PDB_LocType::Slot:
|
|
OS << getSlot();
|
|
case PDB_LocType::IlRel:
|
|
case PDB_LocType::MetaData:
|
|
case PDB_LocType::Constant:
|
|
default:
|
|
OS << "???";
|
|
}
|
|
OS << "] ";
|
|
}
|
|
OS << getName() << "\n";
|
|
} |