mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-27 02:31:09 +00:00
This patch adds a number of improvements to llvm-pdbdump. 1) Dumping of the entire global scope, and not only those symbols that live in individual compilands. 2) Prepend class name to member functions and data 3) Improved display of bitfields. 4) Support for dumping more kinds of data symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229012 91177308-0d34-0410-b5e6-96231b3b80d8
69 lines
2.3 KiB
C++
69 lines
2.3 KiB
C++
//===- PDBSymbolFunc.cpp - --------------------------------------*- 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/IPDBEnumChildren.h"
|
|
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
|
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
|
|
|
|
#include "llvm/Support/Format.h"
|
|
|
|
using namespace llvm;
|
|
PDBSymbolFunc::PDBSymbolFunc(const IPDBSession &PDBSession,
|
|
std::unique_ptr<IPDBRawSymbol> Symbol)
|
|
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
|
|
|
void PDBSymbolFunc::dump(raw_ostream &OS, int Indent,
|
|
PDB_DumpLevel Level) const {
|
|
if (Level == PDB_DumpLevel::Compact) {
|
|
OS << stream_indent(Indent);
|
|
|
|
uint32_t FuncStart = getRelativeVirtualAddress();
|
|
uint32_t FuncEnd = FuncStart + getLength();
|
|
if (FuncStart == 0 && FuncEnd == 0) {
|
|
OS << "func [???]";
|
|
} else {
|
|
OS << "func ";
|
|
OS << "[" << format_hex(FuncStart, 8);
|
|
if (auto DebugStart = findOneChild<PDBSymbolFuncDebugStart>())
|
|
OS << "+" << DebugStart->getRelativeVirtualAddress() - FuncStart;
|
|
OS << " - " << format_hex(FuncEnd, 8);
|
|
if (auto DebugEnd = findOneChild<PDBSymbolFuncDebugEnd>())
|
|
OS << "-" << FuncEnd - DebugEnd->getRelativeVirtualAddress();
|
|
OS << "] ";
|
|
}
|
|
|
|
PDB_RegisterId Reg = getLocalBasePointerRegisterId();
|
|
if (Reg == PDB_RegisterId::VFrame)
|
|
OS << "(VFrame)";
|
|
else if (hasFramePointer())
|
|
OS << "(" << Reg << ")";
|
|
else
|
|
OS << "(FPO)";
|
|
|
|
OS << " ";
|
|
uint32_t ClassId = getClassParentId();
|
|
if (ClassId != 0) {
|
|
if (auto Class = Session.getSymbolById(ClassId)) {
|
|
if (auto UDT = dyn_cast<PDBSymbolTypeUDT>(Class.get()))
|
|
OS << UDT->getName() << "::";
|
|
else
|
|
OS << "{class " << Class->getSymTag() << "}::";
|
|
}
|
|
}
|
|
OS << getName();
|
|
OS << "\n";
|
|
}
|
|
}
|