mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Resubmit "Create lib/DebugInfo/PDB" (r228428)
This change resubmits the patch that broke the build, this time without unittests. The unittests will be submitted separately after the problem has been addressed: --Original Commit Message-- Create lib/DebugInfo/PDB. This patch creates a platform-independent interface to a PDB reader. There is currently no implementation of this interface, which will be provided in future patches. This defines the basic object model which any implementation must conform to. Reviewed by: David Blaikie Differential Revision: http://reviews.llvm.org/D7356 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228435 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,2 +1,5 @@
|
||||
|
||||
add_subdirectory(DWARF)
|
||||
add_subdirectory(DWARF)
|
||||
if (MSVC)
|
||||
add_subdirectory(PDB)
|
||||
endif()
|
@@ -16,7 +16,7 @@
|
||||
;===------------------------------------------------------------------------===;
|
||||
|
||||
[common]
|
||||
subdirectories = DWARF
|
||||
subdirectories = DWARF PDB
|
||||
|
||||
[component_0]
|
||||
type = Group
|
||||
|
7
lib/DebugInfo/PDB/CMakeLists.txt
Normal file
7
lib/DebugInfo/PDB/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
add_llvm_library(LLVMDebugInfoPDB
|
||||
PDB.cpp
|
||||
PDBInterfaceAnchors.cpp
|
||||
PDBSymbol.cpp
|
||||
PDBSymbolCompilandEnv.cpp
|
||||
PDBSymbolCustom.cpp
|
||||
)
|
23
lib/DebugInfo/PDB/LLVMBuild.txt
Normal file
23
lib/DebugInfo/PDB/LLVMBuild.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
;===- ./lib/DebugInfo/PDB/LLVMBuild.txt ------------------------*- Conf -*--===;
|
||||
;
|
||||
; The LLVM Compiler Infrastructure
|
||||
;
|
||||
; This file is distributed under the University of Illinois Open Source
|
||||
; License. See LICENSE.TXT for details.
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
;
|
||||
; This is an LLVMBuild description file for the components in this subdirectory.
|
||||
;
|
||||
; For more information on the LLVMBuild system, please see:
|
||||
;
|
||||
; http://llvm.org/docs/LLVMBuild.html
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
|
||||
[component_0]
|
||||
type = Library
|
||||
name = DebugInfoPDB
|
||||
parent = DebugInfo
|
||||
required_libraries = Support
|
||||
|
21
lib/DebugInfo/PDB/PDB.cpp
Normal file
21
lib/DebugInfo/PDB/PDB.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
//===- PDB.cpp - base header file for creating a PDB reader -----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
#include "llvm/DebugInfo/PDB/PDB.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
std::unique_ptr<IPDBSession> llvm::createPDBReader(PDB_ReaderType Type,
|
||||
StringRef Path) {
|
||||
// Create the correct concrete instance type based on the value of Type.
|
||||
return nullptr;
|
||||
}
|
101
lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp
Normal file
101
lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
//===- PDBInterfaceAnchors.h - defines class anchor funcions ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Class anchors are necessary per the LLVM Coding style guide, to ensure that
|
||||
// the vtable is only generated in this object file, and not in every object
|
||||
// file that incldues the corresponding header.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/PDB/IPDBDataStream.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
|
||||
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolAnnotation.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolBlock.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCustom.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolLabel.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolUnknown.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
IPDBSession::~IPDBSession() {}
|
||||
|
||||
IPDBDataStream::~IPDBDataStream() {}
|
||||
|
||||
IPDBRawSymbol::~IPDBRawSymbol() {}
|
||||
|
||||
IPDBSourceFile::~IPDBSourceFile() {}
|
||||
|
||||
IPDBLineNumber::~IPDBLineNumber() {}
|
||||
|
||||
// All of the concrete symbol types have their methods declared inline through
|
||||
// the use of a forwarding macro, so the constructor should be declared out of
|
||||
// line to get the vtable in this file.
|
||||
#define FORWARD_SYMBOL_CONSTRUCTOR(ClassName) \
|
||||
ClassName::ClassName(std::unique_ptr<IPDBRawSymbol> Symbol) \
|
||||
: PDBSymbol(std::move(Symbol)) {}
|
||||
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolAnnotation)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolBlock)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolCompiland)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolCompilandDetails)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolCompilandEnv)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolCustom)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolData)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolExe)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolFunc)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolFuncDebugEnd)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolFuncDebugStart)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolLabel)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolPublicSymbol)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolThunk)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeArray)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeBaseClass)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeBuiltin)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeCustom)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeDimension)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeEnum)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeFriend)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeFunctionArg)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeFunctionSig)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeManaged)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypePointer)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeTypedef)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeUDT)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeVTable)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolTypeVTableShape)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolUnknown)
|
||||
FORWARD_SYMBOL_CONSTRUCTOR(PDBSymbolUsingNamespace)
|
117
lib/DebugInfo/PDB/PDBSymbol.cpp
Normal file
117
lib/DebugInfo/PDB/PDBSymbol.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
//===- PDBSymbol.cpp - base class for user-facing symbol types --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolAnnotation.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolBlock.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCustom.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolLabel.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolUnknown.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
PDBSymbol::PDBSymbol(std::unique_ptr<IPDBRawSymbol> Symbol)
|
||||
: RawSymbol(std::move(Symbol)) {}
|
||||
|
||||
PDBSymbol::~PDBSymbol() {}
|
||||
|
||||
#define FACTORY_SYMTAG_CASE(Tag, Type) \
|
||||
case PDB_SymType::Tag: \
|
||||
return std::unique_ptr<PDBSymbol>(new Type(std::move(Symbol)));
|
||||
|
||||
std::unique_ptr<PDBSymbol>
|
||||
PDBSymbol::create(std::unique_ptr<IPDBRawSymbol> Symbol) {
|
||||
switch (Symbol->getSymTag()) {
|
||||
FACTORY_SYMTAG_CASE(Exe, PDBSymbolExe)
|
||||
FACTORY_SYMTAG_CASE(Compiland, PDBSymbolCompiland)
|
||||
FACTORY_SYMTAG_CASE(CompilandDetails, PDBSymbolCompilandDetails)
|
||||
FACTORY_SYMTAG_CASE(CompilandEnv, PDBSymbolCompilandEnv)
|
||||
FACTORY_SYMTAG_CASE(Function, PDBSymbolFunc)
|
||||
FACTORY_SYMTAG_CASE(Block, PDBSymbolBlock)
|
||||
FACTORY_SYMTAG_CASE(Data, PDBSymbolData)
|
||||
FACTORY_SYMTAG_CASE(Annotation, PDBSymbolAnnotation)
|
||||
FACTORY_SYMTAG_CASE(Label, PDBSymbolLabel)
|
||||
FACTORY_SYMTAG_CASE(PublicSymbol, PDBSymbolPublicSymbol)
|
||||
FACTORY_SYMTAG_CASE(UDT, PDBSymbolTypeUDT)
|
||||
FACTORY_SYMTAG_CASE(Enum, PDBSymbolTypeEnum)
|
||||
FACTORY_SYMTAG_CASE(FunctionSig, PDBSymbolTypeFunctionSig)
|
||||
FACTORY_SYMTAG_CASE(PointerType, PDBSymbolTypePointer)
|
||||
FACTORY_SYMTAG_CASE(ArrayType, PDBSymbolTypeArray)
|
||||
FACTORY_SYMTAG_CASE(BuiltinType, PDBSymbolTypeBuiltin)
|
||||
FACTORY_SYMTAG_CASE(Typedef, PDBSymbolTypeTypedef)
|
||||
FACTORY_SYMTAG_CASE(BaseClass, PDBSymbolTypeBaseClass)
|
||||
FACTORY_SYMTAG_CASE(Friend, PDBSymbolTypeFriend)
|
||||
FACTORY_SYMTAG_CASE(FunctionArg, PDBSymbolTypeFunctionArg)
|
||||
FACTORY_SYMTAG_CASE(FuncDebugStart, PDBSymbolFuncDebugStart)
|
||||
FACTORY_SYMTAG_CASE(FuncDebugEnd, PDBSymbolFuncDebugEnd)
|
||||
FACTORY_SYMTAG_CASE(UsingNamespace, PDBSymbolUsingNamespace)
|
||||
FACTORY_SYMTAG_CASE(VTableShape, PDBSymbolTypeVTableShape)
|
||||
FACTORY_SYMTAG_CASE(VTable, PDBSymbolTypeVTable)
|
||||
FACTORY_SYMTAG_CASE(Custom, PDBSymbolCustom)
|
||||
FACTORY_SYMTAG_CASE(Thunk, PDBSymbolThunk)
|
||||
FACTORY_SYMTAG_CASE(CustomType, PDBSymbolTypeCustom)
|
||||
FACTORY_SYMTAG_CASE(ManagedType, PDBSymbolTypeManaged)
|
||||
FACTORY_SYMTAG_CASE(Dimension, PDBSymbolTypeDimension)
|
||||
default:
|
||||
return std::unique_ptr<PDBSymbol>(new PDBSymbolUnknown(std::move(Symbol)));
|
||||
}
|
||||
}
|
||||
|
||||
void PDBSymbol::dump(llvm::raw_ostream &OS) const { RawSymbol->dump(OS); }
|
||||
|
||||
PDB_SymType PDBSymbol::getSymTag() const { return RawSymbol->getSymTag(); }
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols>
|
||||
PDBSymbol::findChildren(PDB_SymType Type, StringRef Name,
|
||||
PDB_NameSearchFlags Flags) const {
|
||||
return RawSymbol->findChildren(Type, Name, Flags);
|
||||
}
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols>
|
||||
PDBSymbol::findChildrenByRVA(PDB_SymType Type, StringRef Name,
|
||||
PDB_NameSearchFlags Flags, uint32_t RVA) const {
|
||||
return RawSymbol->findChildrenByRVA(Type, Name, Flags, RVA);
|
||||
}
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols>
|
||||
PDBSymbol::findInlineFramesByRVA(uint32_t RVA) const {
|
||||
return RawSymbol->findInlineFramesByRVA(RVA);
|
||||
}
|
21
lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp
Normal file
21
lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
//===- PDBSymbolCompilandEnv.cpp - compiland env variables ------*- 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/IPDBRawSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
std::string PDBSymbolCompilandEnv::getValue() const {
|
||||
// call RawSymbol->getValue() and convert the result to an std::string.
|
||||
return std::string();
|
||||
}
|
20
lib/DebugInfo/PDB/PDBSymbolCustom.cpp
Normal file
20
lib/DebugInfo/PDB/PDBSymbolCustom.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//===- PDBSymbolCustom.cpp - compiler-specific types ------------*- 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/IPDBRawSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCustom.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
void PDBSymbolCustom::getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) {
|
||||
RawSymbol->getDataBytes(bytes);
|
||||
}
|
Reference in New Issue
Block a user