llvm.org GIT mirror llvm / c4ffb07
[PDB Docs] Add skeleton of documentation for CodeView symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358197 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 1 year, 6 months ago
2 changed file(s) with 259 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
None =====================================
1 CodeView Symbol Records
2 =====================================
3
0 =====================================
1 CodeView Symbol Records
2 =====================================
3
4
5 .. contents::
6 :local:
7
8 .. _symbols_intro:
9
10 Introduction
11 ============
12
13 This document describes the usage and serialization format of the various
14 CodeView symbol records that LLVM understands. Like
15 :doc:`CodeView Type Records `, we describe only the important
16 types which are generated by modern C++ toolchains.
17
18 Record Categories
19 =================
20
21 Symbol records share one major similarity with :doc:`type records `:
22 They start with the same :ref:`record prefix `, which we will not describe
23 again (refer to the previous link for a description). As a result of this, a sequence
24 of symbol records can be processed with largely the same code as that which processes
25 type records. There are several important differences between symbol and type records:
26
27 * Symbol records only appear in the :doc:`PublicStream`, :doc:`GlobalStream`, and
28 :doc:`Module Info Streams `.
29 * Type records only appear in the :doc:`TPI & IPI streams `.
30 * While types are referenced from other CodeView records via :ref:`type indices `,
31 symbol records are referenced by the byte offset of the record in the stream that it appears
32 in.
33 * Types can reference types (via type indices), and symbols can reference both types (via type
34 indices) and symbols (via offsets), but types can never reference symbols.
35 * There is no notion of :ref:`Leaf Records ` and :ref:`Member Records `
36 as there are with types. Every symbol record describes is own length.
37 * Certain special symbol records begin a "scope". For these records, all following records
38 up until the next ``S_END`` record are "children" of this symbol record. For example,
39 given a symbol record which describes a certain function, all local variables of this
40 function would appear following the function up until the corresponding ``S_END`` record.
41
42 Finally, there are three general categories of symbol record, grouped by where they are legal
43 to appear in a PDB file. Public Symbols (which appear only in the
44 :doc:`publics stream `), Global Symbols (which appear only in the
45 :doc:`globals stream `) and module symbols (which appear in the
46 :doc:`module info stream `).
47
48
49 .. _public_symbols:
50
51 Public Symbols
52 --------------
53
54 S_PUB32 (0x110e)
55 ^^^^^^^^^^^^^^^^
56
57 .. _global_symbols:
58
59 Global Symbols
60 --------------
61
62 S_GDATA32
63 ^^^^^^^^^^
64
65 S_GTHREAD32 (0x1113)
66 ^^^^^^^^^^^^^^^^^^^^
67
68 S_PROCREF (0x1125)
69 ^^^^^^^^^^^^^^^^^^
70
71 S_LPROCREF (0x1127)
72 ^^^^^^^^^^^^^^^^^^^
73
74
75 S_GMANDATA (0x111d)
76 ^^^^^^^^^^^^^^^^^^^
77
78 .. _module_symbols:
79
80 Module Symbols
81 --------------
82
83 S_END (0x0006)
84 ^^^^^^^^^^^^^^
85
86 S_FRAMEPROC (0x1012)
87 ^^^^^^^^^^^^^^^^^^^^
88
89 S_OBJNAME (0x1101)
90 ^^^^^^^^^^^^^^^^^^
91
92 S_THUNK32 (0x1102)
93 ^^^^^^^^^^^^^^^^^^
94
95 S_BLOCK32 (0x1103)
96 ^^^^^^^^^^^^^^^^^^
97
98 S_LABEL32 (0x1105)
99 ^^^^^^^^^^^^^^^^^^
100
101 S_REGISTER (0x1106)
102 ^^^^^^^^^^^^^^^^^^^
103
104 S_BPREL32 (0x110b)
105 ^^^^^^^^^^^^^^^^^^
106
107 S_LPROC32 (0x110f)
108 ^^^^^^^^^^^^^^^^^^
109
110 S_GPROC32 (0x1110)
111 ^^^^^^^^^^^^^^^^^^
112
113 S_REGREL32 (0x1111)
114 ^^^^^^^^^^^^^^^^^^^
115
116 S_COMPILE2 (0x1116)
117 ^^^^^^^^^^^^^^^^^^^
118
119 S_UNAMESPACE (0x1124)
120 ^^^^^^^^^^^^^^^^^^^^^
121
122 S_TRAMPOLINE (0x112c)
123 ^^^^^^^^^^^^^^^^^^^^^
124
125 S_SECTION (0x1136)
126 ^^^^^^^^^^^^^^^^^^
127
128 S_COFFGROUP (0x1137)
129 ^^^^^^^^^^^^^^^^^^^^
130
131 S_EXPORT (0x1138)
132 ^^^^^^^^^^^^^^^^^
133
134 S_CALLSITEINFO (0x1139)
135 ^^^^^^^^^^^^^^^^^^^^^^^
136
137 S_FRAMECOOKIE (0x113a)
138 ^^^^^^^^^^^^^^^^^^^^^^
139
140 S_COMPILE3 (0x113c)
141 ^^^^^^^^^^^^^^^^^^^
142
143 S_ENVBLOCK (0x113d)
144 ^^^^^^^^^^^^^^^^^^^
145
146 S_LOCAL (0x113e)
147 ^^^^^^^^^^^^^^^^
148
149 S_DEFRANGE (0x113f)
150 ^^^^^^^^^^^^^^^^^^^
151
152 S_DEFRANGE_SUBFIELD (0x1140)
153 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154
155 S_DEFRANGE_REGISTER (0x1141)
156 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
157
158 S_DEFRANGE_FRAMEPOINTER_REL (0x1142)
159 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
160
161 S_DEFRANGE_SUBFIELD_REGISTER (0x1143)
162 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163
164 S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE (0x1144)
165 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
166
167 S_DEFRANGE_REGISTER_REL (0x1145)
168 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
169
170 S_LPROC32_ID (0x1146)
171 ^^^^^^^^^^^^^^^^^^^^^
172
173 S_GPROC32_ID (0x1147)
174 ^^^^^^^^^^^^^^^^^^^^^
175
176 S_BUILDINFO (0x114c)
177 ^^^^^^^^^^^^^^^^^^^^
178
179 S_INLINESITE (0x114d)
180 ^^^^^^^^^^^^^^^^^^^^^
181
182 S_INLINESITE_END (0x114e)
183 ^^^^^^^^^^^^^^^^^^^^^^^^^
184
185 S_PROC_ID_END (0x114f)
186 ^^^^^^^^^^^^^^^^^^^^^^
187
188 S_FILESTATIC (0x1153)
189 ^^^^^^^^^^^^^^^^^^^^^
190
191 S_LPROC32_DPC (0x1155)
192 ^^^^^^^^^^^^^^^^^^^^^^
193
194 S_LPROC32_DPC_ID (0x1156)
195 ^^^^^^^^^^^^^^^^^^^^^^^^^
196
197 S_CALLEES (0x115a)
198 ^^^^^^^^^^^^^^^^^^
199
200 S_CALLERS (0x115b)
201 ^^^^^^^^^^^^^^^^^^
202
203 S_HEAPALLOCSITE (0x115e)
204 ^^^^^^^^^^^^^^^^^^^^^^^^
205
206 S_FASTLINK (0x1167)
207 ^^^^^^^^^^^^^^^^^^^
208
209 S_INLINEES (0x1168)
210 ^^^^^^^^^^^^^^^^^^^
211
212 .. _module_and_global_symbols:
213
214 Symbols which can go in either/both of the module info stream & global stream
215 -----------------------------------------------------------------------------
216
217 S_CONSTANT (0x1107)
218 ^^^^^^^^^^^^^^^^^^^
219
220 S_UDT (0x1108)
221 ^^^^^^^^^^^^^^
222
223 S_LDATA32 (0x110c)
224 ^^^^^^^^^^^^^^^^^^
225
226 S_LTHREAD32 (0x1112)
227 ^^^^^^^^^^^^^^^^^^^^
228
229 S_LMANDATA (0x111c)
230 ^^^^^^^^^^^^^^^^^^^
231
232 S_MANCONSTANT (0x112d)
233 ^^^^^^^^^^^^^^^^^^^^^^
234
5858
5959 **Layout:**
6060
61 .. code-block:: none
62
63 .--------------------.-- +0
64 | Referent Type |
65 .--------------------.-- +4
66 | Attributes |
67 .--------------------.-- +8
68 | Member Ptr Info | Only present if |Attributes| indicates this is a member pointer.
69 .--------------------.-- +E
70
71 Attributes is a bitfield with the following layout:
72
73 .. code-block:: none
74
75 .-----------------------------------------------------------------------------------------------------.
76 | Unused | Flags | Size | Modifiers | Mode | Kind |
77 .-----------------------------------------------------------------------------------------------------.
78 | | | | | | |
79 0x100 +0x16 +0x13 +0xD +0x8 +0x5 +0x0
80
81 where the various fields are defined by the following enums:
82
83 .. code-block:: c++
84
61 .. code-block:: none
62
63 .--------------------.-- +0
64 | Referent Type |
65 .--------------------.-- +4
66 | Attributes |
67 .--------------------.-- +8
68 | Member Ptr Info | Only present if |Attributes| indicates this is a member pointer.
69 .--------------------.-- +E
70
71 Attributes is a bitfield with the following layout:
72
73 .. code-block:: none
74
75 .-----------------------------------------------------------------------------------------------------.
76 | Unused | Flags | Size | Modifiers | Mode | Kind |
77 .-----------------------------------------------------------------------------------------------------.
78 | | | | | | |
79 0x100 +0x16 +0x13 +0xD +0x8 +0x5 +0x0
80
81 where the various fields are defined by the following enums:
82
83 .. code-block:: c++
84
8585 enum class PointerKind : uint8_t {
8686 Near16 = 0x00, // 16 bit pointer
8787 Far16 = 0x01, // 16:16 far pointer