xref: /netbsd/external/gpl3/gdb.old/dist/elfcpp/dwarf.h (revision 56bb7041)
1*56bb7041Schristos // dwarf.h -- DWARF2 constants  -*- C++ -*-
2*56bb7041Schristos 
3*56bb7041Schristos // Copyright (C) 2006-2020 Free Software Foundation, Inc.
4*56bb7041Schristos // Written by Ian Lance Taylor <iant@google.com>.
5*56bb7041Schristos 
6*56bb7041Schristos // This file is part of elfcpp.
7*56bb7041Schristos 
8*56bb7041Schristos // This program is free software; you can redistribute it and/or
9*56bb7041Schristos // modify it under the terms of the GNU Library General Public License
10*56bb7041Schristos // as published by the Free Software Foundation; either version 2, or
11*56bb7041Schristos // (at your option) any later version.
12*56bb7041Schristos 
13*56bb7041Schristos // In addition to the permissions in the GNU Library General Public
14*56bb7041Schristos // License, the Free Software Foundation gives you unlimited
15*56bb7041Schristos // permission to link the compiled version of this file into
16*56bb7041Schristos // combinations with other programs, and to distribute those
17*56bb7041Schristos // combinations without any restriction coming from the use of this
18*56bb7041Schristos // file.  (The Library Public License restrictions do apply in other
19*56bb7041Schristos // respects; for example, they cover modification of the file, and
20*56bb7041Schristos /// distribution when not linked into a combined executable.)
21*56bb7041Schristos 
22*56bb7041Schristos // This program is distributed in the hope that it will be useful, but
23*56bb7041Schristos // WITHOUT ANY WARRANTY; without even the implied warranty of
24*56bb7041Schristos // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25*56bb7041Schristos // Library General Public License for more details.
26*56bb7041Schristos 
27*56bb7041Schristos // You should have received a copy of the GNU Library General Public
28*56bb7041Schristos // License along with this program; if not, write to the Free Software
29*56bb7041Schristos // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
30*56bb7041Schristos // 02110-1301, USA.
31*56bb7041Schristos 
32*56bb7041Schristos #ifndef ELFCPP_DWARF_H
33*56bb7041Schristos #define ELFCPP_DWARF_H
34*56bb7041Schristos 
35*56bb7041Schristos namespace elfcpp
36*56bb7041Schristos {
37*56bb7041Schristos 
38*56bb7041Schristos // DWARF2 codes.
39*56bb7041Schristos 
40*56bb7041Schristos // Include DW_TAG, DW_FORM, DW_AT, DW_OP, DW_ATE, and DW_CFA
41*56bb7041Schristos // codes from dwarf2.def.
42*56bb7041Schristos 
43*56bb7041Schristos #define DW_FIRST_TAG(name, value) enum DW_TAG { \
44*56bb7041Schristos   name = value
45*56bb7041Schristos #define DW_TAG(name, value) , name = value
46*56bb7041Schristos #define DW_TAG_DUP(name, value) , name = value
47*56bb7041Schristos #define DW_END_TAG };
48*56bb7041Schristos 
49*56bb7041Schristos #define DW_FIRST_FORM(name, value) enum DW_FORM { \
50*56bb7041Schristos   name = value
51*56bb7041Schristos #define DW_FORM(name, value) , name = value
52*56bb7041Schristos #define DW_END_FORM };
53*56bb7041Schristos 
54*56bb7041Schristos #define DW_FIRST_AT(name, value) enum DW_AT { \
55*56bb7041Schristos   name = value
56*56bb7041Schristos #define DW_AT(name, value) , name = value
57*56bb7041Schristos #define DW_AT_DUP(name, value) , name = value
58*56bb7041Schristos #define DW_END_AT };
59*56bb7041Schristos 
60*56bb7041Schristos #define DW_FIRST_OP(name, value) enum DW_OP { \
61*56bb7041Schristos   name = value
62*56bb7041Schristos #define DW_OP(name, value) , name = value
63*56bb7041Schristos #define DW_OP_DUP(name, value) , name = value
64*56bb7041Schristos #define DW_END_OP };
65*56bb7041Schristos 
66*56bb7041Schristos #define DW_FIRST_ATE(name, value) enum DW_ENCODING { \
67*56bb7041Schristos   name = value
68*56bb7041Schristos #define DW_ATE(name, value) , name = value
69*56bb7041Schristos #define DW_ATE_DUP(name, value) , name = value
70*56bb7041Schristos #define DW_END_ATE };
71*56bb7041Schristos 
72*56bb7041Schristos #define DW_FIRST_CFA(name, value) enum DW_CFA { \
73*56bb7041Schristos   name = value
74*56bb7041Schristos #define DW_CFA(name, value) , name = value
75*56bb7041Schristos #define DW_CFA_DUP(name, value) , name = value
76*56bb7041Schristos #define DW_END_CFA };
77*56bb7041Schristos 
78*56bb7041Schristos #define DW_FIRST_IDX(name, value) enum dwarf_name_index_attribute { \
79*56bb7041Schristos   name = value
80*56bb7041Schristos #define DW_IDX(name, value) , name = value
81*56bb7041Schristos #define DW_IDX_DUP(name, value) , name = value
82*56bb7041Schristos #define DW_END_IDX };
83*56bb7041Schristos 
84*56bb7041Schristos #include "dwarf2.def"
85*56bb7041Schristos 
86*56bb7041Schristos #undef DW_FIRST_TAG
87*56bb7041Schristos #undef DW_TAG
88*56bb7041Schristos #undef DW_TAG_DUP
89*56bb7041Schristos #undef DW_END_TAG
90*56bb7041Schristos 
91*56bb7041Schristos #undef DW_FIRST_FORM
92*56bb7041Schristos #undef DW_FORM
93*56bb7041Schristos #undef DW_END_FORM
94*56bb7041Schristos 
95*56bb7041Schristos #undef DW_FIRST_AT
96*56bb7041Schristos #undef DW_AT
97*56bb7041Schristos #undef DW_AT_DUP
98*56bb7041Schristos #undef DW_END_AT
99*56bb7041Schristos 
100*56bb7041Schristos #undef DW_FIRST_OP
101*56bb7041Schristos #undef DW_OP
102*56bb7041Schristos #undef DW_OP_DUP
103*56bb7041Schristos #undef DW_END_OP
104*56bb7041Schristos 
105*56bb7041Schristos #undef DW_FIRST_ATE
106*56bb7041Schristos #undef DW_ATE
107*56bb7041Schristos #undef DW_ATE_DUP
108*56bb7041Schristos #undef DW_END_ATE
109*56bb7041Schristos 
110*56bb7041Schristos #undef DW_FIRST_CFA
111*56bb7041Schristos #undef DW_CFA_DUP
112*56bb7041Schristos #undef DW_CFA
113*56bb7041Schristos #undef DW_END_CFA
114*56bb7041Schristos 
115*56bb7041Schristos #undef DW_FIRST_IDX
116*56bb7041Schristos #undef DW_IDX
117*56bb7041Schristos #undef DW_IDX_DUP
118*56bb7041Schristos #undef DW_END_IDX
119*56bb7041Schristos 
120*56bb7041Schristos // Frame unwind information.
121*56bb7041Schristos 
122*56bb7041Schristos enum DW_EH_PE
123*56bb7041Schristos {
124*56bb7041Schristos   DW_EH_PE_absptr = 0x00,
125*56bb7041Schristos   DW_EH_PE_omit = 0xff,
126*56bb7041Schristos 
127*56bb7041Schristos   DW_EH_PE_uleb128 = 0x01,
128*56bb7041Schristos   DW_EH_PE_udata2 = 0x02,
129*56bb7041Schristos   DW_EH_PE_udata4 = 0x03,
130*56bb7041Schristos   DW_EH_PE_udata8 = 0x04,
131*56bb7041Schristos   DW_EH_PE_signed = 0x08,
132*56bb7041Schristos   DW_EH_PE_sleb128 = 0x09,
133*56bb7041Schristos   DW_EH_PE_sdata2 = 0x0a,
134*56bb7041Schristos   DW_EH_PE_sdata4 = 0x0b,
135*56bb7041Schristos   DW_EH_PE_sdata8 = 0x0c,
136*56bb7041Schristos 
137*56bb7041Schristos   DW_EH_PE_pcrel = 0x10,
138*56bb7041Schristos   DW_EH_PE_textrel = 0x20,
139*56bb7041Schristos   DW_EH_PE_datarel = 0x30,
140*56bb7041Schristos   DW_EH_PE_funcrel = 0x40,
141*56bb7041Schristos   DW_EH_PE_aligned = 0x50,
142*56bb7041Schristos 
143*56bb7041Schristos   DW_EH_PE_indirect = 0x80
144*56bb7041Schristos };
145*56bb7041Schristos 
146*56bb7041Schristos // Line number opcodes.
147*56bb7041Schristos 
148*56bb7041Schristos enum DW_LINE_OPS
149*56bb7041Schristos {
150*56bb7041Schristos   DW_LNS_extended_op = 0,
151*56bb7041Schristos   DW_LNS_copy = 1,
152*56bb7041Schristos   DW_LNS_advance_pc = 2,
153*56bb7041Schristos   DW_LNS_advance_line = 3,
154*56bb7041Schristos   DW_LNS_set_file = 4,
155*56bb7041Schristos   DW_LNS_set_column = 5,
156*56bb7041Schristos   DW_LNS_negate_stmt = 6,
157*56bb7041Schristos   DW_LNS_set_basic_block = 7,
158*56bb7041Schristos   DW_LNS_const_add_pc = 8,
159*56bb7041Schristos   DW_LNS_fixed_advance_pc = 9,
160*56bb7041Schristos   // DWARF 3.
161*56bb7041Schristos   DW_LNS_set_prologue_end = 10,
162*56bb7041Schristos   DW_LNS_set_epilogue_begin = 11,
163*56bb7041Schristos   DW_LNS_set_isa = 12
164*56bb7041Schristos };
165*56bb7041Schristos 
166*56bb7041Schristos // Line number extended opcodes.
167*56bb7041Schristos 
168*56bb7041Schristos enum DW_LINE_EXTENDED_OPS
169*56bb7041Schristos {
170*56bb7041Schristos   DW_LNE_end_sequence = 1,
171*56bb7041Schristos   DW_LNE_set_address = 2,
172*56bb7041Schristos   DW_LNE_define_file = 3,
173*56bb7041Schristos   // DWARF4.
174*56bb7041Schristos   DW_LNE_set_discriminator = 4,
175*56bb7041Schristos   // HP extensions.
176*56bb7041Schristos   DW_LNE_HP_negate_is_UV_update      = 0x11,
177*56bb7041Schristos   DW_LNE_HP_push_context             = 0x12,
178*56bb7041Schristos   DW_LNE_HP_pop_context              = 0x13,
179*56bb7041Schristos   DW_LNE_HP_set_file_line_column     = 0x14,
180*56bb7041Schristos   DW_LNE_HP_set_routine_name         = 0x15,
181*56bb7041Schristos   DW_LNE_HP_set_sequence             = 0x16,
182*56bb7041Schristos   DW_LNE_HP_negate_post_semantics    = 0x17,
183*56bb7041Schristos   DW_LNE_HP_negate_function_exit     = 0x18,
184*56bb7041Schristos   DW_LNE_HP_negate_front_end_logical = 0x19,
185*56bb7041Schristos   DW_LNE_HP_define_proc              = 0x20
186*56bb7041Schristos };
187*56bb7041Schristos 
188*56bb7041Schristos enum DW_CHILDREN
189*56bb7041Schristos {
190*56bb7041Schristos   DW_CHILDREN_no		     =0x00,
191*56bb7041Schristos   DW_CHILDREN_yes		     =0x01
192*56bb7041Schristos };
193*56bb7041Schristos 
194*56bb7041Schristos // Source language names and codes.
195*56bb7041Schristos enum DW_LANG
196*56bb7041Schristos {
197*56bb7041Schristos   DW_LANG_C89 = 0x0001,
198*56bb7041Schristos   DW_LANG_C = 0x0002,
199*56bb7041Schristos   DW_LANG_Ada83 = 0x0003,
200*56bb7041Schristos   DW_LANG_C_plus_plus = 0x0004,
201*56bb7041Schristos   DW_LANG_Cobol74 = 0x0005,
202*56bb7041Schristos   DW_LANG_Cobol85 = 0x0006,
203*56bb7041Schristos   DW_LANG_Fortran77 = 0x0007,
204*56bb7041Schristos   DW_LANG_Fortran90 = 0x0008,
205*56bb7041Schristos   DW_LANG_Pascal83 = 0x0009,
206*56bb7041Schristos   DW_LANG_Modula2 = 0x000a,
207*56bb7041Schristos   // DWARF 3.
208*56bb7041Schristos   DW_LANG_Java = 0x000b,
209*56bb7041Schristos   DW_LANG_C99 = 0x000c,
210*56bb7041Schristos   DW_LANG_Ada95 = 0x000d,
211*56bb7041Schristos   DW_LANG_Fortran95 = 0x000e,
212*56bb7041Schristos   DW_LANG_PLI = 0x000f,
213*56bb7041Schristos   DW_LANG_ObjC = 0x0010,
214*56bb7041Schristos   DW_LANG_ObjC_plus_plus = 0x0011,
215*56bb7041Schristos   DW_LANG_UPC = 0x0012,
216*56bb7041Schristos   DW_LANG_D = 0x0013,
217*56bb7041Schristos   // DWARF 4.
218*56bb7041Schristos   DW_LANG_Python = 0x0014,
219*56bb7041Schristos   // DWARF 5.
220*56bb7041Schristos   DW_LANG_Go = 0x0016,
221*56bb7041Schristos   DW_LANG_C_plus_plus_11 = 0x001a,
222*56bb7041Schristos   DW_LANG_C11 = 0x001d,
223*56bb7041Schristos   DW_LANG_C_plus_plus_14 = 0x0021,
224*56bb7041Schristos   DW_LANG_Fortran03 = 0x0022,
225*56bb7041Schristos   DW_LANG_Fortran08 = 0x0023,
226*56bb7041Schristos 
227*56bb7041Schristos   DW_LANG_lo_user = 0x8000,	// Implementation-defined range start.
228*56bb7041Schristos   DW_LANG_hi_user = 0xffff,	// Implementation-defined range start.
229*56bb7041Schristos   // MIPS.
230*56bb7041Schristos   DW_LANG_Mips_Assembler = 0x8001,
231*56bb7041Schristos   // UPC.
232*56bb7041Schristos   DW_LANG_Upc = 0x8765,
233*56bb7041Schristos   // HP extensions.
234*56bb7041Schristos   DW_LANG_HP_Bliss     = 0x8003,
235*56bb7041Schristos   DW_LANG_HP_Basic91   = 0x8004,
236*56bb7041Schristos   DW_LANG_HP_Pascal91  = 0x8005,
237*56bb7041Schristos   DW_LANG_HP_IMacro    = 0x8006,
238*56bb7041Schristos   DW_LANG_HP_Assembler = 0x8007
239*56bb7041Schristos };
240*56bb7041Schristos 
241*56bb7041Schristos // DWARF section identifiers used in the package format.
242*56bb7041Schristos // Extensions for Fission.  See http://gcc.gnu.org/wiki/DebugFissionDWP.
243*56bb7041Schristos 
244*56bb7041Schristos enum DW_SECT
245*56bb7041Schristos {
246*56bb7041Schristos   DW_SECT_INFO = 1,
247*56bb7041Schristos   DW_SECT_TYPES = 2,
248*56bb7041Schristos   DW_SECT_ABBREV = 3,
249*56bb7041Schristos   DW_SECT_LINE = 4,
250*56bb7041Schristos   DW_SECT_LOC = 5,
251*56bb7041Schristos   DW_SECT_STR_OFFSETS = 6,
252*56bb7041Schristos   DW_SECT_MACINFO = 7,
253*56bb7041Schristos   DW_SECT_MACRO = 8,
254*56bb7041Schristos   DW_SECT_MAX = DW_SECT_MACRO,
255*56bb7041Schristos };
256*56bb7041Schristos 
257*56bb7041Schristos } // End namespace elfcpp.
258*56bb7041Schristos 
259*56bb7041Schristos #endif // !defined(ELFCPP_DWARF_H)
260