xref: /netbsd-src/external/gpl3/binutils/dist/gas/codeview.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1*cb63e24eSchristos /* codeview.h - CodeView debug support
2*cb63e24eSchristos    Copyright (C) 2022-2024 Free Software Foundation, Inc.
3*cb63e24eSchristos 
4*cb63e24eSchristos    This file is part of GAS, the GNU Assembler.
5*cb63e24eSchristos 
6*cb63e24eSchristos    GAS is free software; you can redistribute it and/or modify
7*cb63e24eSchristos    it under the terms of the GNU General Public License as published by
8*cb63e24eSchristos    the Free Software Foundation; either version 3, or (at your option)
9*cb63e24eSchristos    any later version.
10*cb63e24eSchristos 
11*cb63e24eSchristos    GAS is distributed in the hope that it will be useful,
12*cb63e24eSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*cb63e24eSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*cb63e24eSchristos    GNU General Public License for more details.
15*cb63e24eSchristos 
16*cb63e24eSchristos    You should have received a copy of the GNU General Public License
17*cb63e24eSchristos    along with GAS; see the file COPYING.  If not, write to the Free
18*cb63e24eSchristos    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19*cb63e24eSchristos    02110-1301, USA.  */
20*cb63e24eSchristos 
21*cb63e24eSchristos /* Header files referred to below can be found in Microsoft's PDB
22*cb63e24eSchristos    repository: https://github.com/microsoft/microsoft-pdb.  */
23*cb63e24eSchristos 
24*cb63e24eSchristos #ifndef GAS_CODEVIEW_H
25*cb63e24eSchristos #define GAS_CODEVIEW_H
26*cb63e24eSchristos 
27*cb63e24eSchristos #define CV_SIGNATURE_C13	4
28*cb63e24eSchristos 
29*cb63e24eSchristos #define DEBUG_S_SYMBOLS		0xf1
30*cb63e24eSchristos #define DEBUG_S_LINES		0xf2
31*cb63e24eSchristos #define DEBUG_S_STRINGTABLE	0xf3
32*cb63e24eSchristos #define DEBUG_S_FILECHKSMS	0xf4
33*cb63e24eSchristos 
34*cb63e24eSchristos #define S_OBJNAME		0x1101
35*cb63e24eSchristos #define S_COMPILE3		0x113c
36*cb63e24eSchristos 
37*cb63e24eSchristos #define CV_CFL_MASM		0x03
38*cb63e24eSchristos 
39*cb63e24eSchristos #define CV_CFL_80386		0x03
40*cb63e24eSchristos #define CV_CFL_X64		0xD0
41*cb63e24eSchristos #define CV_CFL_ARM64		0xF6
42*cb63e24eSchristos 
43*cb63e24eSchristos #define CHKSUM_TYPE_MD5		1
44*cb63e24eSchristos 
45*cb63e24eSchristos /* OBJNAMESYM in cvinfo.h */
46*cb63e24eSchristos struct OBJNAMESYM
47*cb63e24eSchristos {
48*cb63e24eSchristos   uint16_t length;
49*cb63e24eSchristos   uint16_t type;
50*cb63e24eSchristos   uint32_t signature;
51*cb63e24eSchristos };
52*cb63e24eSchristos 
53*cb63e24eSchristos /* COMPILESYM3 in cvinfo.h */
54*cb63e24eSchristos struct COMPILESYM3
55*cb63e24eSchristos {
56*cb63e24eSchristos   uint16_t length;
57*cb63e24eSchristos   uint16_t type;
58*cb63e24eSchristos   uint32_t flags;
59*cb63e24eSchristos   uint16_t machine;
60*cb63e24eSchristos   uint16_t frontend_major;
61*cb63e24eSchristos   uint16_t frontend_minor;
62*cb63e24eSchristos   uint16_t frontend_build;
63*cb63e24eSchristos   uint16_t frontend_qfe;
64*cb63e24eSchristos   uint16_t backend_major;
65*cb63e24eSchristos   uint16_t backend_minor;
66*cb63e24eSchristos   uint16_t backend_build;
67*cb63e24eSchristos   uint16_t backend_qfe;
68*cb63e24eSchristos } ATTRIBUTE_PACKED;
69*cb63e24eSchristos 
70*cb63e24eSchristos /* filedata in dumpsym7.cpp */
71*cb63e24eSchristos struct file_checksum
72*cb63e24eSchristos {
73*cb63e24eSchristos   uint32_t file_id;
74*cb63e24eSchristos   uint8_t checksum_length;
75*cb63e24eSchristos   uint8_t checksum_type;
76*cb63e24eSchristos } ATTRIBUTE_PACKED;
77*cb63e24eSchristos 
78*cb63e24eSchristos /* CV_DebugSLinesHeader_t in cvinfo.h */
79*cb63e24eSchristos struct cv_lines_header
80*cb63e24eSchristos {
81*cb63e24eSchristos   uint32_t offset;
82*cb63e24eSchristos   uint16_t section;
83*cb63e24eSchristos   uint16_t flags;
84*cb63e24eSchristos   uint32_t length;
85*cb63e24eSchristos };
86*cb63e24eSchristos 
87*cb63e24eSchristos /* CV_DebugSLinesFileBlockHeader_t in cvinfo.h */
88*cb63e24eSchristos struct cv_lines_block
89*cb63e24eSchristos {
90*cb63e24eSchristos   uint32_t file_id;
91*cb63e24eSchristos   uint32_t num_lines;
92*cb63e24eSchristos   uint32_t length;
93*cb63e24eSchristos };
94*cb63e24eSchristos 
95*cb63e24eSchristos /* CV_Line_t in cvinfo.h */
96*cb63e24eSchristos struct cv_line
97*cb63e24eSchristos {
98*cb63e24eSchristos   uint32_t offset;
99*cb63e24eSchristos   uint32_t line_no;
100*cb63e24eSchristos };
101*cb63e24eSchristos 
102*cb63e24eSchristos extern void codeview_finish (void);
103*cb63e24eSchristos extern void codeview_generate_asm_lineno (void);
104*cb63e24eSchristos 
105*cb63e24eSchristos #endif
106