Skip to content

Commit 3f0627c

Browse files
author
Zachary Turner
committed
Add documentation for the PDB Module Info stream.
llvm-svn: 288205
1 parent 8b19a0a commit 3f0627c

File tree

4 files changed

+88
-1
lines changed

4 files changed

+88
-1
lines changed

llvm/docs/PDB/CodeViewSymbols.rst

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
=====================================
2+
CodeView Symbol Records
3+
=====================================
4+

llvm/docs/PDB/CodeViewTypes.rst

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
=====================================
2+
CodeView Type Records
3+
=====================================
4+

llvm/docs/PDB/ModiStream.rst

+77
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,80 @@
11
=====================================
22
The Module Information Stream
33
=====================================
4+
5+
.. contents::
6+
:local:
7+
8+
.. _modi_stream_intro:
9+
10+
Introduction
11+
============
12+
13+
The Module Info Stream (henceforth referred to as the Modi stream) contains
14+
information about a single module (object file, import library, etc that
15+
contributes to the binary this PDB contains debug information about. There
16+
is one modi stream for each module, and the mapping between modi stream index
17+
and module is contained in the :doc:`DBI Stream <DbiStream>`. The modi stream
18+
for a single module contains line information for the compiland, as well as
19+
all CodeView information for the symbols defined in the compiland. Finally,
20+
there is a "global refs" substream which is not well understood.
21+
22+
.. _modi_stream_layout:
23+
24+
Stream Layout
25+
=============
26+
27+
A modi stream is laid out as follows:
28+
29+
30+
.. code-block:: c++
31+
32+
struct ModiStream {
33+
uint32_t Signature;
34+
uint8_t Symbols[SymbolSize-4];
35+
uint8_t C11LineInfo[C11Size];
36+
uint8_t C13LineInfo[C13Size];
37+
38+
uint32_t GlobalRefsSize;
39+
uint8_t GlobalRefs[GlobalRefsSize];
40+
};
41+
42+
- **Signature** - Unknown. In practice only the value of ``4`` has been
43+
observed. It is hypothesized that this value corresponds to the set of
44+
``CV_SIGNATURE_xx`` defines in ``cvinfo.h``, with the value of ``4``
45+
meaning that this module has C13 line information (as opposed to C11 line
46+
information). A corollary of this is that we expect to only ever see
47+
C13 line info, and that we do not understand the format of C11 line info.
48+
49+
- **Symbols** - The :ref:`CodeView Symbol Substream <modi_symbol_substream>`.
50+
``SymbolSize`` is equal to the value of ``SymByteSize`` for the
51+
corresponding module's entry in the :ref:`Module Info Substream <dbi_mod_info_substream>`
52+
of the :doc:`DBI Stream <DbiStream>`.
53+
54+
- **C11LineInfo** - A block containing CodeView line information in C11
55+
format. ``C11Size`` is equal to the value of ``C11ByteSize`` from the
56+
:ref:`Module Info Substream <dbi_mod_info_substream>` of the
57+
:doc:`DBI Stream <DbiStream>`. If this value is ``0``, then C11 line
58+
information is not present. As mentioned previously, the format of
59+
C11 line info is not understood and we assume all line in modern PDBs
60+
to be in C13 format.
61+
62+
- **C13LineInfo** - A block containing CodeView line information in C13
63+
format. ``C13Size`` is equal to the value of ``C13ByteSize`` from the
64+
:ref:`Module Info Substream <dbi_mod_info_substream>` of the
65+
:doc:`DBI Stream <DbiStream>`. If this value is ``0``, then C13 line
66+
information is not present.
67+
68+
- **GlobalRefs** - The meaning of this substream is not understood.
69+
70+
.. _modi_symbol_substream:
71+
72+
The CodeView Symbol Substream
73+
=============================
74+
75+
The CodeView Symbol Substream. This is an array of variable length
76+
records describing the functions, variables, inlining information,
77+
and other symbols defined in the compiland. The entire array consumes
78+
``SymbolSize-4`` bytes. The format of a CodeView Symbol Record (and
79+
thusly, an array of CodeView Symbol Records) is described in
80+
:doc:`CodeViewSymbols`.

llvm/docs/PDB/index.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ File Layout
5353
PublicStream
5454
GlobalStream
5555
HashStream
56+
CodeViewSymbols
57+
CodeViewTypes
5658

5759
.. _msf:
5860

@@ -161,5 +163,5 @@ CodeView is another format which comes into the picture. While MSF defines
161163
the structure of the overall file, and PDB defines the set of streams that
162164
appear within the MSF file and the format of those streams, CodeView defines
163165
the format of **symbol and type records** that appear within specific streams.
164-
Refer to the pages on `CodeView Symbol Records` and `CodeView Type Records` for
166+
Refer to the pages on :doc:`CodeViewSymbols` and :doc:`CodeViewTypes` for
165167
more information about the CodeView format.

0 commit comments

Comments
 (0)