xref: /netbsd-src/external/gpl3/binutils/dist/gas/codeview.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1 /* codeview.h - CodeView debug support
2    Copyright (C) 2022-2024 Free Software Foundation, Inc.
3 
4    This file is part of GAS, the GNU Assembler.
5 
6    GAS 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, or (at your option)
9    any later version.
10 
11    GAS 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 GAS; see the file COPYING.  If not, write to the Free
18    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19    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 GAS_CODEVIEW_H
25 #define GAS_CODEVIEW_H
26 
27 #define CV_SIGNATURE_C13	4
28 
29 #define DEBUG_S_SYMBOLS		0xf1
30 #define DEBUG_S_LINES		0xf2
31 #define DEBUG_S_STRINGTABLE	0xf3
32 #define DEBUG_S_FILECHKSMS	0xf4
33 
34 #define S_OBJNAME		0x1101
35 #define S_COMPILE3		0x113c
36 
37 #define CV_CFL_MASM		0x03
38 
39 #define CV_CFL_80386		0x03
40 #define CV_CFL_X64		0xD0
41 #define CV_CFL_ARM64		0xF6
42 
43 #define CHKSUM_TYPE_MD5		1
44 
45 /* OBJNAMESYM in cvinfo.h */
46 struct OBJNAMESYM
47 {
48   uint16_t length;
49   uint16_t type;
50   uint32_t signature;
51 };
52 
53 /* COMPILESYM3 in cvinfo.h */
54 struct COMPILESYM3
55 {
56   uint16_t length;
57   uint16_t type;
58   uint32_t flags;
59   uint16_t machine;
60   uint16_t frontend_major;
61   uint16_t frontend_minor;
62   uint16_t frontend_build;
63   uint16_t frontend_qfe;
64   uint16_t backend_major;
65   uint16_t backend_minor;
66   uint16_t backend_build;
67   uint16_t backend_qfe;
68 } ATTRIBUTE_PACKED;
69 
70 /* filedata in dumpsym7.cpp */
71 struct file_checksum
72 {
73   uint32_t file_id;
74   uint8_t checksum_length;
75   uint8_t checksum_type;
76 } ATTRIBUTE_PACKED;
77 
78 /* CV_DebugSLinesHeader_t in cvinfo.h */
79 struct cv_lines_header
80 {
81   uint32_t offset;
82   uint16_t section;
83   uint16_t flags;
84   uint32_t length;
85 };
86 
87 /* CV_DebugSLinesFileBlockHeader_t in cvinfo.h */
88 struct cv_lines_block
89 {
90   uint32_t file_id;
91   uint32_t num_lines;
92   uint32_t length;
93 };
94 
95 /* CV_Line_t in cvinfo.h */
96 struct cv_line
97 {
98   uint32_t offset;
99   uint32_t line_no;
100 };
101 
102 extern void codeview_finish (void);
103 extern void codeview_generate_asm_lineno (void);
104 
105 #endif
106