You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm
bindings
cmake
docs
examples
include
lib
Analysis
AsmParser
BinaryFormat
Bitcode
CodeGen
DebugInfo
CodeView
DWARF
MSF
PDB
DIA
Native
DbiModuleDescriptor.cpp
DbiModuleDescriptorBuilder.cpp
DbiModuleList.cpp
DbiStream.cpp
DbiStreamBuilder.cpp
EnumTables.cpp
GSIStreamBuilder.cpp
GlobalsStream.cpp
Hash.cpp
HashTable.cpp
InfoStream.cpp
InfoStreamBuilder.cpp
ModuleDebugStream.cpp
NamedStreamMap.cpp
NativeBuiltinSymbol.cpp
NativeCompilandSymbol.cpp
NativeEnumModules.cpp
NativeEnumSymbol.cpp
NativeEnumTypes.cpp
NativeExeSymbol.cpp
NativeRawSymbol.cpp
NativeSession.cpp
PDBFile.cpp
PDBFileBuilder.cpp
PDBStringTable.cpp
PDBStringTableBuilder.cpp
PublicsStream.cpp
RawError.cpp
SymbolStream.cpp
TpiHashing.cpp
TpiStream.cpp
TpiStreamBuilder.cpp
CMakeLists.txt
GenericError.cpp
IPDBSourceFile.cpp
LLVMBuild.txt
PDB.cpp
PDBContext.cpp
PDBExtras.cpp
PDBInterfaceAnchors.cpp
PDBSymDumper.cpp
PDBSymbol.cpp
PDBSymbolAnnotation.cpp
PDBSymbolBlock.cpp
PDBSymbolCompiland.cpp
PDBSymbolCompilandDetails.cpp
PDBSymbolCompilandEnv.cpp
PDBSymbolCustom.cpp
PDBSymbolData.cpp
PDBSymbolExe.cpp
PDBSymbolFunc.cpp
PDBSymbolFuncDebugEnd.cpp
PDBSymbolFuncDebugStart.cpp
PDBSymbolLabel.cpp
PDBSymbolPublicSymbol.cpp
PDBSymbolThunk.cpp
PDBSymbolTypeArray.cpp
PDBSymbolTypeBaseClass.cpp
PDBSymbolTypeBuiltin.cpp
PDBSymbolTypeCustom.cpp
PDBSymbolTypeDimension.cpp
PDBSymbolTypeEnum.cpp
PDBSymbolTypeFriend.cpp
PDBSymbolTypeFunctionArg.cpp
PDBSymbolTypeFunctionSig.cpp
PDBSymbolTypeManaged.cpp
PDBSymbolTypePointer.cpp
PDBSymbolTypeTypedef.cpp
PDBSymbolTypeUDT.cpp
PDBSymbolTypeVTable.cpp
PDBSymbolTypeVTableShape.cpp
PDBSymbolUnknown.cpp
PDBSymbolUsingNamespace.cpp
UDTLayout.cpp
Symbolize
CMakeLists.txt
LLVMBuild.txt
Demangle
ExecutionEngine
FuzzMutate
Fuzzer
IR
IRReader
LTO
LineEditor
Linker
MC
Object
ObjectYAML
Option
Passes
ProfileData
Support
TableGen
Target
Testing
ToolDrivers
Transforms
WindowsManifest
XRay
CMakeLists.txt
LLVMBuild.txt
projects
resources
runtimes
scripts
test
tools
unittests
utils
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
libgc
llvm
m4
man
mcs
mk
mono
msvc
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
138 lines
3.9 KiB
C++
138 lines
3.9 KiB
C++
![]() |
//===- InfoStream.cpp - PDB Info Stream (Stream 1) Access -------*- C++ -*-===//
|
||
|
//
|
||
|
// The LLVM Compiler Infrastructure
|
||
|
//
|
||
|
// This file is distributed under the University of Illinois Open Source
|
||
|
// License. See LICENSE.TXT for details.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
|
||
|
#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
|
||
|
#include "llvm/ADT/BitVector.h"
|
||
|
#include "llvm/ADT/SmallVector.h"
|
||
|
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
|
||
|
#include "llvm/DebugInfo/PDB/Native/RawError.h"
|
||
|
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
|
||
|
#include "llvm/Support/BinaryStreamReader.h"
|
||
|
|
||
|
using namespace llvm;
|
||
|
using namespace llvm::codeview;
|
||
|
using namespace llvm::msf;
|
||
|
using namespace llvm::pdb;
|
||
|
|
||
|
InfoStream::InfoStream(std::unique_ptr<MappedBlockStream> Stream)
|
||
|
: Stream(std::move(Stream)) {}
|
||
|
|
||
|
Error InfoStream::reload() {
|
||
|
BinaryStreamReader Reader(*Stream);
|
||
|
|
||
|
const InfoStreamHeader *H;
|
||
|
if (auto EC = Reader.readObject(H))
|
||
|
return joinErrors(
|
||
|
std::move(EC),
|
||
|
make_error<RawError>(raw_error_code::corrupt_file,
|
||
|
"PDB Stream does not contain a header."));
|
||
|
|
||
|
switch (H->Version) {
|
||
|
case PdbImplVC70:
|
||
|
case PdbImplVC80:
|
||
|
case PdbImplVC110:
|
||
|
case PdbImplVC140:
|
||
|
break;
|
||
|
default:
|
||
|
return make_error<RawError>(raw_error_code::corrupt_file,
|
||
|
"Unsupported PDB stream version.");
|
||
|
}
|
||
|
|
||
|
Version = H->Version;
|
||
|
Signature = H->Signature;
|
||
|
Age = H->Age;
|
||
|
Guid = H->Guid;
|
||
|
|
||
|
uint32_t Offset = Reader.getOffset();
|
||
|
if (auto EC = NamedStreams.load(Reader))
|
||
|
return EC;
|
||
|
uint32_t NewOffset = Reader.getOffset();
|
||
|
NamedStreamMapByteSize = NewOffset - Offset;
|
||
|
|
||
|
Reader.setOffset(Offset);
|
||
|
if (auto EC = Reader.readSubstream(SubNamedStreams, NamedStreamMapByteSize))
|
||
|
return EC;
|
||
|
|
||
|
bool Stop = false;
|
||
|
while (!Stop && !Reader.empty()) {
|
||
|
PdbRaw_FeatureSig Sig;
|
||
|
if (auto EC = Reader.readEnum(Sig))
|
||
|
return EC;
|
||
|
// Since this value comes from a file, it's possible we have some strange
|
||
|
// value which doesn't correspond to any value. We don't want to warn on
|
||
|
// -Wcovered-switch-default in this case, so switch on the integral value
|
||
|
// instead of the enumeration value.
|
||
|
switch (uint32_t(Sig)) {
|
||
|
case uint32_t(PdbRaw_FeatureSig::VC110):
|
||
|
// No other flags for VC110 PDB.
|
||
|
Stop = true;
|
||
|
LLVM_FALLTHROUGH;
|
||
|
case uint32_t(PdbRaw_FeatureSig::VC140):
|
||
|
Features |= PdbFeatureContainsIdStream;
|
||
|
break;
|
||
|
case uint32_t(PdbRaw_FeatureSig::NoTypeMerge):
|
||
|
Features |= PdbFeatureNoTypeMerging;
|
||
|
break;
|
||
|
case uint32_t(PdbRaw_FeatureSig::MinimalDebugInfo):
|
||
|
Features |= PdbFeatureMinimalDebugInfo;
|
||
|
break;
|
||
|
default:
|
||
|
continue;
|
||
|
}
|
||
|
FeatureSignatures.push_back(Sig);
|
||
|
}
|
||
|
return Error::success();
|
||
|
}
|
||
|
|
||
|
uint32_t InfoStream::getStreamSize() const { return Stream->getLength(); }
|
||
|
|
||
|
uint32_t InfoStream::getNamedStreamIndex(llvm::StringRef Name) const {
|
||
|
uint32_t Result;
|
||
|
if (!NamedStreams.get(Name, Result))
|
||
|
return 0;
|
||
|
return Result;
|
||
|
}
|
||
|
|
||
|
iterator_range<StringMapConstIterator<uint32_t>>
|
||
|
InfoStream::named_streams() const {
|
||
|
return NamedStreams.entries();
|
||
|
}
|
||
|
|
||
|
bool InfoStream::containsIdStream() const {
|
||
|
return !!(Features & PdbFeatureContainsIdStream);
|
||
|
}
|
||
|
|
||
|
PdbRaw_ImplVer InfoStream::getVersion() const {
|
||
|
return static_cast<PdbRaw_ImplVer>(Version);
|
||
|
}
|
||
|
|
||
|
uint32_t InfoStream::getSignature() const { return Signature; }
|
||
|
|
||
|
uint32_t InfoStream::getAge() const { return Age; }
|
||
|
|
||
|
GUID InfoStream::getGuid() const { return Guid; }
|
||
|
|
||
|
uint32_t InfoStream::getNamedStreamMapByteSize() const {
|
||
|
return NamedStreamMapByteSize;
|
||
|
}
|
||
|
|
||
|
PdbRaw_Features InfoStream::getFeatures() const { return Features; }
|
||
|
|
||
|
ArrayRef<PdbRaw_FeatureSig> InfoStream::getFeatureSignatures() const {
|
||
|
return FeatureSignatures;
|
||
|
}
|
||
|
|
||
|
const NamedStreamMap &InfoStream::getNamedStreams() const {
|
||
|
return NamedStreams;
|
||
|
}
|
||
|
|
||
|
BinarySubstreamRef InfoStream::getNamedStreamsBuffer() const {
|
||
|
return SubNamedStreams;
|
||
|
}
|