Run dos2unix against llvm-pdbdump.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227262 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Zachary Turner 2015-01-27 23:02:23 +00:00
parent 08aea7d1b6
commit 7ce32460db
6 changed files with 1612 additions and 1612 deletions

View File

@ -1,28 +1,28 @@
set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK")
# Due to a bug in MSVC 2013's installation software, it is possible
# for MSVC 2013 to write the DIA SDK into the Visual Studio 2012
# install directory. If this happens, the installation is corrupt
# and there's nothing we can do. It happens with enough frequency
# though that we should handle it. We do so by simply checking that
# the DIA SDK folder exists. Should this happen you will need to
# uninstall VS 2012 and then re-install VS 2013.
if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
set(LLVM_LINK_COMPONENTS
Support
)
include_directories(${MSVC_DIA_SDK_DIR}/include)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
link_directories(${MSVC_DIA_SDK_DIR}/lib/amd64)
else()
link_directories(${MSVC_DIA_SDK_DIR}/lib)
endif()
add_llvm_tool(llvm-pdbdump
llvm-pdbdump.cpp
DIAExtras.cpp
DIASymbol.cpp
)
target_link_libraries(llvm-pdbdump diaguids)
endif()
set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK")
# Due to a bug in MSVC 2013's installation software, it is possible
# for MSVC 2013 to write the DIA SDK into the Visual Studio 2012
# install directory. If this happens, the installation is corrupt
# and there's nothing we can do. It happens with enough frequency
# though that we should handle it. We do so by simply checking that
# the DIA SDK folder exists. Should this happen you will need to
# uninstall VS 2012 and then re-install VS 2013.
if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
set(LLVM_LINK_COMPONENTS
Support
)
include_directories(${MSVC_DIA_SDK_DIR}/include)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
link_directories(${MSVC_DIA_SDK_DIR}/lib/amd64)
else()
link_directories(${MSVC_DIA_SDK_DIR}/lib)
endif()
add_llvm_tool(llvm-pdbdump
llvm-pdbdump.cpp
DIAExtras.cpp
DIASymbol.cpp
)
target_link_libraries(llvm-pdbdump diaguids)
endif()

View File

