Use 'ao-dbg' instead of 's51' to communicate with TeleMetrum
[fw/sdcc] / src / SDCCdwarf2.h
1 /*-------------------------------------------------------------------------
2   SDCCdwarf2.h - DWARF2 debugging constants
3
4              Written By -  Erik Petrich . epetrich@users.sourceforge.net (2004)
5
6    This program is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by the
8    Free Software Foundation; either version 2, or (at your option) any
9    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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20    In other words, you are welcome to use, share and improve this program.
21    You are forbidden to forbid anyone else to use, share and improve
22    what you give them.   Help stamp out software-hoarding!
23 -------------------------------------------------------------------------*/
24
25 #ifndef SDCCDWARF2_H
26 #define SDCCDWARF2_H
27
28 #define DW_TAG_array_type 0x01
29 #define DW_TAG_class_type 0x02
30 #define DW_TAG_entry_point 0x03
31 #define DW_TAG_enumeration_type 0x04
32 #define DW_TAG_formal_parameter 0x05
33 #define DW_TAG_imported_declaration 0x08
34 #define DW_TAG_label 0x0a
35 #define DW_TAG_lexical_block 0x0b
36 #define DW_TAG_member 0x0d
37 #define DW_TAG_pointer_type 0x0f
38 #define DW_TAG_reference_type 0x10
39 #define DW_TAG_compile_unit 0x11
40 #define DW_TAG_string_type 0x12
41 #define DW_TAG_structure_type 0x13
42 #define DW_TAG_subroutine_type 0x15
43 #define DW_TAG_typedef 0x16
44 #define DW_TAG_union_type 0x17
45 #define DW_TAG_unspecified_parameters 0x18
46 #define DW_TAG_variant 0x19
47 #define DW_TAG_common_block 0x1a
48 #define DW_TAG_common_inclusion 0x1b
49 #define DW_TAG_inheritance 0x1c
50 #define DW_TAG_inlined_subroutine 01x1d
51 #define DW_TAG_module 0x1e
52 #define DW_TAG_ptr_to_member_type 0x1f
53 #define DW_TAG_set_type 0x20
54 #define DW_TAG_subrange_type 0x21
55 #define DW_TAG_with_stmt 0x22
56 #define DW_TAG_access_declaration 0x23
57 #define DW_TAG_base_type 0x24
58 #define DW_TAG_catch_block 0x25
59 #define DW_TAG_const_type 0x26
60 #define DW_TAG_constant 0x27
61 #define DW_TAG_enumerator 0x28
62 #define DW_TAG_file_type 0x29
63 #define DW_TAG_friend 0x2a
64 #define DW_TAG_namelist 0x2b
65 #define DW_TAG_namelist_item 0x2c
66 #define DW_TAG_packed_type 0x2d
67 #define DW_TAG_subprogram 0x2e
68 #define DW_TAG_template_type_param 0x2f
69 #define DW_TAG_template_value_param 0x30
70 #define DW_TAG_thrown_type 0x31
71 #define DW_TAG_try_block 0x32
72 #define DW_TAG_variant_part 0x33
73 #define DW_TAG_variable 0x34
74 #define DW_TAG_volatile_type 0x35
75
76 #define DW_CHILDREN_no 0
77 #define DW_CHILDREN_yes 1
78
79 #define DW_LANG_C89 0x0001
80
81 #define DW_AT_sibling 0x01
82 #define DW_AT_location 0x02
83 #define DW_AT_name 0x03
84 #define DW_AT_ordering 0x09
85 #define DW_AT_byte_size 0x0b
86 #define DW_AT_bit_offset 0x0c
87 #define DW_AT_bit_size 0x0d
88 #define DW_AT_stmt_list 0x10
89 #define DW_AT_low_pc 0x11
90 #define DW_AT_high_pc 0x12
91 #define DW_AT_language 0x13
92 #define DW_AT_discr 0x15
93 #define DW_AT_discr_value 0x16
94 #define DW_AT_visibility 0x17
95 #define DW_AT_import 0x18
96 #define DW_AT_string_length 0x19
97 #define DW_AT_common_reference 0x1a
98 #define DW_AT_comp_dir 0x1b
99 #define DW_AT_const_value 0x1c
100 #define DW_AT_containing_type 0x1d
101 #define DW_AT_default_value 0x1e
102 #define DW_AT_inline 0x20
103 #define DW_AT_is_optional 0x21
104 #define DW_AT_lower_bound 0x22
105 #define DW_AT_producer 0x25
106 #define DW_AT_prototyped 0x27
107 #define DW_AT_return_addr 0x2a
108 #define DW_AT_start_scope 0x2c
109 #define DW_AT_stride_size 0x2e
110 #define DW_AT_upper_bound 0x2f
111 #define DW_AT_abstract_origin 0x31
112 #define DW_AT_accessibility 0x32
113 #define DW_AT_address_class 0x33
114 #define DW_AT_artificial 0x34
115 #define DW_AT_base_types 0x35
116 #define DW_AT_calling_convention 0x36
117 #define DW_AT_count 0x37
118 #define DW_AT_data_member_location 0x38
119 #define DW_AT_decl_column 0x39
120 #define DW_AT_decl_file 0x3a
121 #define DW_AT_decl_line 0x3b
122 #define DW_AT_declaration 0x3c
123 #define DW_AT_discr_list 0x3d
124 #define DW_AT_encoding 0x3e
125 #define DW_AT_external 0x3f
126 #define DW_AT_frame_base 0x40
127 #define DW_AT_friend 0x41
128 #define DW_AT_identifier_case 0x42
129 #define DW_AT_macro_info 0x43
130 #define DW_AT_namelist_item 0x44
131 #define DW_AT_priority 0x45
132 #define DW_AT_segment 0x46
133 #define DW_AT_specification 0x47
134 #define DW_AT_static_link 0x48
135 #define DW_AT_type 0x49
136 #define DW_AT_use_location 0x4a
137 #define DW_AT_variable_parameter 0x4b
138 #define DW_AT_virtuality 0x4c
139 #define DW_AT_vtable_elem_location 0x4d
140 #define DW_AT_lo_user 0x2000
141 #define DW_AT_hi_user 0x3fff
142
143 #define DW_AT_user_block 0x2650
144 #define DW_AT_user_level 0x2651
145
146 #define DW_FORM_addr 0x01
147 #define DW_FORM_block2 0x03
148 #define DW_FORM_block4 0x04
149 #define DW_FORM_data2 0x05
150 #define DW_FORM_data4 0x06
151 #define DW_FORM_data8 0x07
152 #define DW_FORM_string 0x08
153 #define DW_FORM_block 0x09
154 #define DW_FORM_block1 0x0a
155 #define DW_FORM_data1 0x0b
156 #define DW_FORM_flag 0x0c
157 #define DW_FORM_sdata 0x0d
158 #define DW_FORM_strp 0x0e
159 #define DW_FORM_udata 0x0f
160 #define DW_FORM_ref_addr 0x10
161 #define DW_FORM_ref1 0x11
162 #define DW_FORM_ref2 0x12
163 #define DW_FORM_ref4 0x13
164 #define DW_FORM_ref_udata 0x15
165 #define DW_FORM_indirect 0x16
166
167 #define DW_OP_addr 0x03
168 #define DW_OP_deref 0x06
169 #define DW_OP_const1u 0x08
170 #define DW_OP_const1s 0x09
171 #define DW_OP_const2u 0x0a
172 #define DW_OP_const2s 0x0b
173 #define DW_OP_const4u 0x0c
174 #define DW_OP_const4s 0x0d
175 #define DW_OP_const8u 0x0e
176 #define DW_OP_const8s 0x0f
177 #define DW_OP_constu 0x10
178 #define DW_OP_consts 0x11
179 #define DW_OP_dup 0x12
180 #define DW_OP_drop 0x13
181 #define DW_OP_over 0x14
182 #define DW_OP_pick 0x15
183 #define DW_OP_swap 0x16
184 #define DW_OP_rot 0x17
185 #define DW_OP_xderef 0x18
186 #define DW_OP_abs 0x19
187 #define DW_OP_and 0x1a
188 #define DW_OP_div 0x1b
189 #define DW_OP_minus 0x1c
190 #define DW_OP_mod 0x1d
191 #define DW_OP_mul 0x1e
192 #define DW_OP_neg 0x1f
193 #define DW_OP_not 0x20
194 #define DW_OP_or 0x21
195 #define DW_OP_plus 0x22
196 #define DW_OP_plus_uconst 0x23
197 #define DW_OP_shl 0x24
198 #define DW_OP_shr 0x25
199 #define DW_OP_shra 0x26
200 #define DW_OP_xor 0x27
201 #define DW_OP_skip 0x2f
202 #define DW_OP_bra 0x28
203 #define DW_OP_eq 0x29
204 #define DW_OP_ge 0x2a
205 #define DW_OP_gt 0x2b
206 #define DW_OP_le 0x2c
207 #define DW_OP_lt 0x2d
208 #define DW_OP_ne 0x2e
209 #define DW_OP_lit0 0x30
210 #define DW_OP_reg0 0x50
211 #define DW_OP_breg0 0x70
212 #define DW_OP_breg1 0x71
213 #define DW_OP_breg2 0x72
214 #define DW_OP_breg3 0x73
215 #define DW_OP_breg4 0x74
216 #define DW_OP_breg5 0x75
217 #define DW_OP_breg6 0x76
218 #define DW_OP_breg7 0x77
219 #define DW_OP_breg8 0x78
220 #define DW_OP_breg9 0x79
221 #define DW_OP_breg10 0x7a
222 #define DW_OP_breg11 0x7b
223 #define DW_OP_breg12 0x7c
224 #define DW_OP_breg13 0x7d
225 #define DW_OP_breg14 0x7e
226 #define DW_OP_breg15 0x7f
227 #define DW_OP_breg16 0x80
228 #define DW_OP_breg17 0x81
229 #define DW_OP_breg18 0x82
230 #define DW_OP_breg19 0x83
231 #define DW_OP_breg20 0x84
232 #define DW_OP_breg21 0x85
233 #define DW_OP_breg22 0x86
234 #define DW_OP_breg23 0x87
235 #define DW_OP_breg24 0x88
236 #define DW_OP_breg25 0x89
237 #define DW_OP_breg26 0x8a
238 #define DW_OP_breg27 0x8b
239 #define DW_OP_breg28 0x8c
240 #define DW_OP_breg29 0x8d
241 #define DW_OP_breg30 0x8e
242 #define DW_OP_breg31 0x8f
243 #define DW_OP_regx 0x90
244 #define DW_OP_fbreg 0x91
245 #define DW_OP_bregx 0x92
246 #define DW_OP_piece 0x93
247 #define DW_OP_deref_size 0x94
248 #define DW_OP_xderef_size 0x95
249 #define DW_OP_nop 0x96
250
251 #define DW_ATE_address 0x1
252 #define DW_ATE_boolean 0x2
253 #define DW_ATE_complex_float 0x3
254 #define DW_ATE_float 0x4
255 #define DW_ATE_signed 0x5
256 #define DW_ATE_signed_char 0x6
257 #define DW_ATE_unsigned 0x7
258 #define DW_ATE_unsigned_char 0x8
259
260 #define DW_CC_normal 0x1
261 #define DW_CC_program 0x2
262 #define DW_CC_nocall 0x3
263
264 #define DW_LNS_copy 1
265 #define DW_LNS_advance_pc 2
266 #define DW_LNS_advance_line 3
267 #define DW_LNS_set_file 4
268 #define DW_LNS_set_column 5
269 #define DW_LNS_negate_stmt 6
270 #define DW_LNS_set_basic_block 7
271 #define DW_LNS_const_add_pc 8
272 #define DW_LNS_fixed_advance_pc 9
273
274 #define DW_LNE_end_sequence 1
275 #define DW_LNE_set_address 2
276 #define DW_LNE_define_file 3
277
278 #define DW_MACINFO_define 1
279 #define DW_MACINFO_undef 2
280 #define DW_MACINFO_start_file 3
281 #define DW_MACINFO_end_file 4
282 #define DW_MACINFO_vendor_ext 255
283
284 #define DW_CFA_advance_loc (1 << 6)
285 #define DW_CFA_offset (2 << 6)
286 #define DW_CFA_restore (3 << 6)
287 #define DW_CFA_set_loc 0x01
288 #define DW_CFA_advance_loc1 0x02
289 #define DW_CFA_advance_loc2 0x03
290 #define DW_CFA_advance_loc4 0x04
291 #define DW_CFA_offset_extended 0x05
292 #define DW_CFA_restore_extended 0x06
293 #define DW_CFA_undefined 0x07
294 #define DW_CFA_same_value 0x08
295 #define DW_CFA_register 0x09
296 #define DW_CFA_remember_state 0x0a
297 #define DW_CFA_restore_state 0x0b
298 #define DW_CFA_def_cfa 0x0c
299 #define DW_CFA_def_cfa_register 0x0d
300 #define DW_CFA_def_cfa_offset 0x0e
301 #define DW_CFA_nop 0x0f
302 #define DW_CFA_lo_user 0x1c
303 #define DW_CFA_hi_user 0x3f
304
305
306 typedef struct dwloc
307 {
308   int opcode;
309   struct
310   {
311     symbol * sym;
312     char * label;
313     int offset;
314   } operand;
315   struct dwloc * next;
316 } dwloc;
317
318 typedef struct dwlocregion
319 {
320   char * startLabel;
321   char * endLabel;
322   dwloc * loc;
323   struct dwlocregion * next;
324 } dwlocregion;
325
326 typedef struct dwloclist
327 {
328   int baseOffset;
329   dwlocregion * region;
330   struct dwloclist * next;
331 } dwloclist;
332
333 struct dwtag;
334
335 typedef struct dwattr
336 {
337   int attr;
338   int form;
339   union
340   {
341     struct
342     {
343       char * label;
344       int offset;
345     } symaddr;
346     struct
347     {
348       unsigned char * data;
349       int length;
350     } block;
351     int data;
352     char * string;
353     struct dwtag * ref;
354     struct dwloc * loc;
355     struct dwloclist * loclist;
356   } val;
357   struct dwattr * next;
358 } dwattr;
359
360 typedef struct dwtag
361 {
362   int tag;
363   int abbrev;
364   int baseOffset;
365   struct dwattr * attribs;
366   struct dwtag * parent;
367   struct dwtag * firstChild;
368   struct dwtag * lastChild;
369   struct dwtag * siblings;
370 } dwtag;
371
372 typedef struct dwfile
373 {
374   char * name;
375   int dirIndex;
376   int timestamp;
377   int length;
378 } dwfile;
379
380 typedef struct dwline
381 {
382   char * label;
383   int offset;
384   int fileIndex;
385   int line;
386   unsigned is_stmt:1;
387   unsigned basic_block:1;
388   unsigned end_sequence:1;
389   unsigned begin_sequence:1;
390   struct dwline * next;
391 } dwline;
392
393 #if 0
394 typedef struct dwblock
395 {
396   unsigned char * data;
397   int length;
398   int alloc;
399 } dwblock;
400
401 typedef struct dwcfop
402 {
403   int opcode;
404   char * label;
405   int operand1;
406   int operand2;
407   struct dwcfop * next;
408 } dwcfop;
409
410 typedef struct dwcfins
411 {
412   dwcfop * first;
413   dwcfop * last;
414 } dwcfins;
415
416 typedef struct dwfde
417 {
418   char * startLabel;
419   char * endLabel;
420   dwcfins * ins;
421 } dwfde;
422 #endif
423
424
425 #endif