diff options
Diffstat (limited to 'llvm/lib/DebugInfo/PDB')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/CMakeLists.txt | 7 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/LLVMBuild.txt | 23 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDB.cpp | 21 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp | 101 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDBSymbol.cpp | 117 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp | 21 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDBSymbolCustom.cpp | 20 |
7 files changed, 310 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/CMakeLists.txt b/llvm/lib/DebugInfo/PDB/CMakeLists.txt new file mode 100644 index 00000000000..5d24bdb60a4 --- /dev/null +++ b/llvm/lib/DebugInfo/PDB/CMakeLists.txt @@ -0,0 +1,7 @@ +add_llvm_library(LLVMDebugInfoPDB + PDB.cpp + PDBInterfaceAnchors.cpp + PDBSymbol.cpp + PDBSymbolCompilandEnv.cpp + PDBSymbolCustom.cpp + ) diff --git a/llvm/lib/DebugInfo/PDB/LLVMBuild.txt b/llvm/lib/DebugInfo/PDB/LLVMBuild.txt new file mode 100644 index 00000000000..690598ade5c --- /dev/null +++ b/llvm/lib/DebugInfo/PDB/LLVMBuild.txt @@ -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 + diff --git a/llvm/lib/DebugInfo/PDB/PDB.cpp b/llvm/lib/DebugInfo/PDB/PDB.cpp new file mode 100644 index 00000000000..e80beee4e34 --- /dev/null +++ b/llvm/lib/DebugInfo/PDB/PDB.cpp @@ -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; +} diff --git a/llvm/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp b/llvm/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp new file mode 100644 index 00000000000..1d6c90198df --- /dev/null +++ b/llvm/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp @@ -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) diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp new file mode 100644 index 00000000000..095cdfc379f --- /dev/null +++ b/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp @@ -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); +} diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp new file mode 100644 index 00000000000..762c2238926 --- /dev/null +++ b/llvm/lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp @@ -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(); +} diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolCustom.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolCustom.cpp new file mode 100644 index 00000000000..aa1a8ed6e0b --- /dev/null +++ b/llvm/lib/DebugInfo/PDB/PDBSymbolCustom.cpp @@ -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); +} |