Files
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
eng
libcxx
libcxxabi
libunwind
lld
lldb
llvm
bindings
cmake
docs
CommandGuide
Frontend
HistoricalNotes
PDB
CodeViewSymbols.rst
CodeViewTypes.rst
DbiStream.rst
GlobalStream.rst
HashStream.rst
ModiStream.rst
MsfFile.rst
PdbStream.rst
PublicStream.rst
TpiStream.rst
index.rst
Proposals
TableGen
_ocamldoc
_static
_templates
_themes
tutorial
AMDGPUUsage.rst.REMOVED.git-id
ARM-BE-bitcastfail.png
ARM-BE-bitcastsuccess.png
ARM-BE-ld1.png
ARM-BE-ldr.png
AdvancedBuilds.rst
AliasAnalysis.rst
Atomics.rst
Benchmarking.rst
BigEndianNEON.rst
BitCodeFormat.rst
BlockFrequencyTerminology.rst
BranchWeightMetadata.rst
Bugpoint.rst
CFIVerify.rst
CMake.rst
CMakeLists.txt
CMakePrimer.rst
CodeGenerator.rst.REMOVED.git-id
CodeOfConduct.rst
CodingStandards.rst
CommandLine.rst
CompileCudaWithLLVM.rst
CompilerWriterInfo.rst
Coroutines.rst
CoverageMappingFormat.rst
DebuggingJITedCode.rst
DeveloperPolicy.rst
Docker.rst
ExceptionHandling.rst
ExtendedIntegerResults.txt
ExtendingLLVM.rst
Extensions.rst
FAQ.rst
FaultMaps.rst
FuzzingLLVM.rst
GarbageCollection.rst
GetElementPtr.rst
GettingStarted.rst
GettingStartedVS.rst
GlobalISel.rst
GoldPlugin.rst
HowToAddABuilder.rst
HowToBuildOnARM.rst
HowToCrossCompileBuiltinsOnArm.rst
HowToCrossCompileLLVM.rst
HowToReleaseLLVM.rst
HowToSetUpLLVMStyleRTTI.rst
HowToSubmitABug.rst
HowToUseAttributes.rst
HowToUseInstrMappings.rst
InAlloca.rst
LLVMBuild.rst
LLVMBuild.txt
LangRef.rst.REMOVED.git-id
Lexicon.rst
LibFuzzer.rst
LinkTimeOptimization.rst
MCJIT-creation.png
MCJIT-dyld-load.png
MCJIT-engine-builder.png
MCJIT-load-object.png
MCJIT-load.png
MCJIT-resolve-relocations.png
MCJITDesignAndImplementation.rst
MIRLangRef.rst
Makefile.sphinx
MarkedUpDisassembly.rst
MemorySSA.rst
MergeFunctions.rst
NVPTXUsage.rst
OptBisect.rst
Packaging.rst
Passes.rst
Phabricator.rst
ProgrammersManual.rst.REMOVED.git-id
Projects.rst
README.txt
ReleaseNotes.rst
ReleaseProcess.rst
ReportingGuide.rst
ScudoHardenedAllocator.rst
SegmentedStacks.rst
SourceLevelDebugging.rst
SphinxQuickstartTemplate.rst
StackMaps.rst
Statepoints.rst
SystemLibrary.rst
TableGenFundamentals.rst
TestSuiteMakefileGuide.rst
TestingGuide.rst
TypeMetadata.rst
Vectorizers.rst
WritingAnLLVMBackend.rst
WritingAnLLVMPass.rst
XRay.rst
XRayExample.rst
XRayFDRFormat.rst
YamlIO.rst
conf.py
doxygen-mainpage.dox
doxygen.cfg.in
gcc-loops.png
index.rst
linpack-pc.png
make.bat
re_format.7
yaml2obj.rst
examples
include
lib
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
version.txt.in
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
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
linux-packaging-mono/external/llvm-project/llvm/docs/PDB/PdbStream.rst

81 lines
3.1 KiB
ReStructuredText
Raw Normal View History

========================================
The PDB Info Stream (aka the PDB Stream)
========================================
.. contents::
:local:
.. _pdb_stream_header:
Stream Header
=============
At offset 0 of the PDB Stream is a header with the following layout:
.. code-block:: c++
struct PdbStreamHeader {
ulittle32_t Version;
ulittle32_t Signature;
ulittle32_t Age;
Guid UniqueId;
};
- **Version** - A Value from the following enum:
.. code-block:: c++
enum class PdbStreamVersion : uint32_t {
VC2 = 19941610,
VC4 = 19950623,
VC41 = 19950814,
VC50 = 19960307,
VC98 = 19970604,
VC70Dep = 19990604,
VC70 = 20000404,
VC80 = 20030901,
VC110 = 20091201,
VC140 = 20140508,
};
While the meaning of this field appears to be obvious, in practice we have
never observed a value other than ``VC70``, even with modern versions of
the toolchain, and it is unclear why the other values exist. It is assumed
that certain aspects of the PDB stream's layout, and perhaps even that of
the other streams, will change if the value is something other than ``VC70``.
- **Signature** - A 32-bit time-stamp generated with a call to ``time()`` at
the time the PDB file is written. Note that due to the inherent uniqueness
problems of using a timestamp with 1-second granularity, this field does not
really serve its intended purpose, and as such is typically ignored in favor
of the ``Guid`` field, described below.
- **Age** - The number of times the PDB file has been written. This can be used
along with ``Guid`` to match the PDB to its corresponding executable.
- **Guid** - A 128-bit identifier guaranteed to be unique across space and time.
In general, this can be thought of as the result of calling the Win32 API
`UuidCreate <https://msdn.microsoft.com/en-us/library/windows/desktop/aa379205(v=vs.85).aspx>`__,
although LLVM cannot rely on that, as it must work on non-Windows platforms.
Matching a PDB to its executable
================================
The linker is responsible for writing both the PDB and the final executable, and
as a result is the only entity capable of writing the information necessary to
match the PDB to the executable.
In order to accomplish this, the linker generates a guid for the PDB (or
re-uses the existing guid if it is linking incrementally) and increments the Age
field.
The executable is a PE/COFF file, and part of a PE/COFF file is the presence of
number of "directories". For our purposes here, we are interested in the "debug
directory". The exact format of a debug directory is described by the
`IMAGE_DEBUG_DIRECTORY structure <https://msdn.microsoft.com/en-us/library/windows/desktop/ms680307(v=vs.85).aspx>`__.
For this particular case, the linker emits a debug directory of type
``IMAGE_DEBUG_TYPE_CODEVIEW``. The format of this record is defined in
``llvm/DebugInfo/CodeView/CVDebugRecord.h``, but it suffices to say here only
that it includes the same ``Guid`` and ``Age`` fields. At runtime, a
debugger or tool can scan the COFF executable image for the presence of
a debug directory of the correct type and verify that the Guid and Age match.