@ -1,176 +1,176 @@
//===- DIAExtras.cpp - Helper classes and functions for DIA C++ ---------*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm-pdbdump.h"
#include "DIAExtras.h"
using namespace llvm;
using namespace llvm::sys::windows;
#define PRINT_ENUM_VALUE_CASE(Value) \
case Value: \
outs() << #Value; \
break;
raw_ostream &llvm::operator<<(raw_ostream &Stream, DiaSymTagEnum SymTag) {
switch (SymTag) {
PRINT_ENUM_VALUE_CASE(SymTagNull)
PRINT_ENUM_VALUE_CASE(SymTagExe)
PRINT_ENUM_VALUE_CASE(SymTagCompiland)
PRINT_ENUM_VALUE_CASE(SymTagCompilandDetails)
PRINT_ENUM_VALUE_CASE(SymTagCompilandEnv)
PRINT_ENUM_VALUE_CASE(SymTagFunction)
PRINT_ENUM_VALUE_CASE(SymTagBlock)
PRINT_ENUM_VALUE_CASE(SymTagData)
PRINT_ENUM_VALUE_CASE(SymTagAnnotation)
PRINT_ENUM_VALUE_CASE(SymTagLabel)
PRINT_ENUM_VALUE_CASE(SymTagPublicSymbol)
PRINT_ENUM_VALUE_CASE(SymTagUDT)
PRINT_ENUM_VALUE_CASE(SymTagEnum)
PRINT_ENUM_VALUE_CASE(SymTagFunctionType)
PRINT_ENUM_VALUE_CASE(SymTagPointerType)
PRINT_ENUM_VALUE_CASE(SymTagArrayType)
PRINT_ENUM_VALUE_CASE(SymTagBaseType)
PRINT_ENUM_VALUE_CASE(SymTagTypedef)
PRINT_ENUM_VALUE_CASE(SymTagBaseClass)
PRINT_ENUM_VALUE_CASE(SymTagFriend)
PRINT_ENUM_VALUE_CASE(SymTagFunctionArgType)
PRINT_ENUM_VALUE_CASE(SymTagFuncDebugStart)
PRINT_ENUM_VALUE_CASE(SymTagFuncDebugEnd)
PRINT_ENUM_VALUE_CASE(SymTagUsingNamespace)
PRINT_ENUM_VALUE_CASE(SymTagVTableShape)
PRINT_ENUM_VALUE_CASE(SymTagVTable)
PRINT_ENUM_VALUE_CASE(SymTagCustom)
PRINT_ENUM_VALUE_CASE(SymTagThunk)
PRINT_ENUM_VALUE_CASE(SymTagCustomType)
PRINT_ENUM_VALUE_CASE(SymTagManagedType)
PRINT_ENUM_VALUE_CASE(SymTagDimension)
PRINT_ENUM_VALUE_CASE(SymTagCallSite)
PRINT_ENUM_VALUE_CASE(SymTagInlineSite)
PRINT_ENUM_VALUE_CASE(SymTagBaseInterface)
PRINT_ENUM_VALUE_CASE(SymTagVectorType)
PRINT_ENUM_VALUE_CASE(SymTagMatrixType)
PRINT_ENUM_VALUE_CASE(SymTagHLSLType)
#if (_MSC_FULL_VER >= 180031101)
PRINT_ENUM_VALUE_CASE(SymTagCaller)
PRINT_ENUM_VALUE_CASE(SymTagCallee)
#endif
PRINT_ENUM_VALUE_CASE(SymTagMax)
}
outs() << " {" << (DWORD)SymTag << "}";
return Stream;
}
raw_ostream &llvm::operator<<(raw_ostream &Stream, CV_CPU_TYPE_e CpuType) {
switch (CpuType) {
PRINT_ENUM_VALUE_CASE(CV_CFL_8080)
PRINT_ENUM_VALUE_CASE(CV_CFL_8086)
PRINT_ENUM_VALUE_CASE(CV_CFL_80286)
PRINT_ENUM_VALUE_CASE(CV_CFL_80386)
PRINT_ENUM_VALUE_CASE(CV_CFL_80486)
PRINT_ENUM_VALUE_CASE(CV_CFL_PENTIUM)
PRINT_ENUM_VALUE_CASE(CV_CFL_PENTIUMPRO)
PRINT_ENUM_VALUE_CASE(CV_CFL_PENTIUMIII)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS16)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS32)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS64)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSI)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSII)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSIII)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSIV)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSV)
PRINT_ENUM_VALUE_CASE(CV_CFL_M68000)
PRINT_ENUM_VALUE_CASE(CV_CFL_M68010)
PRINT_ENUM_VALUE_CASE(CV_CFL_M68020)
PRINT_ENUM_VALUE_CASE(CV_CFL_M68030)
PRINT_ENUM_VALUE_CASE(CV_CFL_M68040)
PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA)
PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21164)
PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21164A)
PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21264)
PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21364)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPC601)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPC603)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPC604)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPC620)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPCFP)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPCBE)
PRINT_ENUM_VALUE_CASE(CV_CFL_SH3)
PRINT_ENUM_VALUE_CASE(CV_CFL_SH3E)
PRINT_ENUM_VALUE_CASE(CV_CFL_SH3DSP)
PRINT_ENUM_VALUE_CASE(CV_CFL_SH4)
PRINT_ENUM_VALUE_CASE(CV_CFL_SHMEDIA)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM3)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM4)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM4T)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM5)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM5T)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM6)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM_XMAC)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM_WMMX)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM7)
PRINT_ENUM_VALUE_CASE(CV_CFL_OMNI)
PRINT_ENUM_VALUE_CASE(CV_CFL_IA64)
PRINT_ENUM_VALUE_CASE(CV_CFL_IA64_2)
PRINT_ENUM_VALUE_CASE(CV_CFL_CEE)
PRINT_ENUM_VALUE_CASE(CV_CFL_AM33)
PRINT_ENUM_VALUE_CASE(CV_CFL_M32R)
PRINT_ENUM_VALUE_CASE(CV_CFL_TRICORE)
PRINT_ENUM_VALUE_CASE(CV_CFL_X64)
PRINT_ENUM_VALUE_CASE(CV_CFL_EBC)
PRINT_ENUM_VALUE_CASE(CV_CFL_THUMB)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARMNT)
#if (_MSC_FULL_VER >= 180031101)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM64)
#endif
PRINT_ENUM_VALUE_CASE(CV_CFL_D3D11_SHADER)
}
outs() << " {" << llvm::format_hex((DWORD)CpuType, 2, true) << "}";
return Stream;
}
raw_ostream &llvm::operator<<(raw_ostream &Stream,
MachineTypeEnum MachineType) {
switch (MachineType) {
PRINT_ENUM_VALUE_CASE(MachineTypeUnknown)
PRINT_ENUM_VALUE_CASE(MachineTypeX86)
PRINT_ENUM_VALUE_CASE(MachineTypeR3000)
PRINT_ENUM_VALUE_CASE(MachineTypeR4000)
PRINT_ENUM_VALUE_CASE(MachineTypeR10000)
PRINT_ENUM_VALUE_CASE(MachineTypeWCEMIPSv2)
PRINT_ENUM_VALUE_CASE(MachineTypeAlpha)
PRINT_ENUM_VALUE_CASE(MachineTypeSH3)
PRINT_ENUM_VALUE_CASE(MachineTypeSH3DSP)
PRINT_ENUM_VALUE_CASE(MachineTypeSH3E)
PRINT_ENUM_VALUE_CASE(MachineTypeSH4)
PRINT_ENUM_VALUE_CASE(MachineTypeSH5)
PRINT_ENUM_VALUE_CASE(MachineTypeArm)
PRINT_ENUM_VALUE_CASE(MachineTypeThumb)
PRINT_ENUM_VALUE_CASE(MachineTypeArmNT)
PRINT_ENUM_VALUE_CASE(MachineTypeAM33)
PRINT_ENUM_VALUE_CASE(MachineTypePowerPC)
PRINT_ENUM_VALUE_CASE(MachineTypePowerPCFP)
PRINT_ENUM_VALUE_CASE(MachineTypeIa64)
PRINT_ENUM_VALUE_CASE(MachineTypeMips16)
PRINT_ENUM_VALUE_CASE(MachineTypeAlpha64)
PRINT_ENUM_VALUE_CASE(MachineTypeMipsFpu)
PRINT_ENUM_VALUE_CASE(MachineTypeMipsFpu16)
PRINT_ENUM_VALUE_CASE(MachineTypeTriCore)
PRINT_ENUM_VALUE_CASE(MachineTypeCEF)
PRINT_ENUM_VALUE_CASE(MachineTypeEBC)
PRINT_ENUM_VALUE_CASE(MachineTypeAmd64)
PRINT_ENUM_VALUE_CASE(MachineTypeM32R)
PRINT_ENUM_VALUE_CASE(MachineTypeCEE)
}
outs() << " {" << llvm::format_hex((DWORD)MachineType, 2, true) << "}";
return Stream;
}
//===- DIAExtras.cpp - Helper classes and functions for DIA C++ ---------*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm-pdbdump.h"
#include "DIAExtras.h"
using namespace llvm;
using namespace llvm::sys::windows;
#define PRINT_ENUM_VALUE_CASE(Value) \
case Value: \
outs() << #Value; \
break;
raw_ostream &llvm::operator<<(raw_ostream &Stream, DiaSymTagEnum SymTag) {
switch (SymTag) {
PRINT_ENUM_VALUE_CASE(SymTagNull)
PRINT_ENUM_VALUE_CASE(SymTagExe)
PRINT_ENUM_VALUE_CASE(SymTagCompiland)
PRINT_ENUM_VALUE_CASE(SymTagCompilandDetails)
PRINT_ENUM_VALUE_CASE(SymTagCompilandEnv)
PRINT_ENUM_VALUE_CASE(SymTagFunction)
PRINT_ENUM_VALUE_CASE(SymTagBlock)
PRINT_ENUM_VALUE_CASE(SymTagData)
PRINT_ENUM_VALUE_CASE(SymTagAnnotation)
PRINT_ENUM_VALUE_CASE(SymTagLabel)
PRINT_ENUM_VALUE_CASE(SymTagPublicSymbol)
PRINT_ENUM_VALUE_CASE(SymTagUDT)
PRINT_ENUM_VALUE_CASE(SymTagEnum)
PRINT_ENUM_VALUE_CASE(SymTagFunctionType)
PRINT_ENUM_VALUE_CASE(SymTagPointerType)
PRINT_ENUM_VALUE_CASE(SymTagArrayType)
PRINT_ENUM_VALUE_CASE(SymTagBaseType)
PRINT_ENUM_VALUE_CASE(SymTagTypedef)
PRINT_ENUM_VALUE_CASE(SymTagBaseClass)
PRINT_ENUM_VALUE_CASE(SymTagFriend)
PRINT_ENUM_VALUE_CASE(SymTagFunctionArgType)
PRINT_ENUM_VALUE_CASE(SymTagFuncDebugStart)
PRINT_ENUM_VALUE_CASE(SymTagFuncDebugEnd)
PRINT_ENUM_VALUE_CASE(SymTagUsingNamespace)
PRINT_ENUM_VALUE_CASE(SymTagVTableShape)
PRINT_ENUM_VALUE_CASE(SymTagVTable)
PRINT_ENUM_VALUE_CASE(SymTagCustom)
PRINT_ENUM_VALUE_CASE(SymTagThunk)
PRINT_ENUM_VALUE_CASE(SymTagCustomType)
PRINT_ENUM_VALUE_CASE(SymTagManagedType)
PRINT_ENUM_VALUE_CASE(SymTagDimension)
PRINT_ENUM_VALUE_CASE(SymTagCallSite)
PRINT_ENUM_VALUE_CASE(SymTagInlineSite)
PRINT_ENUM_VALUE_CASE(SymTagBaseInterface)
PRINT_ENUM_VALUE_CASE(SymTagVectorType)
PRINT_ENUM_VALUE_CASE(SymTagMatrixType)
PRINT_ENUM_VALUE_CASE(SymTagHLSLType)
#if (_MSC_FULL_VER >= 180031101)
PRINT_ENUM_VALUE_CASE(SymTagCaller)
PRINT_ENUM_VALUE_CASE(SymTagCallee)
#endif
PRINT_ENUM_VALUE_CASE(SymTagMax)
}
outs() << " {" << (DWORD)SymTag << "}";
return Stream;
}
raw_ostream &llvm::operator<<(raw_ostream &Stream, CV_CPU_TYPE_e CpuType) {
switch (CpuType) {
PRINT_ENUM_VALUE_CASE(CV_CFL_8080)
PRINT_ENUM_VALUE_CASE(CV_CFL_8086)
PRINT_ENUM_VALUE_CASE(CV_CFL_80286)
PRINT_ENUM_VALUE_CASE(CV_CFL_80386)
PRINT_ENUM_VALUE_CASE(CV_CFL_80486)
PRINT_ENUM_VALUE_CASE(CV_CFL_PENTIUM)
PRINT_ENUM_VALUE_CASE(CV_CFL_PENTIUMPRO)
PRINT_ENUM_VALUE_CASE(CV_CFL_PENTIUMIII)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS16)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS32)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS64)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSI)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSII)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSIII)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSIV)
PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSV)
PRINT_ENUM_VALUE_CASE(CV_CFL_M68000)
PRINT_ENUM_VALUE_CASE(CV_CFL_M68010)
PRINT_ENUM_VALUE_CASE(CV_CFL_M68020)
PRINT_ENUM_VALUE_CASE(CV_CFL_M68030)
PRINT_ENUM_VALUE_CASE(CV_CFL_M68040)
PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA)
PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21164)
PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21164A)
PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21264)
PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21364)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPC601)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPC603)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPC604)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPC620)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPCFP)
PRINT_ENUM_VALUE_CASE(CV_CFL_PPCBE)
PRINT_ENUM_VALUE_CASE(CV_CFL_SH3)
PRINT_ENUM_VALUE_CASE(CV_CFL_SH3E)
PRINT_ENUM_VALUE_CASE(CV_CFL_SH3DSP)
PRINT_ENUM_VALUE_CASE(CV_CFL_SH4)
PRINT_ENUM_VALUE_CASE(CV_CFL_SHMEDIA)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM3)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM4)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM4T)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM5)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM5T)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM6)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM_XMAC)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM_WMMX)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM7)
PRINT_ENUM_VALUE_CASE(CV_CFL_OMNI)
PRINT_ENUM_VALUE_CASE(CV_CFL_IA64)
PRINT_ENUM_VALUE_CASE(CV_CFL_IA64_2)
PRINT_ENUM_VALUE_CASE(CV_CFL_CEE)
PRINT_ENUM_VALUE_CASE(CV_CFL_AM33)
PRINT_ENUM_VALUE_CASE(CV_CFL_M32R)
PRINT_ENUM_VALUE_CASE(CV_CFL_TRICORE)
PRINT_ENUM_VALUE_CASE(CV_CFL_X64)
PRINT_ENUM_VALUE_CASE(CV_CFL_EBC)
PRINT_ENUM_VALUE_CASE(CV_CFL_THUMB)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARMNT)
#if (_MSC_FULL_VER >= 180031101)
PRINT_ENUM_VALUE_CASE(CV_CFL_ARM64)
#endif
PRINT_ENUM_VALUE_CASE(CV_CFL_D3D11_SHADER)
}
outs() << " {" << llvm::format_hex((DWORD)CpuType, 2, true) << "}";
return Stream;
}
raw_ostream &llvm::operator<<(raw_ostream &Stream,
MachineTypeEnum MachineType) {
switch (MachineType) {
PRINT_ENUM_VALUE_CASE(MachineTypeUnknown)
PRINT_ENUM_VALUE_CASE(MachineTypeX86)
PRINT_ENUM_VALUE_CASE(MachineTypeR3000)
PRINT_ENUM_VALUE_CASE(MachineTypeR4000)
PRINT_ENUM_VALUE_CASE(MachineTypeR10000)
PRINT_ENUM_VALUE_CASE(MachineTypeWCEMIPSv2)
PRINT_ENUM_VALUE_CASE(MachineTypeAlpha)
PRINT_ENUM_VALUE_CASE(MachineTypeSH3)
PRINT_ENUM_VALUE_CASE(MachineTypeSH3DSP)
PRINT_ENUM_VALUE_CASE(MachineTypeSH3E)
PRINT_ENUM_VALUE_CASE(MachineTypeSH4)
PRINT_ENUM_VALUE_CASE(MachineTypeSH5)
PRINT_ENUM_VALUE_CASE(MachineTypeArm)
PRINT_ENUM_VALUE_CASE(MachineTypeThumb)
PRINT_ENUM_VALUE_CASE(MachineTypeArmNT)
PRINT_ENUM_VALUE_CASE(MachineTypeAM33)
PRINT_ENUM_VALUE_CASE(MachineTypePowerPC)
PRINT_ENUM_VALUE_CASE(MachineTypePowerPCFP)
PRINT_ENUM_VALUE_CASE(MachineTypeIa64)
PRINT_ENUM_VALUE_CASE(MachineTypeMips16)
PRINT_ENUM_VALUE_CASE(MachineTypeAlpha64)
PRINT_ENUM_VALUE_CASE(MachineTypeMipsFpu)
PRINT_ENUM_VALUE_CASE(MachineTypeMipsFpu16)
PRINT_ENUM_VALUE_CASE(MachineTypeTriCore)
PRINT_ENUM_VALUE_CASE(MachineTypeCEF)
PRINT_ENUM_VALUE_CASE(MachineTypeEBC)
PRINT_ENUM_VALUE_CASE(MachineTypeAmd64)
PRINT_ENUM_VALUE_CASE(MachineTypeM32R)
PRINT_ENUM_VALUE_CASE(MachineTypeCEE)
}
outs() << " {" << llvm::format_hex((DWORD)MachineType, 2, true) << "}";
return Stream;
}

