1 /* pdb.h - header file for generating PDB CodeView debugging files.
2 Copyright (C) 2022 Free Software Foundation, Inc.
4 This file is part of the GNU Binutils.
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.
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.
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. */
21 /* Header files referred to below can be found in Microsoft's PDB
22 repository: https://github.com/microsoft/microsoft-pdb. */
31 #define S_PUB32 0x110e
33 /* PDBStream70 in pdb1.h */
42 #define PDB_STREAM_VERSION_VC70 20000404
43 #define PDB_STREAM_VERSION_VC140 20140508
46 struct pdb_tpi_stream_header
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
;
65 #define TPI_STREAM_VERSION_80 20040203
67 #define TPI_FIRST_INDEX 0x1000
69 /* NewDBIHdr in dbi.h */
70 struct pdb_dbi_stream_header
72 uint32_t version_signature
;
73 uint32_t version_header
;
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
;
94 #define DBI_STREAM_VERSION_70 19990903
96 /* PSGSIHDR in gsi.h */
99 uint32_t sym_hash_size
;
100 uint32_t addr_map_size
;
102 uint32_t thunks_size
;
103 uint32_t thunk_table
;
104 uint32_t thunk_table_offset
;
108 /* GSIHashHdr in gsi.h */
109 struct globals_hash_header
113 uint32_t entries_size
;
114 uint32_t buckets_size
;
117 /* HRFile in gsi.h */
124 #define GLOBALS_HASH_SIGNATURE 0xffffffff
125 #define GLOBALS_HASH_VERSION_70 0xf12f091a
127 /* PUBSYM32 in cvinfo.h */
130 uint16_t record_length
;
131 uint16_t record_type
;
135 /* followed by null-terminated string */
138 /* see bitset CV_PUBSYMFLAGS in cvinfo.h */
139 #define PUBSYM_FUNCTION 0x2
141 struct optional_dbg_header
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
;
156 #define CV_SIGNATURE_C13 4
158 #define SECTION_CONTRIB_VERSION_60 0xf12eba2d
160 /* SC in dbicommon.h */
161 struct section_contribution
167 uint32_t characteristics
;
168 uint16_t module_index
;
174 /* MODI_60_Persist in dbi.h */
178 struct section_contribution sc
;
180 uint16_t module_sym_stream
;
181 uint32_t sym_byte_size
;
182 uint32_t c11_byte_size
;
183 uint32_t c13_byte_size
;
184 uint16_t source_file_count
;
187 uint32_t source_file_name_index
;
188 uint32_t pdb_file_path_name_index
;
191 extern bool create_pdb_file (bfd
*, const char *, const unsigned char *);