]>
Commit | Line | Data |
---|---|---|
b41a6533 MH |
1 | /* pdb.h - header file for generating PDB CodeView debugging files. |
2 | Copyright (C) 2022 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of the GNU Binutils. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 3 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
19 | MA 02110-1301, USA. */ | |
20 | ||
21 | /* Header files referred to below can be found in Microsoft's PDB | |
22 | repository: https://github.com/microsoft/microsoft-pdb. */ | |
23 | ||
24 | #ifndef PDB_H | |
25 | #define PDB_H | |
26 | ||
27 | #include "sysdep.h" | |
28 | #include "bfd.h" | |
29 | #include <stdbool.h> | |
30 | ||
08827105 MH |
31 | #define S_PUB32 0x110e |
32 | ||
b41a6533 MH |
33 | /* PDBStream70 in pdb1.h */ |
34 | struct pdb_stream_70 | |
35 | { | |
36 | uint32_t version; | |
37 | uint32_t signature; | |
38 | uint32_t age; | |
39 | uint8_t guid[16]; | |
40 | }; | |
41 | ||
42 | #define PDB_STREAM_VERSION_VC70 20000404 | |
43 | #define PDB_STREAM_VERSION_VC140 20140508 | |
44 | ||
45 | /* HDR in tpi.h */ | |
46 | struct pdb_tpi_stream_header | |
47 | { | |
48 | uint32_t version; | |
49 | uint32_t header_size; | |
50 | uint32_t type_index_begin; | |
51 | uint32_t type_index_end; | |
52 | uint32_t type_record_bytes; | |
53 | uint16_t hash_stream_index; | |
54 | uint16_t hash_aux_stream_index; | |
55 | uint32_t hash_key_size; | |
56 | uint32_t num_hash_buckets; | |
57 | uint32_t hash_value_buffer_offset; | |
58 | uint32_t hash_value_buffer_length; | |
59 | uint32_t index_offset_buffer_offset; | |
60 | uint32_t index_offset_buffer_length; | |
61 | uint32_t hash_adj_buffer_offset; | |
62 | uint32_t hash_adj_buffer_length; | |
63 | }; | |
64 | ||
65 | #define TPI_STREAM_VERSION_80 20040203 | |
66 | ||
67 | #define TPI_FIRST_INDEX 0x1000 | |
68 | ||
69 | /* NewDBIHdr in dbi.h */ | |
70 | struct pdb_dbi_stream_header | |
71 | { | |
72 | uint32_t version_signature; | |
73 | uint32_t version_header; | |
74 | uint32_t age; | |
75 | uint16_t global_stream_index; | |
76 | uint16_t build_number; | |
77 | uint16_t public_stream_index; | |
78 | uint16_t pdb_dll_version; | |
79 | uint16_t sym_record_stream; | |
80 | uint16_t pdb_dll_rbld; | |
81 | uint32_t mod_info_size; | |
82 | uint32_t section_contribution_size; | |
83 | uint32_t section_map_size; | |
84 | uint32_t source_info_size; | |
85 | uint32_t type_server_map_size; | |
86 | uint32_t mfc_type_server_index; | |
87 | uint32_t optional_dbg_header_size; | |
88 | uint32_t ec_substream_size; | |
89 | uint16_t flags; | |
90 | uint16_t machine; | |
91 | uint32_t padding; | |
92 | }; | |
93 | ||
94 | #define DBI_STREAM_VERSION_70 19990903 | |
95 | ||
08827105 MH |
96 | /* PSGSIHDR in gsi.h */ |
97 | struct publics_header | |
98 | { | |
99 | uint32_t sym_hash_size; | |
100 | uint32_t addr_map_size; | |
101 | uint32_t num_thunks; | |
102 | uint32_t thunks_size; | |
103 | uint32_t thunk_table; | |
104 | uint32_t thunk_table_offset; | |
105 | uint32_t num_sects; | |
106 | }; | |
107 | ||
108 | /* GSIHashHdr in gsi.h */ | |
109 | struct globals_hash_header | |
110 | { | |
111 | uint32_t signature; | |
112 | uint32_t version; | |
113 | uint32_t entries_size; | |
114 | uint32_t buckets_size; | |
115 | }; | |
116 | ||
117 | /* HRFile in gsi.h */ | |
118 | struct hash_record | |
119 | { | |
120 | uint32_t offset; | |
121 | uint32_t reference; | |
122 | }; | |
123 | ||
124 | #define GLOBALS_HASH_SIGNATURE 0xffffffff | |
125 | #define GLOBALS_HASH_VERSION_70 0xf12f091a | |
126 | ||
127 | /* PUBSYM32 in cvinfo.h */ | |
128 | struct pubsym | |
129 | { | |
130 | uint16_t record_length; | |
131 | uint16_t record_type; | |
132 | uint32_t flags; | |
133 | uint32_t offset; | |
134 | uint16_t section; | |
135 | /* followed by null-terminated string */ | |
136 | } ATTRIBUTE_PACKED; | |
137 | ||
138 | /* see bitset CV_PUBSYMFLAGS in cvinfo.h */ | |
139 | #define PUBSYM_FUNCTION 0x2 | |
140 | ||
b41a6533 MH |
141 | struct optional_dbg_header |
142 | { | |
143 | uint16_t fpo_stream; | |
144 | uint16_t exception_stream; | |
145 | uint16_t fixup_stream; | |
146 | uint16_t omap_to_src_stream; | |
147 | uint16_t omap_from_src_stream; | |
148 | uint16_t section_header_stream; | |
149 | uint16_t token_map_stream; | |
150 | uint16_t xdata_stream; | |
151 | uint16_t pdata_stream; | |
152 | uint16_t new_fpo_stream; | |
153 | uint16_t orig_section_header_stream; | |
154 | }; | |
155 | ||
5967ca92 MH |
156 | #define CV_SIGNATURE_C13 4 |
157 | ||
f559276d MH |
158 | #define DEBUG_S_STRINGTABLE 0xf3 |
159 | ||
160 | #define STRING_TABLE_SIGNATURE 0xeffeeffe | |
161 | #define STRING_TABLE_VERSION 1 | |
162 | ||
163 | /* VHdr in nmt.h */ | |
164 | struct string_table_header | |
165 | { | |
166 | uint32_t signature; | |
167 | uint32_t version; | |
168 | }; | |
169 | ||
e2a1b0a0 MH |
170 | #define SECTION_CONTRIB_VERSION_60 0xf12eba2d |
171 | ||
5967ca92 MH |
172 | /* SC in dbicommon.h */ |
173 | struct section_contribution | |
174 | { | |
175 | uint16_t section; | |
176 | uint16_t padding1; | |
177 | uint32_t offset; | |
178 | uint32_t size; | |
179 | uint32_t characteristics; | |
180 | uint16_t module_index; | |
181 | uint16_t padding2; | |
182 | uint32_t data_crc; | |
183 | uint32_t reloc_crc; | |
184 | }; | |
185 | ||
186 | /* MODI_60_Persist in dbi.h */ | |
187 | struct module_info | |
188 | { | |
189 | uint32_t unused1; | |
190 | struct section_contribution sc; | |
191 | uint16_t flags; | |
192 | uint16_t module_sym_stream; | |
193 | uint32_t sym_byte_size; | |
194 | uint32_t c11_byte_size; | |
195 | uint32_t c13_byte_size; | |
196 | uint16_t source_file_count; | |
197 | uint16_t padding; | |
198 | uint32_t unused2; | |
199 | uint32_t source_file_name_index; | |
200 | uint32_t pdb_file_path_name_index; | |
201 | }; | |
202 | ||
b41a6533 MH |
203 | extern bool create_pdb_file (bfd *, const char *, const unsigned char *); |
204 | ||
205 | #endif |