View File

@ -1,127 +1,127 @@
//===- DIAExtras.h - Helper classes and functions for accessing DIA C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Defines helper types, classes, and functions for working with DIA.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVMPDBDUMP_DIAEXTRAS_H
#define LLVM_TOOLS_LLVMPDBDUMP_DIAEXTRAS_H
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
#include "COMExtras.h"
namespace llvm {
namespace sys {
namespace windows {
typedef llvm::SmallString<16> DIAString;
template <class T> class DIAResult {
public:
DIAResult() : IsValid(false) {}
DIAResult(const T &ResultValue) : Result(ResultValue), IsValid(true) {}
bool hasValue() const { return IsValid; }
T value() const { return Result; }
void dump(StringRef Name, unsigned IndentLevel) const {
if (!hasValue())
return;
outs().indent(IndentLevel);
outs() << Name << ": " << value() << "\n";
}
private:
T Result;
bool IsValid;
};
template <>
void DIAResult<BOOL>::dump(StringRef Name, unsigned IndentLevel) const {
if (!hasValue())
return;
outs().indent(IndentLevel);
outs() << Name << ": " << (value() ? "true" : "false") << "\n";
}
template <>
void DIAResult<GUID>::dump(StringRef Name, unsigned IndentLevel) const {
if (!hasValue())
return;
std::string Guid8;
CComBSTR GuidBSTR(value());
BSTRToUTF8(GuidBSTR.m_str, Guid8);
outs().indent(IndentLevel);
outs() << Name << ": " << Guid8 << "\n";
}
// MSDN documents the IDiaSymbol::get_machineType method as returning a value
// from the CV_CPU_TYPE_e enumeration. This documentation is wrong, however,
// and this method actually returns a value from the IMAGE_FILE_xxx set of
// defines from winnt.h. These correspond to the platform magic number in
// the COFF file. This enumeration is built from the set of values in winnt.h
enum MachineTypeEnum {
MachineTypeUnknown = IMAGE_FILE_MACHINE_UNKNOWN,
MachineTypeX86 = IMAGE_FILE_MACHINE_I386,
MachineTypeR3000 = IMAGE_FILE_MACHINE_R3000,
MachineTypeR4000 = IMAGE_FILE_MACHINE_R4000,
MachineTypeR10000 = IMAGE_FILE_MACHINE_R10000,
MachineTypeWCEMIPSv2 = IMAGE_FILE_MACHINE_WCEMIPSV2,
MachineTypeAlpha = IMAGE_FILE_MACHINE_ALPHA,
MachineTypeSH3 = IMAGE_FILE_MACHINE_SH3,
MachineTypeSH3DSP = IMAGE_FILE_MACHINE_SH3DSP,
MachineTypeSH3E = IMAGE_FILE_MACHINE_SH3E,
MachineTypeSH4 = IMAGE_FILE_MACHINE_SH4,
MachineTypeSH5 = IMAGE_FILE_MACHINE_SH5,
MachineTypeArm = IMAGE_FILE_MACHINE_ARM,
MachineTypeThumb = IMAGE_FILE_MACHINE_THUMB,
MachineTypeArmNT = IMAGE_FILE_MACHINE_ARMNT,
MachineTypeAM33 = IMAGE_FILE_MACHINE_AM33,
MachineTypePowerPC = IMAGE_FILE_MACHINE_POWERPC,
MachineTypePowerPCFP = IMAGE_FILE_MACHINE_POWERPCFP,
MachineTypeIa64 = IMAGE_FILE_MACHINE_IA64,
MachineTypeMips16 = IMAGE_FILE_MACHINE_MIPS16,
MachineTypeAlpha64 = IMAGE_FILE_MACHINE_ALPHA64,
MachineTypeMipsFpu = IMAGE_FILE_MACHINE_MIPSFPU,
MachineTypeMipsFpu16 = IMAGE_FILE_MACHINE_MIPSFPU16,
MachineTypeTriCore = IMAGE_FILE_MACHINE_TRICORE,
MachineTypeCEF = IMAGE_FILE_MACHINE_CEF,
MachineTypeEBC = IMAGE_FILE_MACHINE_EBC,
MachineTypeAmd64 = IMAGE_FILE_MACHINE_AMD64,
MachineTypeM32R = IMAGE_FILE_MACHINE_M32R,
MachineTypeCEE = IMAGE_FILE_MACHINE_CEE,
};
// SymTagEnum has the unfortunate property that it is not only the name of
// the enum, but also the name of one of the values of the enum. So that we
// don't have to always type "enum SymTagEnum", we typedef this to a different
// name so that we can refer to it more easily.
typedef enum SymTagEnum DiaSymTagEnum;
typedef CComPtr<IDiaSymbol> DiaSymbolPtr;
} // namespace windows
} // namespace sys
} // namespace llvm
namespace llvm {
class raw_ostream;
raw_ostream &operator<<(raw_ostream &Stream,
llvm::sys::windows::DiaSymTagEnum SymTag);
raw_ostream &operator<<(raw_ostream &Stream, CV_CPU_TYPE_e CpuType);
raw_ostream &operator<<(raw_ostream &Stream,
llvm::sys::windows::MachineTypeEnum CpuType);
}
#endif
//===- DIAExtras.h - Helper classes and functions for accessing DIA C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Defines helper types, classes, and functions for working with DIA.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVMPDBDUMP_DIAEXTRAS_H
#define LLVM_TOOLS_LLVMPDBDUMP_DIAEXTRAS_H
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
#include "COMExtras.h"
namespace llvm {
namespace sys {
namespace windows {
typedef llvm::SmallString<16> DIAString;
template <class T> class DIAResult {
public:
DIAResult() : IsValid(false) {}
DIAResult(const T &ResultValue) : Result(ResultValue), IsValid(true) {}
bool hasValue() const { return IsValid; }
T value() const { return Result; }
void dump(StringRef Name, unsigned IndentLevel) const {
if (!hasValue())
return;
outs().indent(IndentLevel);
outs() << Name << ": " << value() << "\n";
}
private:
T Result;
bool IsValid;
};
template <>
void DIAResult<BOOL>::dump(StringRef Name, unsigned IndentLevel) const {
if (!hasValue())
return;
outs().indent(IndentLevel);
outs() << Name << ": " << (value() ? "true" : "false") << "\n";
}
template <>
void DIAResult<GUID>::dump(StringRef Name, unsigned IndentLevel) const {
if (!hasValue())
return;
std::string Guid8;
CComBSTR GuidBSTR(value());
BSTRToUTF8(GuidBSTR.m_str, Guid8);
outs().indent(IndentLevel);
outs() << Name << ": " << Guid8 << "\n";
}
// MSDN documents the IDiaSymbol::get_machineType method as returning a value
// from the CV_CPU_TYPE_e enumeration. This documentation is wrong, however,
// and this method actually returns a value from the IMAGE_FILE_xxx set of
// defines from winnt.h. These correspond to the platform magic number in
// the COFF file. This enumeration is built from the set of values in winnt.h
enum MachineTypeEnum {
MachineTypeUnknown = IMAGE_FILE_MACHINE_UNKNOWN,
MachineTypeX86 = IMAGE_FILE_MACHINE_I386,
MachineTypeR3000 = IMAGE_FILE_MACHINE_R3000,
MachineTypeR4000 = IMAGE_FILE_MACHINE_R4000,
MachineTypeR10000 = IMAGE_FILE_MACHINE_R10000,
MachineTypeWCEMIPSv2 = IMAGE_FILE_MACHINE_WCEMIPSV2,
MachineTypeAlpha = IMAGE_FILE_MACHINE_ALPHA,
MachineTypeSH3 = IMAGE_FILE_MACHINE_SH3,
MachineTypeSH3DSP = IMAGE_FILE_MACHINE_SH3DSP,
MachineTypeSH3E = IMAGE_FILE_MACHINE_SH3E,
MachineTypeSH4 = IMAGE_FILE_MACHINE_SH4,
MachineTypeSH5 = IMAGE_FILE_MACHINE_SH5,
MachineTypeArm = IMAGE_FILE_MACHINE_ARM,
MachineTypeThumb = IMAGE_FILE_MACHINE_THUMB,
MachineTypeArmNT = IMAGE_FILE_MACHINE_ARMNT,
MachineTypeAM33 = IMAGE_FILE_MACHINE_AM33,
MachineTypePowerPC = IMAGE_FILE_MACHINE_POWERPC,
MachineTypePowerPCFP = IMAGE_FILE_MACHINE_POWERPCFP,
MachineTypeIa64 = IMAGE_FILE_MACHINE_IA64,
MachineTypeMips16 = IMAGE_FILE_MACHINE_MIPS16,
MachineTypeAlpha64 = IMAGE_FILE_MACHINE_ALPHA64,
MachineTypeMipsFpu = IMAGE_FILE_MACHINE_MIPSFPU,
MachineTypeMipsFpu16 = IMAGE_FILE_MACHINE_MIPSFPU16,
MachineTypeTriCore = IMAGE_FILE_MACHINE_TRICORE,
MachineTypeCEF = IMAGE_FILE_MACHINE_CEF,
MachineTypeEBC = IMAGE_FILE_MACHINE_EBC,
MachineTypeAmd64 = IMAGE_FILE_MACHINE_AMD64,
MachineTypeM32R = IMAGE_FILE_MACHINE_M32R,
MachineTypeCEE = IMAGE_FILE_MACHINE_CEE,
};
// SymTagEnum has the unfortunate property that it is not only the name of
// the enum, but also the name of one of the values of the enum. So that we
// don't have to always type "enum SymTagEnum", we typedef this to a different
// name so that we can refer to it more easily.
typedef enum SymTagEnum DiaSymTagEnum;
typedef CComPtr<IDiaSymbol> DiaSymbolPtr;
} // namespace windows
} // namespace sys
} // namespace llvm
namespace llvm {
class raw_ostream;
raw_ostream &operator<<(raw_ostream &Stream,
llvm::sys::windows::DiaSymTagEnum SymTag);
raw_ostream &operator<<(raw_ostream &Stream, CV_CPU_TYPE_e CpuType);
raw_ostream &operator<<(raw_ostream &Stream,
llvm::sys::windows::MachineTypeEnum CpuType);
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,282 +1,282 @@
//===- DIASymbol.h - Dump debug info from a PDB file ------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Provides a wrapper around the IDiaSymbol interface. IDiaSymbol is used to
// represent any kind of symbol from functions, to compilands, to source files.
// It provides a monolithic interface of close to 200 operations, and the set
// of operations that are valid depends on the type of the symbol. Since it is
// not clearly documented which set of operations is valid for which type of
// symbol, the best way of figuring it out is to dump every method for every
// symbol, and see which methods return errors. This wrapper provides a clean
// way of doing this without involving needing to embed lots of unsightly
// HRESULT checking at every callsite.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVMPDBDUMP_DIASYMBOL_H
#define LLVM_TOOLS_LLVMPDBDUMP_DIASYMBOL_H
#include "DIAExtras.h"
#include "llvm/ADT/SmallString.h"
namespace llvm {
namespace sys {
namespace windows {
class DIASymbol {
public:
DIASymbol(IDiaSymbol *DiaSymbol);
~DIASymbol();
/// Dumps the value of every property (if it exists) with a default name.
/// This is useful for understanding what symbol types support what methods
/// during development time.
void fullDump(int IndentLevel);
// TODO: The following methods are present on IDiaSymbol but do not yet have
// wrapper methods.
//
// HRESULT get_value(VARIANT *pRetVal) = 0;
// HRESULT get_undecoratedNameEx(DWORD undecorateOptions, BSTR *name) = 0;
// HRESULT getSrcLineOnTypeDefn(IDiaLineNumber **ppResult) = 0;
// HRESULT get_dataBytes(DWORD cbData, DWORD *pcbData, BYTE *pbData) = 0;
// HRESULT get_types(DWORD cTypes, DWORD *pcTypes, IDiaSymbol **pTypes) = 0;
// HRESULT get_typeIds(DWORD cTypeIds, DWORD *pcTypeIds, DWORD *pdwTypeIds) = 0;
// HRESULT get_numericProperties(DWORD cnt, DWORD *pcnt,
// DWORD *pProperties) = 0;
// HRESULT get_modifierValues(DWORD cnt, DWORD *pcnt, WORD *pModifiers) = 0;
// HRESULT get_acceleratorPointerTags(DWORD cnt, DWORD *pcnt, DWORD
// *pPointerTags) = 0;
// HRESULT get_hfaFloat(BOOL *pRetVal) = 0;
// HRESULT get_hfaDouble(BOOL *pRetVal) = 0;
// HRESULT get_paramBasePointerRegisterId(DWORD *pRetVal) = 0;
// HRESULT get_isWinRTPointer(BOOL *pRetVal) = 0;
#if (_MSC_FULL_VER >= 180031101)
// These methods are only available on VS 2013 SP 4 and higher.
DIAResult<BOOL> isPGO();
DIAResult<BOOL> hasValidPGOCounts();
DIAResult<BOOL> isOptimizedForSpeed();
DIAResult<DWORD> getPGOEntryCount();
DIAResult<DWORD> getPGOEdgeCount();
DIAResult<ULONGLONG> getPGODynamicInstructionCount();
DIAResult<DWORD> getStaticSize();
DIAResult<DWORD> getFinalLiveStaticSize();
DIAResult<DIAString> getPhaseName();
DIAResult<BOOL> hasControlFlowCheck();
#endif
DIAResult<DiaSymbolPtr> getLexicalParent();
DIAResult<DiaSymbolPtr> getClassParent();
DIAResult<DiaSymbolPtr> getType();
DIAResult<DiaSymbolPtr> getArrayIndexType();
DIAResult<DiaSymbolPtr> getVirtualTableShape();
DIAResult<DiaSymbolPtr> getLowerBound();
DIAResult<DiaSymbolPtr> getUpperBound();
DIAResult<DiaSymbolPtr> getObjectPointerType();
DIAResult<DiaSymbolPtr> getContainer();
DIAResult<DiaSymbolPtr> getVirtualBaseTableType();
DIAResult<DiaSymbolPtr> getUnmodifiedType();
DIAResult<DiaSymbolPtr> getSubType();
DIAResult<DiaSymbolPtr> getBaseSymbol();
DIAResult<DWORD> getAccess();
DIAResult<DWORD> getAddressOffset();
DIAResult<DWORD> getAddressSection();
DIAResult<DWORD> getAge();
DIAResult<DWORD> getArrayIndexTypeId();
DIAResult<DWORD> getBackEndBuild();
DIAResult<DWORD> getBackEndMajor();
DIAResult<DWORD> getBackEndMinor();
DIAResult<DWORD> getBackEndQFE();
DIAResult<DWORD> getBaseDataOffset();
DIAResult<DWORD> getBaseDataSlot();
DIAResult<DWORD> getBaseSymbolId();
DIAResult<DWORD> getBaseType();
DIAResult<DWORD> getBitPosition();
DIAResult<DWORD> getBuiltInKind();
DIAResult<CV_call_e> getCallingConvention();
DIAResult<DWORD> getClassParentId();
DIAResult<DIAString> getCompilerName();
DIAResult<DWORD> getCount();
DIAResult<DWORD> getCountLiveRanges();
DIAResult<DWORD> getFrontEndBuild();
DIAResult<DWORD> getFrontEndMajor();
DIAResult<DWORD> getFrontEndMinor();
DIAResult<DWORD> getFrontEndQFE();
DIAResult<CV_CFL_LANG> getLanguage();
DIAResult<DWORD> getLexicalParentId();
DIAResult<DIAString> getLibraryName();
DIAResult<DWORD> getLiveRangeStartAddressOffset();
DIAResult<DWORD> getLiveRangeStartAddressSection();
DIAResult<DWORD> getLiveRangeStartRelativeVirtualAddress();
DIAResult<DWORD> getLocalBasePointerRegisterId();
DIAResult<DWORD> getLowerBoundId();
DIAResult<DWORD> getMemorySpaceKind();
DIAResult<DIAString> getName();
DIAResult<DWORD> getNumberOfAcceleratorPointerTags();
DIAResult<DWORD> getNumberOfColumns();
DIAResult<DWORD> getNumberOfModifiers();
DIAResult<DWORD> getNumberOfRegisterIndices();
DIAResult<DWORD> getNumberOfRows();
DIAResult<DIAString> getObjectFileName();
DIAResult<DWORD> getOemSymbolId();
DIAResult<DWORD> getOffsetInUdt();
DIAResult<CV_CPU_TYPE_e> getPlatform();
DIAResult<DWORD> getRank();
DIAResult<DWORD> getRegisterId();
DIAResult<DWORD> getRegisterType();
DIAResult<DWORD> getRelativeVirtualAddress();
DIAResult<DWORD> getSamplerSlot();
DIAResult<DWORD> getSignature();
DIAResult<DWORD> getSizeInUdt();
DIAResult<DWORD> getSlot();
DIAResult<DIAString> getSourceFileName();
DIAResult<DWORD> getStride();
DIAResult<DWORD> getSubTypeId();
DIAResult<DIAString> getSymbolsFileName();
DIAResult<DWORD> getSymIndexId();
DIAResult<DWORD> getTargetOffset();
DIAResult<DWORD> getTargetRelativeVirtualAddress();
DIAResult<DWORD> getTargetSection();
DIAResult<DWORD> getTextureSlot();
DIAResult<DWORD> getTimeStamp();
DIAResult<DWORD> getToken();
DIAResult<DWORD> getUavSlot();
DIAResult<DIAString> getUndecoratedName();
DIAResult<DWORD> getUnmodifiedTypeId();
DIAResult<DWORD> getUpperBoundId();
DIAResult<DWORD> getVirtualBaseDispIndex();
DIAResult<DWORD> getVirtualBaseOffset();
DIAResult<DWORD> getVirtualTableShapeId();
DIAResult<DataKind> getDataKind();
DIAResult<DiaSymTagEnum> getSymTag();
DIAResult<GUID> getGuid();
DIAResult<LONG> getOffset();
DIAResult<LONG> getThisAdjust();
DIAResult<LONG> getVirtualBasePointerOffset();
DIAResult<LocationType> getLocationType();
DIAResult<MachineTypeEnum> getMachineType();
DIAResult<THUNK_ORDINAL> getThunkOrdinal();
DIAResult<ULONGLONG> getLength();
DIAResult<ULONGLONG> getLiveRangeLength();
DIAResult<ULONGLONG> getTargetVirtualAddress();
DIAResult<ULONGLONG> getVirtualAddress();
DIAResult<UdtKind> getUdtKind();
DIAResult<BOOL> hasConstructor();
DIAResult<BOOL> hasCustomCallingConvention();
DIAResult<BOOL> hasFarReturn();
DIAResult<BOOL> isCode();
DIAResult<BOOL> isCompilerGenerated();
DIAResult<BOOL> isConstType();
DIAResult<BOOL> isEditAndContinueEnabled();
DIAResult<BOOL> isFunction();
DIAResult<BOOL> getAddressTaken();
DIAResult<BOOL> getNoStackOrdering();
DIAResult<BOOL> hasAlloca();
DIAResult<BOOL> hasAssignmentOperator();
DIAResult<BOOL> hasCTypes();
DIAResult<BOOL> hasCastOperator();
DIAResult<BOOL> hasDebugInfo();
DIAResult<BOOL> hasEH();
DIAResult<BOOL> hasEHa();
DIAResult<BOOL> hasInlAsm();
DIAResult<BOOL> hasInlineAttribute();
DIAResult<BOOL> hasInterruptReturn();
DIAResult<BOOL> hasLongJump();
DIAResult<BOOL> hasManagedCode();
DIAResult<BOOL> hasNestedTypes();
DIAResult<BOOL> hasNoInlineAttribute();
DIAResult<BOOL> hasNoReturnAttribute();
DIAResult<BOOL> hasOptimizedCodeDebugInfo();
DIAResult<BOOL> hasOverloadedOperator();
DIAResult<BOOL> hasSEH();
DIAResult<BOOL> hasSecurityChecks();
DIAResult<BOOL> hasSetJump();
DIAResult<BOOL> hasStrictGSCheck();
DIAResult<BOOL> isAcceleratorGroupSharedLocal();
DIAResult<BOOL> isAcceleratorPointerTagLiveRange();
DIAResult<BOOL> isAcceleratorStubFunction();
DIAResult<BOOL> isAggregated();
DIAResult<BOOL> isBaseVirtualFunction();
DIAResult<BOOL> isCVTCIL();
DIAResult<BOOL> isConstructorVirtualBase();
DIAResult<BOOL> isCxxReturnUdt();
DIAResult<BOOL> isDataAligned();
DIAResult<BOOL> isHLSLData();
DIAResult<BOOL> isHotpatchable();
DIAResult<BOOL> isIndirectVirtualBaseClass();
DIAResult<BOOL> isInterfaceUdt();
DIAResult<BOOL> isIntrinsic();
DIAResult<BOOL> isLTCG();
DIAResult<BOOL> isLocationControlFlowDependent();
DIAResult<BOOL> isMSILNetmodule();
DIAResult<BOOL> isManagedRef();
DIAResult<BOOL> isMatrixRowMajor();
DIAResult<BOOL> isMsilRef();
DIAResult<BOOL> isMultipleInheritance();
DIAResult<BOOL> isNaked();
DIAResult<BOOL> isNested();
DIAResult<BOOL> isOptimizedAway();
DIAResult<BOOL> isPacked();
DIAResult<BOOL> isPointerBasedOnSymbolValue();
DIAResult<BOOL> isPointerToDataMember();
DIAResult<BOOL> isPointerToMemberFunction();
DIAResult<BOOL> isPureVirtual();
DIAResult<BOOL> isRValueReference();
DIAResult<BOOL> isRefUdt();
DIAResult<BOOL> isReference();
DIAResult<BOOL> isRestrictedType();
DIAResult<BOOL> isReturnValue();
DIAResult<BOOL> isSafeBuffers();
DIAResult<BOOL> isScoped();
DIAResult<BOOL> isSdl();
DIAResult<BOOL> isSingleInheritance();
DIAResult<BOOL> isSplitted();
DIAResult<BOOL> isStatic();
DIAResult<BOOL> isStripped();
DIAResult<BOOL> isUnalignedType();
DIAResult<BOOL> isUnreached();
DIAResult<BOOL> isValueUdt();
DIAResult<BOOL> isVirtual();
DIAResult<BOOL> isVirtualBaseClass();
DIAResult<BOOL> isVirtualInheritance();
DIAResult<BOOL> isVolatileType();
private:
template <class T, class U = T>
DIAResult<U>
InternalGetDIAValue(HRESULT (__stdcall IDiaSymbol::*Method)(T *)) {
T Value;
if (S_OK == (Symbol->*Method)(&Value))
return DIAResult<U>(U(Value));
else
return DIAResult<U>();
}
DIAResult<DIAString>
InternalGetDIAStringValue(HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
BSTR String16;
if (S_OK == (Symbol->*Method)(&String16)) {
std::string String8;
llvm::sys::windows::BSTRToUTF8(String16, String8);
SysFreeString(String16);
return DIAResult<DIAString>(DIAString(String8));
} else
return DIAResult<DIAString>();
}
IDiaSymbol *Symbol;
};
} // namespace windows
} // namespace sys
} // namespace llvm
#endif
//===- DIASymbol.h - Dump debug info from a PDB file ------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Provides a wrapper around the IDiaSymbol interface. IDiaSymbol is used to
// represent any kind of symbol from functions, to compilands, to source files.
// It provides a monolithic interface of close to 200 operations, and the set
// of operations that are valid depends on the type of the symbol. Since it is
// not clearly documented which set of operations is valid for which type of
// symbol, the best way of figuring it out is to dump every method for every
// symbol, and see which methods return errors. This wrapper provides a clean
// way of doing this without involving needing to embed lots of unsightly
// HRESULT checking at every callsite.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVMPDBDUMP_DIASYMBOL_H
#define LLVM_TOOLS_LLVMPDBDUMP_DIASYMBOL_H
#include "DIAExtras.h"
#include "llvm/ADT/SmallString.h"
namespace llvm {
namespace sys {
namespace windows {
class DIASymbol {
public:
DIASymbol(IDiaSymbol *DiaSymbol);
~DIASymbol();
/// Dumps the value of every property (if it exists) with a default name.
/// This is useful for understanding what symbol types support what methods
/// during development time.
void fullDump(int IndentLevel);
// TODO: The following methods are present on IDiaSymbol but do not yet have
// wrapper methods.
//
// HRESULT get_value(VARIANT *pRetVal) = 0;
// HRESULT get_undecoratedNameEx(DWORD undecorateOptions, BSTR *name) = 0;
// HRESULT getSrcLineOnTypeDefn(IDiaLineNumber **ppResult) = 0;
// HRESULT get_dataBytes(DWORD cbData, DWORD *pcbData, BYTE *pbData) = 0;
// HRESULT get_types(DWORD cTypes, DWORD *pcTypes, IDiaSymbol **pTypes) = 0;
// HRESULT get_typeIds(DWORD cTypeIds, DWORD *pcTypeIds, DWORD *pdwTypeIds) = 0;
// HRESULT get_numericProperties(DWORD cnt, DWORD *pcnt,
// DWORD *pProperties) = 0;
// HRESULT get_modifierValues(DWORD cnt, DWORD *pcnt, WORD *pModifiers) = 0;
// HRESULT get_acceleratorPointerTags(DWORD cnt, DWORD *pcnt, DWORD
// *pPointerTags) = 0;
// HRESULT get_hfaFloat(BOOL *pRetVal) = 0;
// HRESULT get_hfaDouble(BOOL *pRetVal) = 0;
// HRESULT get_paramBasePointerRegisterId(DWORD *pRetVal) = 0;
// HRESULT get_isWinRTPointer(BOOL *pRetVal) = 0;
#if (_MSC_FULL_VER >= 180031101)
// These methods are only available on VS 2013 SP 4 and higher.
DIAResult<BOOL> isPGO();
DIAResult<BOOL> hasValidPGOCounts();
DIAResult<BOOL> isOptimizedForSpeed();
DIAResult<DWORD> getPGOEntryCount();
DIAResult<DWORD> getPGOEdgeCount();
DIAResult<ULONGLONG> getPGODynamicInstructionCount();
DIAResult<DWORD> getStaticSize();
DIAResult<DWORD> getFinalLiveStaticSize();
DIAResult<DIAString> getPhaseName();
DIAResult<BOOL> hasControlFlowCheck();
#endif
DIAResult<DiaSymbolPtr> getLexicalParent();
DIAResult<DiaSymbolPtr> getClassParent();
DIAResult<DiaSymbolPtr> getType();
DIAResult<DiaSymbolPtr> getArrayIndexType();
DIAResult<DiaSymbolPtr> getVirtualTableShape();
DIAResult<DiaSymbolPtr> getLowerBound();
DIAResult<DiaSymbolPtr> getUpperBound();
DIAResult<DiaSymbolPtr> getObjectPointerType();
DIAResult<DiaSymbolPtr> getContainer();
DIAResult<DiaSymbolPtr> getVirtualBaseTableType();
DIAResult<DiaSymbolPtr> getUnmodifiedType();
DIAResult<DiaSymbolPtr> getSubType();
DIAResult<DiaSymbolPtr> getBaseSymbol();
DIAResult<DWORD> getAccess();
DIAResult<DWORD> getAddressOffset();
DIAResult<DWORD> getAddressSection();
DIAResult<DWORD> getAge();
DIAResult<DWORD> getArrayIndexTypeId();
DIAResult<DWORD> getBackEndBuild();
DIAResult<DWORD> getBackEndMajor();
DIAResult<DWORD> getBackEndMinor();
DIAResult<DWORD> getBackEndQFE();
DIAResult<DWORD> getBaseDataOffset();
DIAResult<DWORD> getBaseDataSlot();
DIAResult<DWORD> getBaseSymbolId();
DIAResult<DWORD> getBaseType();
DIAResult<DWORD> getBitPosition();
DIAResult<DWORD> getBuiltInKind();
DIAResult<CV_call_e> getCallingConvention();
DIAResult<DWORD> getClassParentId();
DIAResult<DIAString> getCompilerName();
DIAResult<DWORD> getCount();
DIAResult<DWORD> getCountLiveRanges();
DIAResult<DWORD> getFrontEndBuild();
DIAResult<DWORD> getFrontEndMajor();
DIAResult<DWORD> getFrontEndMinor();
DIAResult<DWORD> getFrontEndQFE();
DIAResult<CV_CFL_LANG> getLanguage();
DIAResult<DWORD> getLexicalParentId();
DIAResult<DIAString> getLibraryName();
DIAResult<DWORD> getLiveRangeStartAddressOffset();
DIAResult<DWORD> getLiveRangeStartAddressSection();
DIAResult<DWORD> getLiveRangeStartRelativeVirtualAddress();
DIAResult<DWORD> getLocalBasePointerRegisterId();
DIAResult<DWORD> getLowerBoundId();
DIAResult<DWORD> getMemorySpaceKind();
DIAResult<DIAString> getName();
DIAResult<DWORD> getNumberOfAcceleratorPointerTags();
DIAResult<DWORD> getNumberOfColumns();
DIAResult<DWORD> getNumberOfModifiers();
DIAResult<DWORD> getNumberOfRegisterIndices();
DIAResult<DWORD> getNumberOfRows();
DIAResult<DIAString> getObjectFileName();
DIAResult<DWORD> getOemSymbolId();
DIAResult<DWORD> getOffsetInUdt();
DIAResult<CV_CPU_TYPE_e> getPlatform();
DIAResult<DWORD> getRank();
DIAResult<DWORD> getRegisterId();
DIAResult<DWORD> getRegisterType();
DIAResult<DWORD> getRelativeVirtualAddress();
DIAResult<DWORD> getSamplerSlot();
DIAResult<DWORD> getSignature();
DIAResult<DWORD> getSizeInUdt();
DIAResult<DWORD> getSlot();
DIAResult<DIAString> getSourceFileName();
DIAResult<DWORD> getStride();
DIAResult<DWORD> getSubTypeId();
DIAResult<DIAString> getSymbolsFileName();
DIAResult<DWORD> getSymIndexId();
DIAResult<DWORD> getTargetOffset();
DIAResult<DWORD> getTargetRelativeVirtualAddress();
DIAResult<DWORD> getTargetSection();
DIAResult<DWORD> getTextureSlot();
DIAResult<DWORD> getTimeStamp();
DIAResult<DWORD> getToken();
DIAResult<DWORD> getUavSlot();
DIAResult<DIAString> getUndecoratedName();
DIAResult<DWORD> getUnmodifiedTypeId();
DIAResult<DWORD> getUpperBoundId();
DIAResult<DWORD> getVirtualBaseDispIndex();
DIAResult<DWORD> getVirtualBaseOffset();
DIAResult<DWORD> getVirtualTableShapeId();
DIAResult<DataKind> getDataKind();
DIAResult<DiaSymTagEnum> getSymTag();
DIAResult<GUID> getGuid();
DIAResult<LONG> getOffset();
DIAResult<LONG> getThisAdjust();
DIAResult<LONG> getVirtualBasePointerOffset();
DIAResult<LocationType> getLocationType();
DIAResult<MachineTypeEnum> getMachineType();
DIAResult<THUNK_ORDINAL> getThunkOrdinal();
DIAResult<ULONGLONG> getLength();
DIAResult<ULONGLONG> getLiveRangeLength();
DIAResult<ULONGLONG> getTargetVirtualAddress();
DIAResult<ULONGLONG> getVirtualAddress();
DIAResult<UdtKind> getUdtKind();
DIAResult<BOOL> hasConstructor();
DIAResult<BOOL> hasCustomCallingConvention();
DIAResult<BOOL> hasFarReturn();
DIAResult<BOOL> isCode();
DIAResult<BOOL> isCompilerGenerated();
DIAResult<BOOL> isConstType();
DIAResult<BOOL> isEditAndContinueEnabled();
DIAResult<BOOL> isFunction();
DIAResult<BOOL> getAddressTaken();
DIAResult<BOOL> getNoStackOrdering();
DIAResult<BOOL> hasAlloca();
DIAResult<BOOL> hasAssignmentOperator();
DIAResult<BOOL> hasCTypes();
DIAResult<BOOL> hasCastOperator();
DIAResult<BOOL> hasDebugInfo();
DIAResult<BOOL> hasEH();
DIAResult<BOOL> hasEHa();
DIAResult<BOOL> hasInlAsm();
DIAResult<BOOL> hasInlineAttribute();
DIAResult<BOOL> hasInterruptReturn();
DIAResult<BOOL> hasLongJump();
DIAResult<BOOL> hasManagedCode();
DIAResult<BOOL> hasNestedTypes();
DIAResult<BOOL> hasNoInlineAttribute();
DIAResult<BOOL> hasNoReturnAttribute();
DIAResult<BOOL> hasOptimizedCodeDebugInfo();
DIAResult<BOOL> hasOverloadedOperator();
DIAResult<BOOL> hasSEH();
DIAResult<BOOL> hasSecurityChecks();
DIAResult<BOOL> hasSetJump();
DIAResult<BOOL> hasStrictGSCheck();
DIAResult<BOOL> isAcceleratorGroupSharedLocal();
DIAResult<BOOL> isAcceleratorPointerTagLiveRange();
DIAResult<BOOL> isAcceleratorStubFunction();
DIAResult<BOOL> isAggregated();
DIAResult<BOOL> isBaseVirtualFunction();
DIAResult<BOOL> isCVTCIL();
DIAResult<BOOL> isConstructorVirtualBase();
DIAResult<BOOL> isCxxReturnUdt();
DIAResult<BOOL> isDataAligned();
DIAResult<BOOL> isHLSLData();
DIAResult<BOOL> isHotpatchable();
DIAResult<BOOL> isIndirectVirtualBaseClass();
DIAResult<BOOL> isInterfaceUdt();
DIAResult<BOOL> isIntrinsic();
DIAResult<BOOL> isLTCG();
DIAResult<BOOL> isLocationControlFlowDependent();
DIAResult<BOOL> isMSILNetmodule();
DIAResult<BOOL> isManagedRef();
DIAResult<BOOL> isMatrixRowMajor();
DIAResult<BOOL> isMsilRef();
DIAResult<BOOL> isMultipleInheritance();
DIAResult<BOOL> isNaked();
DIAResult<BOOL> isNested();
DIAResult<BOOL> isOptimizedAway();
DIAResult<BOOL> isPacked();
DIAResult<BOOL> isPointerBasedOnSymbolValue();
DIAResult<BOOL> isPointerToDataMember();
DIAResult<BOOL> isPointerToMemberFunction();
DIAResult<BOOL> isPureVirtual();
DIAResult<BOOL> isRValueReference();
DIAResult<BOOL> isRefUdt();
DIAResult<BOOL> isReference();
DIAResult<BOOL> isRestrictedType();
DIAResult<BOOL> isReturnValue();
DIAResult<BOOL> isSafeBuffers();
DIAResult<BOOL> isScoped();
DIAResult<BOOL> isSdl();
DIAResult<BOOL> isSingleInheritance();
DIAResult<BOOL> isSplitted();
DIAResult<BOOL> isStatic();
DIAResult<BOOL> isStripped();
DIAResult<BOOL> isUnalignedType();
DIAResult<BOOL> isUnreached();
DIAResult<BOOL> isValueUdt();
DIAResult<BOOL> isVirtual();
DIAResult<BOOL> isVirtualBaseClass();
DIAResult<BOOL> isVirtualInheritance();
DIAResult<BOOL> isVolatileType();
private:
template <class T, class U = T>
DIAResult<U>
InternalGetDIAValue(HRESULT (__stdcall IDiaSymbol::*Method)(T *)) {
T Value;
if (S_OK == (Symbol->*Method)(&Value))
return DIAResult<U>(U(Value));
else
return DIAResult<U>();
}
DIAResult<DIAString>
InternalGetDIAStringValue(HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
BSTR String16;
if (S_OK == (Symbol->*Method)(&String16)) {
std::string String8;
llvm::sys::windows::BSTRToUTF8(String16, String8);
SysFreeString(String16);
return DIAResult<DIAString>(DIAString(String8));
} else
return DIAResult<DIAString>();
}
IDiaSymbol *Symbol;
};
} // namespace windows
} // namespace sys
} // namespace llvm
#endif

View File

@ -1,32 +1,32 @@
//===- llvm-pdbdump.h - Common includes for llvm-pdbdump --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// Common defines and header includes for all llvm-pdbdump. The definitions
// here configure the necessary #defines and include system headers in the
// proper order for using DIA.
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H
#define LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H
#define NTDDI_VERSION NTDDI_VISTA
#define _WIN32_WINNT _WIN32_WINNT_VISTA
#define WINVER _WIN32_WINNT_VISTA
#ifndef NOMINMAX
#define NOMINMAX
#endif
// atlbase.h has to come before windows.h
#include <atlbase.h>
#include <windows.h>
// DIA headers must come after windows headers.
#include <cvconst.h>
#include <dia2.h>
//===- llvm-pdbdump.h - Common includes for llvm-pdbdump --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// Common defines and header includes for all llvm-pdbdump. The definitions
// here configure the necessary #defines and include system headers in the
// proper order for using DIA.
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H
#define LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H
#define NTDDI_VERSION NTDDI_VISTA
#define _WIN32_WINNT _WIN32_WINNT_VISTA
#define WINVER _WIN32_WINNT_VISTA
#ifndef NOMINMAX
#define NOMINMAX
#endif
// atlbase.h has to come before windows.h
#include <atlbase.h>
#include <windows.h>
// DIA headers must come after windows headers.
#include <cvconst.h>
#include <dia2.h>
#endif