1 { $Id: fpdbgdwarfconst.pas 44586 2014-04-01 23:44:33Z martin $ }
2 {
3  ---------------------------------------------------------------------------
4  fpdbgdwarfconst.pas  -  Freepascal debugger - Dwarf constants
5  ---------------------------------------------------------------------------
6 
7  This unit contains the constants defined for the dward debugging format.
8 
9  ---------------------------------------------------------------------------
10 
11  @created(Fri Jul 7th WET 2006)
12  @lastmod($Date: 2014-04-02 01:44:33 +0200 (Mi, 02 Apr 2014) $)
13  @author(Marc Weustink <marc@@dommelstein.nl>)
14 
15  *****************************************************************************
16   This file is part of the Lazarus Project
17 
18   See the file COPYING.modifiedLGPL.txt, included in this distribution,
19   for details about the license.
20  *****************************************************************************
21 }
22 unit FpDbgDwarfConst;
23 
24 {$mode objfpc}{$H+}
25 
26 interface
27 
28 uses sysutils;
29 
30 const
31 
32   DWARF_HEADER64_SIGNATURE = $FFFFFFFF;
33 
34   { tag encodings }
35 
36   DW_TAG_array_type               = $01;
37   DW_TAG_class_type               = $02;
38   DW_TAG_entry_point              = $03;
39   DW_TAG_enumeration_type         = $04;
40   DW_TAG_formal_parameter         = $05;
41   DW_TAG_imported_declaration     = $08;
42   DW_TAG_label                    = $0a;
43   DW_TAG_lexical_block            = $0b;
44   DW_TAG_member                   = $0d;
45   DW_TAG_pointer_type             = $0f;
46   DW_TAG_reference_type           = $10;
47   DW_TAG_compile_unit             = $11;
48   DW_TAG_string_type              = $12;
49   DW_TAG_structure_type           = $13;
50   DW_TAG_subroutine_type          = $15;
51   DW_TAG_typedef                  = $16;
52   DW_TAG_union_type               = $17;
53   DW_TAG_unspecified_parameters   = $18;
54   DW_TAG_variant                  = $19;
55   DW_TAG_common_block             = $1a;
56   DW_TAG_common_inclusion         = $1b;
57   DW_TAG_inheritance              = $1c;
58   DW_TAG_inlined_subroutine       = $1d;
59   DW_TAG_module                   = $1e;
60   DW_TAG_ptr_to_member_type       = $1f;
61   DW_TAG_set_type                 = $20;
62   DW_TAG_subrange_type            = $21;
63   DW_TAG_with_stmt                = $22;
64   DW_TAG_access_declaration       = $23;
65   DW_TAG_base_type                = $24;
66   DW_TAG_catch_block              = $25;
67   DW_TAG_const_type               = $26;
68   DW_TAG_constant                 = $27;
69   DW_TAG_enumerator               = $28;
70   DW_TAG_file_type                = $29;
71   DW_TAG_friend                   = $2a;
72   DW_TAG_namelist                 = $2b;
73   DW_TAG_namelist_item            = $2c;
74   DW_TAG_packed_type              = $2d;
75   DW_TAG_subprogram               = $2e;
76   DW_TAG_template_type_parameter  = $2f;
77   DW_TAG_template_value_parameter = $30;
78   DW_TAG_thrown_type              = $31;
79   DW_TAG_try_block                = $32;
80   DW_TAG_variant_part             = $33;
81   DW_TAG_variable                 = $34;
82   DW_TAG_volatile_type            = $35;
83   // --- DWARF3 ---
84   DW_TAG_dwarf_procedure          = $36;
85   DW_TAG_restrict_type            = $37;
86   DW_TAG_interface_type           = $38;
87   DW_TAG_namespace                = $39;
88   DW_TAG_imported_module          = $3a;
89   DW_TAG_unspecified_type         = $3b;
90   DW_TAG_partial_unit             = $3c;
91   DW_TAG_imported_unit            = $3d;
92   DW_TAG_condition                = $3f;
93   DW_TAG_shared_type              = $40;
94   // ---  ---
95   DW_TAG_lo_user                  = $4080;
96   DW_TAG_hi_user                  = $ffff;
97 
98 
99   { Child determination encodings }
100 
101   DW_CHILDREN_no  = $00;
102   DW_CHILDREN_yes = $01;
103 
104 
105   { Attribute encodings }
106 
107   DW_AT_sibling              = $01  ;    // reference
108   DW_AT_location             = $02  ;    // block, loclistptr
109   DW_AT_name                 = $03  ;    // string
110   DW_AT_ordering             = $09  ;    // constant
111   DW_AT_byte_size            = $0b  ;    // block, constant, reference
112   DW_AT_bit_offset           = $0c  ;    // block, constant, reference
113   DW_AT_bit_size             = $0d  ;    // block, constant, reference
114   DW_AT_stmt_list            = $10  ;    // lineptr
115   DW_AT_low_pc               = $11  ;    // address
116   DW_AT_high_pc              = $12  ;    // address
117   DW_AT_language             = $13  ;    // constant
118   DW_AT_discr                = $15  ;    // reference
119   DW_AT_discr_value          = $16  ;    // constant
120   DW_AT_visibility           = $17  ;    // constant
121   DW_AT_import               = $18  ;    // reference
122   DW_AT_string_length        = $19  ;    // block, loclistptr
123   DW_AT_common_reference     = $1a  ;    // reference
124   DW_AT_comp_dir             = $1b  ;    // string
125   DW_AT_const_value          = $1c  ;    // block, constant, string
126   DW_AT_containing_type      = $1d  ;    // reference
127   DW_AT_default_value        = $1e  ;    // reference
128   DW_AT_inline               = $20  ;    // constant
129   DW_AT_is_optional          = $21  ;    // flag
130   DW_AT_lower_bound          = $22  ;    // block, constant, reference
131   DW_AT_producer             = $25  ;    // string
132   DW_AT_prototyped           = $27  ;    // flag
133   DW_AT_return_addr          = $2a  ;    // block, loclistptr
134   DW_AT_start_scope          = $2c  ;    // constant
135   DW_AT_bit_stride           = $2e  ;    // constant  // Dwarf 2 refers to it as DW_AT_stride_size
136   DW_AT_upper_bound          = $2f  ;    // block, constant, reference
137   DW_AT_abstract_origin      = $31  ;    // reference
138   DW_AT_accessibility        = $32  ;    // constant
139   DW_AT_address_class        = $33  ;    // constant
140   DW_AT_artificial           = $34  ;    // flag
141   DW_AT_base_types           = $35  ;    // reference
142   DW_AT_calling_convention   = $36  ;    // constant
143   DW_AT_count                = $37  ;    // block, constant, reference
144   DW_AT_data_member_location = $38  ;    // block, constant, loclistptr
145   DW_AT_decl_column          = $39  ;    // constant
146   DW_AT_decl_file            = $3a  ;    // constant
147   DW_AT_decl_line            = $3b  ;    // constant
148   DW_AT_declaration          = $3c  ;    // flag
149   DW_AT_discr_list           = $3d  ;    // block
150   DW_AT_encoding             = $3e  ;    // constant
151   DW_AT_external             = $3f  ;    // flag
152   DW_AT_frame_base           = $40  ;    // block, loclistptr
153   DW_AT_friend               = $41  ;    // reference
154   DW_AT_identifier_case      = $42  ;    // constant
155   DW_AT_macro_info           = $43  ;    // macptr
156   DW_AT_namelist_item        = $44  ;    // block
157   DW_AT_priority             = $45  ;    // reference
158   DW_AT_segment              = $46  ;    // block, loclistptr
159   DW_AT_specification        = $47  ;    // reference
160   DW_AT_static_link          = $48  ;    // block, loclistptr
161   DW_AT_type                 = $49  ;    // reference
162   DW_AT_use_location         = $4a  ;    // block, loclistptr
163   DW_AT_variable_parameter   = $4b  ;    // flag
164   DW_AT_virtuality           = $4c  ;    // constant
165   DW_AT_vtable_elem_location = $4d  ;    // block, loclistptr
166   // --- DWARF3 ---
167   DW_AT_allocated            = $4e  ;    // block, constant, reference
168   DW_AT_associated           = $4f  ;    // block, constant, reference
169   DW_AT_data_location        = $50  ;    // block
170   DW_AT_byte_stride          = $51  ;    // block, constant, reference
171   DW_AT_entry_pc             = $52  ;    // address
172   DW_AT_use_UTF8             = $53  ;    // flag
173   DW_AT_extension            = $54  ;    // reference
174   DW_AT_ranges               = $55  ;    // rangelistptr
175   DW_AT_trampoline           = $56  ;    // address, flag, reference, string
176   DW_AT_call_column          = $57  ;    // constant
177   DW_AT_call_file            = $58  ;    // constant
178   DW_AT_call_line            = $59  ;    // constant
179   DW_AT_description          = $5a  ;    // string
180   DW_AT_binary_scale         = $5b  ;    // constant
181   DW_AT_decimal_scale        = $5c  ;    // constant
182   DW_AT_small                = $5d  ;    // reference
183   DW_AT_decimal_sign         = $5e  ;    // constant
184   DW_AT_digit_count          = $5f  ;    // constant
185   DW_AT_picture_string       = $60  ;    // string
186   DW_AT_mutable              = $61  ;    // flag
187   DW_AT_threads_scaled       = $62  ;    // flag
188   DW_AT_explicit             = $63  ;    // flag
189   DW_AT_object_pointer       = $64  ;    // reference
190   DW_AT_endianity            = $65  ;    // constant
191   DW_AT_elemental            = $66  ;    // flag
192   DW_AT_pure                 = $67  ;    // flag
193   DW_AT_recursive            = $68  ;    // flag
194   // ---  ---
195   DW_AT_lo_user              = $2000;    // ---
196   DW_AT_hi_user              = $3fff;    // ---
197 
198 
199   { Attribute form encodings }
200 
201   DW_FORM_addr      = $01;    // address
202   DW_FORM_block2    = $03;    // block
203   DW_FORM_block4    = $04;    // block
204   DW_FORM_data2     = $05;    // constant
205   DW_FORM_data4     = $06;    // constant, lineptr, loclistptr, macptr, rangelistptr
206   DW_FORM_data8     = $07;    // constant, lineptr, loclistptr, macptr, rangelistptr
207   DW_FORM_string    = $08;    // string
208   DW_FORM_block     = $09;    // block
209   DW_FORM_block1    = $0a;    // block
210   DW_FORM_data1     = $0b;    // constant
211   DW_FORM_flag      = $0c;    // flag
212   DW_FORM_sdata     = $0d;    // constant
213   DW_FORM_strp      = $0e;    // string
214   DW_FORM_udata     = $0f;    // constant
215   DW_FORM_ref_addr  = $10;    // reference
216   DW_FORM_ref1      = $11;    // reference
217   DW_FORM_ref2      = $12;    // reference
218   DW_FORM_ref4      = $13;    // reference
219   DW_FORM_ref8      = $14;    // reference
220   DW_FORM_ref_udata = $15;    // reference
221   DW_FORM_indirect  = $16;    //
222 
223 
224   { DWARF operation encodings }
225 
226   DW_OP_addr                  = $03;    // 1 constant address (size target specific)
227   DW_OP_deref                 = $06;    // 0
228   DW_OP_const1u               = $08;    // 1 1-byte constant
229   DW_OP_const1s               = $09;    // 1 1-byte constant
230   DW_OP_const2u               = $0a;    // 1 2-byte constant
231   DW_OP_const2s               = $0b;    // 1 2-byte constant
232   DW_OP_const4u               = $0c;    // 1 4-byte constant
233   DW_OP_const4s               = $0d;    // 1 4-byte constant
234   DW_OP_const8u               = $0e;    // 1 8-byte constant
235   DW_OP_const8s               = $0f;    // 1 8-byte constant
236   DW_OP_constu                = $10;    // 1 ULEB128 constant
237   DW_OP_consts                = $11;    // 1 SLEB128 constant
238   DW_OP_dup                   = $12;    // 0
239   DW_OP_drop                  = $13;    // 0
240   DW_OP_over                  = $14;    // 0
241   DW_OP_pick                  = $15;    // 1 1-byte stack index
242   DW_OP_swap                  = $16;    // 0
243   DW_OP_rot                   = $17;    // 0
244   DW_OP_xderef                = $18;    // 0
245   DW_OP_abs                   = $19;    // 0
246   DW_OP_and                   = $1a;    // 0
247   DW_OP_div                   = $1b;    // 0
248   DW_OP_minus                 = $1c;    // 0
249   DW_OP_mod                   = $1d;    // 0
250   DW_OP_mul                   = $1e;    // 0
251   DW_OP_neg                   = $1f;    // 0
252   DW_OP_not                   = $20;    // 0
253   DW_OP_or                    = $21;    // 0
254   DW_OP_plus                  = $22;    // 0
255   DW_OP_plus_uconst           = $23;    // 1 ULEB128 addend
256   DW_OP_shl                   = $24;    // 0
257   DW_OP_shr                   = $25;    // 0
258   DW_OP_shra                  = $26;    // 0
259   DW_OP_xor                   = $27;    // 0
260   DW_OP_skip                  = $2f;    // 1 signed 2-byte constant
261   DW_OP_bra                   = $28;    // 1 signed 2-byte constant
262   DW_OP_eq                    = $29;    // 0
263   DW_OP_ge                    = $2a;    // 0
264   DW_OP_gt                    = $2b;    // 0
265   DW_OP_le                    = $2c;    // 0
266   DW_OP_lt                    = $2d;    // 0
267   DW_OP_ne                    = $2e;    // 0
268   DW_OP_lit0                  = $30;    // 0 literals 0..31 =    (DW_OP_lit0 + literal)
269   DW_OP_lit1                  = $31;    // 0
270   DW_OP_lit2                  = $32;    // 0
271   DW_OP_lit3                  = $33;    // 0
272   DW_OP_lit4                  = $34;    // 0
273   DW_OP_lit5                  = $35;    // 0
274   DW_OP_lit6                  = $36;    // 0
275   DW_OP_lit7                  = $37;    // 0
276   DW_OP_lit8                  = $38;    // 0
277   DW_OP_lit9                  = $39;    // 0
278   DW_OP_lit10                 = $3a;    // 0
279   DW_OP_lit11                 = $3b;    // 0
280   DW_OP_lit12                 = $3c;    // 0
281   DW_OP_lit13                 = $3d;    // 0
282   DW_OP_lit14                 = $3e;    // 0
283   DW_OP_lit15                 = $3f;    // 0
284   DW_OP_lit16                 = $40;    // 0
285   DW_OP_lit17                 = $41;    // 0
286   DW_OP_lit18                 = $42;    // 0
287   DW_OP_lit19                 = $43;    // 0
288   DW_OP_lit20                 = $44;    // 0
289   DW_OP_lit21                 = $45;    // 0
290   DW_OP_lit22                 = $46;    // 0
291   DW_OP_lit23                 = $47;    // 0
292   DW_OP_lit24                 = $48;    // 0
293   DW_OP_lit25                 = $49;    // 0
294   DW_OP_lit26                 = $4a;    // 0
295   DW_OP_lit27                 = $4b;    // 0
296   DW_OP_lit28                 = $4c;    // 0
297   DW_OP_lit29                 = $4d;    // 0
298   DW_OP_lit30                 = $4e;    // 0
299   DW_OP_lit31                 = $4f;    // 0
300   DW_OP_reg0                  = $50;    // 0 reg 0..31 =    (DW_OP_reg0 + regnum)
301   DW_OP_reg1                  = $51;    // 0
302   DW_OP_reg2                  = $52;    // 0
303   DW_OP_reg3                  = $53;    // 0
304   DW_OP_reg4                  = $54;    // 0
305   DW_OP_reg5                  = $55;    // 0
306   DW_OP_reg6                  = $56;    // 0
307   DW_OP_reg7                  = $57;    // 0
308   DW_OP_reg8                  = $58;    // 0
309   DW_OP_reg9                  = $59;    // 0
310   DW_OP_reg10                 = $5a;    // 0
311   DW_OP_reg11                 = $5b;    // 0
312   DW_OP_reg12                 = $5c;    // 0
313   DW_OP_reg13                 = $5d;    // 0
314   DW_OP_reg14                 = $5e;    // 0
315   DW_OP_reg15                 = $5f;    // 0
316   DW_OP_reg16                 = $60;    // 0
317   DW_OP_reg17                 = $61;    // 0
318   DW_OP_reg18                 = $62;    // 0
319   DW_OP_reg19                 = $63;    // 0
320   DW_OP_reg20                 = $64;    // 0
321   DW_OP_reg21                 = $65;    // 0
322   DW_OP_reg22                 = $66;    // 0
323   DW_OP_reg23                 = $67;    // 0
324   DW_OP_reg24                 = $68;    // 0
325   DW_OP_reg25                 = $69;    // 0
326   DW_OP_reg26                 = $6a;    // 0
327   DW_OP_reg27                 = $6b;    // 0
328   DW_OP_reg28                 = $6c;    // 0
329   DW_OP_reg29                 = $6d;    // 0
330   DW_OP_reg30                 = $6e;    // 0
331   DW_OP_reg31                 = $6f;    // 0
332   DW_OP_breg0                 = $70;    // 1 SLEB128 offsetbase register 0..31 =     (DW_OP_breg0 + regnum)
333   DW_OP_breg1                 = $71;    // 1
334   DW_OP_breg2                 = $72;    // 1
335   DW_OP_breg3                 = $73;    // 1
336   DW_OP_breg4                 = $74;    // 1
337   DW_OP_breg5                 = $75;    // 1
338   DW_OP_breg6                 = $76;    // 1
339   DW_OP_breg7                 = $77;    // 1
340   DW_OP_breg8                 = $78;    // 1
341   DW_OP_breg9                 = $79;    // 1
342   DW_OP_breg10                = $7a;    // 1
343   DW_OP_breg11                = $7b;    // 1
344   DW_OP_breg12                = $7c;    // 1
345   DW_OP_breg13                = $7d;    // 1
346   DW_OP_breg14                = $7e;    // 1
347   DW_OP_breg15                = $7f;    // 1
348   DW_OP_breg16                = $80;    // 1
349   DW_OP_breg17                = $81;    // 1
350   DW_OP_breg18                = $82;    // 1
351   DW_OP_breg19                = $83;    // 1
352   DW_OP_breg20                = $84;    // 1
353   DW_OP_breg21                = $85;    // 1
354   DW_OP_breg22                = $86;    // 1
355   DW_OP_breg23                = $87;    // 1
356   DW_OP_breg24                = $88;    // 1
357   DW_OP_breg25                = $89;    // 1
358   DW_OP_breg26                = $8a;    // 1
359   DW_OP_breg27                = $8b;    // 1
360   DW_OP_breg28                = $8c;    // 1
361   DW_OP_breg29                = $8d;    // 1
362   DW_OP_breg30                = $8e;    // 1
363   DW_OP_breg31                = $8f;    // 1
364   DW_OP_regx                  = $90;    // 1 ULEB128 register
365   DW_OP_fbreg                 = $91;    // 1 SLEB128 offset
366   DW_OP_bregx                 = $92;    // 2 ULEB128 register followed bySLEB128 offset
367   DW_OP_piece                 = $93;    // 1 ULEB128 size of piece addressed
368   DW_OP_deref_size            = $94;    // 1 1-byte size of data retrieved
369   DW_OP_xderef_size           = $95;    // 1 1-byte size of data retrieved
370   DW_OP_nop                   = $96;    // 0
371   // --- DWARF3 ---
372   DW_OP_push_object_address   = $97;    // 0
373   DW_OP_call2                 = $98;    // 1 2-byte offset of DIE
374   DW_OP_call4                 = $99;    // 1 4-byte offset of DIE
375   DW_OP_call_ref              = $9a;    // 1 4- or 8-byte offset of DIE
376   DW_OP_form_tls_address      = $9b;    // 0
377   DW_OP_call_frame_cfa        = $9c;    // 0
378   DW_OP_bit_piece             = $9d;    // 2
379   // ---  ---
380   DW_OP_lo_user               = $e0;    //
381   DW_OP_hi_user               = $ff;    //
382 
383 
384   { Base type encoding values }
385 
386   DW_ATE_address           = $01;
387   DW_ATE_boolean           = $02;
388   DW_ATE_complex_float     = $03;
389   DW_ATE_float             = $04;
390   DW_ATE_signed            = $05;
391   DW_ATE_signed_char       = $06;
392   DW_ATE_unsigned          = $07;
393   DW_ATE_unsigned_char     = $08;
394   // --- DWARF3 ---
395   DW_ATE_imaginary_float   = $09;
396   DW_ATE_packed_decimal    = $0a;
397   DW_ATE_numeric_string    = $0b;
398   DW_ATE_edited            = $0c;
399   DW_ATE_signed_fixed      = $0d;
400   DW_ATE_unsigned_fixed    = $0e;
401   DW_ATE_decimal_float     = $0f;
402   // ---  ---
403   DW_ATE_lo_user           = $80;
404   DW_ATE_hi_user           = $ff;
405 
406 
407   { Decimal sign encodings }
408 
409   // --- DWARF3 ---
410   DW_DS_unsigned           = $01;
411   DW_DS_leading_overpunch  = $02;
412   DW_DS_trailing_overpunch = $03;
413   DW_DS_leading_separate   = $04;
414   DW_DS_trailing_separate  = $05;
415   // ---  ---
416 
417 
418   { Endianity encodings }
419 
420   // --- DWARF3 ---
421   DW_END_default  = $00;
422   DW_END_big      = $01;
423   DW_END_little   = $02;
424   DW_END_lo_user  = $40;
425   DW_END_hi_user  = $ff;
426   // ---  ---
427 
428 
429   { Accessibility encodings }
430 
431   DW_ACCESS_public    = $01;
432   DW_ACCESS_protected = $02;
433   DW_ACCESS_private   = $03;
434 
435 
436   { Visibility encodings }
437 
438   DW_VIS_local     = $01;
439   DW_VIS_exported  = $02;
440   DW_VIS_qualified = $03;
441 
442 
443   { Virtuality encodings }
444 
445   DW_VIRTUALITY_none         = $00;
446   DW_VIRTUALITY_virtual      = $01;
447   DW_VIRTUALITY_pure_virtual = $02;
448 
449 
450   { Language names }
451 
452   DW_LANG_C89              = $0001;
453   DW_LANG_C                = $0002;
454   DW_LANG_Ada83            = $0003; // reserved
455   DW_LANG_C_plus_plus      = $0004;
456   DW_LANG_Cobol74          = $0005; // reserved
457   DW_LANG_Cobol85          = $0006; // reserved
458   DW_LANG_Fortran77        = $0007;
459   DW_LANG_Fortran90        = $0008;
460   DW_LANG_Pascal83         = $0009;
461   DW_LANG_Modula2          = $000a;
462   // --- DWARF3 ---
463   DW_LANG_Java             = $000b;
464   DW_LANG_C99              = $000c;
465   DW_LANG_Ada95            = $000d; // reserved
466   DW_LANG_Fortran95        = $000e;
467   DW_LANG_PLI              = $000f; // reserved
468   DW_LANG_ObjC             = $0010;
469   DW_LANG_ObjC_plus_plus   = $0011;
470   DW_LANG_UPC              = $0012;
471   DW_LANG_D                = $0013;
472   // ---  ---
473   DW_LANG_lo_user          = $8000;
474   DW_LANG_hi_user          = $ffff;
475 
476 
477   { Address class encoding }
478 
479   DW_ADDR_none = $00;
480 
481 
482   { Identifier case encodings }
483 
484   DW_ID_case_sensitive   = $00;
485   DW_ID_up_case          = $01;
486   DW_ID_down_case        = $02;
487   DW_ID_case_insensitive = $03;
488 
489 
490   { Calling convention encodings }
491 
492   DW_CC_normal  = $01;
493   DW_CC_program = $02;
494   DW_CC_nocall  = $03;
495   DW_CC_lo_user = $40;
496   DW_CC_hi_user = $ff;
497 
498 
499   { Inline encodings }
500 
501   DW_INL_not_inlined          = $00;
502   DW_INL_inlined              = $01;
503   DW_INL_declared_not_inlined = $02;
504   DW_INL_declared_inlined     = $03;
505 
506 
507   { Ordering encodings }
508 
509   DW_ORD_row_major = $00;
510   DW_ORD_col_major = $01;
511 
512 
513   { Discriminant descriptor encodings }
514 
515   DW_DSC_label = $00;
516   DW_DSC_range = $01;
517 
518 
519   { Line Number Standard Opcode Encodings }
520   DW_LNS_extended_opcode      = $00;
521 
522   DW_LNS_copy                 = $01;
523   DW_LNS_advance_pc           = $02;
524   DW_LNS_advance_line         = $03;
525   DW_LNS_set_file             = $04;
526   DW_LNS_set_column           = $05;
527   DW_LNS_negate_stmt          = $06;
528   DW_LNS_set_basic_block      = $07;
529   DW_LNS_const_add_pc         = $08;
530   DW_LNS_fixed_advance_pc     = $09;
531   // --- DWARF3 ---
532   DW_LNS_set_prologue_end     = $0a;
533   DW_LNS_set_epilogue_begin   = $0b;
534   DW_LNS_set_isa              = $0c;
535   // ---  ---
536 
537 
538   { Line Number Extended Opcode Encodings }
539 
540   DW_LNE_end_sequence = $01;
541   DW_LNE_set_address  = $02;
542   DW_LNE_define_file  = $03;
543   // --- DWARF3 ---
544   DW_LNE_lo_user      = $80;
545   DW_LNE_hi_user      = $ff;
546   // ---  ---
547 
548 
549   { Macinfo Type Encodings }
550 
551   DW_MACINFO_define     = $01;
552   DW_MACINFO_undef      = $02;
553   DW_MACINFO_start_file = $03;
554   DW_MACINFO_end_file   = $04;
555   DW_MACINFO_vendor_ext = $ff;
556 
557 
558   { Call frame instruction encodings }
559 
560   // Special codes, operand is encoded in bit 5..0
561   DW_CFA_advance_loc          = $40;    // delta
562   DW_CFA_offset               = $80;    // register  ULEB128 offset
563   DW_CFA_restore              = $C0;    // register
564   //--
565   DW_CFA_nop                  = $00;
566   DW_CFA_set_loc              = $01;    // address
567   DW_CFA_advance_loc1         = $02;    // 1-byte delta
568   DW_CFA_advance_loc2         = $03;    // 2-byte delta
569   DW_CFA_advance_loc4         = $04;    // 4-byte delta
570   DW_CFA_offset_extended      = $05;    // ULEB128 register, ULEB128 offset
571   DW_CFA_restore_extended     = $06;    // ULEB128 register
572   DW_CFA_undefined            = $07;    // ULEB128 register
573   DW_CFA_same_value           = $08;    // ULEB128 register
574   DW_CFA_register             = $09;    // ULEB128 register, ULEB128 register
575   DW_CFA_remember_state       = $0a;
576   DW_CFA_restore_state        = $0b;
577   DW_CFA_def_cfa              = $0c;    // ULEB128 register, ULEB128 offset
578   DW_CFA_def_cfa_register     = $0d;    // ULEB128 register
579   DW_CFA_def_cfa_offset       = $0e;    // ULEB128 offset
580   // --- DWARF3 ---
581   DW_CFA_def_cfa_expression   = $0f;    // BLOCK
582   DW_CFA_expression           = $10;    // ULEB128 register, BLOCK
583   DW_CFA_offset_extended_sf   = $11;    // ULEB128 register, SLEB128 offset
584   DW_CFA_def_cfa_sf           = $12;    // ULEB128 register, SLEB128 offset
585   DW_CFA_def_cfa_offset_sf    = $13;    // SLEB128 offset
586   DW_CFA_val_offset           = $14;    // ULEB128         , ULEB128
587   DW_CFA_val_offset_sf        = $15;    // ULEB128         , SLEB128
588   DW_CFA_val_expression       = $16;    // ULEB128         , BLOCK
589   // ---  ---
590   DW_CFA_lo_user              = $1c;
591   DW_CFA_hi_user              = $3f;
592 
DwarfTagToStringnull593 function DwarfTagToString(AValue: Integer): String;
DwarfChildrenToStringnull594 function DwarfChildrenToString(AValue: Integer): String;
DwarfAttributeToStringnull595 function DwarfAttributeToString(AValue: Integer): String;
DwarfAttributeFormToStringnull596 function DwarfAttributeFormToString(AValue: Integer): String;
DwarfLanguageToStringnull597 function DwarfLanguageToString(AValue: Integer): String;
DwarfBaseTypeEncodingToStringnull598 function DwarfBaseTypeEncodingToString(AValue: Integer): String;
DwarfAccessibilityToStringnull599 function DwarfAccessibilityToString(AValue: Integer): String;
DwarfVisibilityToStringnull600 function DwarfVisibilityToString(AValue: Integer): String;
DwarfVirtualityToStringnull601 function DwarfVirtualityToString(AValue: Integer): String;
DwarfIdentifierCaseToStringnull602 function DwarfIdentifierCaseToString(AValue: Integer): String;
603 
604 implementation
605 
DwarfTagToStringnull606 function DwarfTagToString(AValue: Integer): String;
607 begin
608   case AValue of
609     DW_TAG_array_type              : Result := 'DW_TAG_array_type';
610     DW_TAG_class_type              : Result := 'DW_TAG_class_type';
611     DW_TAG_entry_point             : Result := 'DW_TAG_entry_point';
612     DW_TAG_enumeration_type        : Result := 'DW_TAG_enumeration_type';
613     DW_TAG_formal_parameter        : Result := 'DW_TAG_formal_parameter';
614     DW_TAG_imported_declaration    : Result := 'DW_TAG_imported_declaration';
615     DW_TAG_label                   : Result := 'DW_TAG_label';
616     DW_TAG_lexical_block           : Result := 'DW_TAG_lexical_block';
617     DW_TAG_member                  : Result := 'DW_TAG_member';
618     DW_TAG_pointer_type            : Result := 'DW_TAG_pointer_type';
619     DW_TAG_reference_type          : Result := 'DW_TAG_reference_type';
620     DW_TAG_compile_unit            : Result := 'DW_TAG_compile_unit';
621     DW_TAG_string_type             : Result := 'DW_TAG_string_type';
622     DW_TAG_structure_type          : Result := 'DW_TAG_structure_type';
623     DW_TAG_subroutine_type         : Result := 'DW_TAG_subroutine_type';
624     DW_TAG_typedef                 : Result := 'DW_TAG_typedef';
625     DW_TAG_union_type              : Result := 'DW_TAG_union_type';
626     DW_TAG_unspecified_parameters  : Result := 'DW_TAG_unspecified_parameters';
627     DW_TAG_variant                 : Result := 'DW_TAG_variant';
628     DW_TAG_common_block            : Result := 'DW_TAG_common_block';
629     DW_TAG_common_inclusion        : Result := 'DW_TAG_common_inclusion';
630     DW_TAG_inheritance             : Result := 'DW_TAG_inheritance';
631     DW_TAG_inlined_subroutine      : Result := 'DW_TAG_inlined_subroutine';
632     DW_TAG_module                  : Result := 'DW_TAG_module';
633     DW_TAG_ptr_to_member_type      : Result := 'DW_TAG_ptr_to_member_type';
634     DW_TAG_set_type                : Result := 'DW_TAG_set_type';
635     DW_TAG_subrange_type           : Result := 'DW_TAG_subrange_type';
636     DW_TAG_with_stmt               : Result := 'DW_TAG_with_stmt';
637     DW_TAG_access_declaration      : Result := 'DW_TAG_access_declaration';
638     DW_TAG_base_type               : Result := 'DW_TAG_base_type';
639     DW_TAG_catch_block             : Result := 'DW_TAG_catch_block';
640     DW_TAG_const_type              : Result := 'DW_TAG_const_type';
641     DW_TAG_constant                : Result := 'DW_TAG_constant';
642     DW_TAG_enumerator              : Result := 'DW_TAG_enumerator';
643     DW_TAG_file_type               : Result := 'DW_TAG_file_type';
644     DW_TAG_friend                  : Result := 'DW_TAG_friend';
645     DW_TAG_namelist                : Result := 'DW_TAG_namelist';
646     DW_TAG_namelist_item           : Result := 'DW_TAG_namelist_item';
647     DW_TAG_packed_type             : Result := 'DW_TAG_packed_type';
648     DW_TAG_subprogram              : Result := 'DW_TAG_subprogram';
649     DW_TAG_template_type_parameter : Result := 'DW_TAG_template_type_parameter';
650     DW_TAG_template_value_parameter: Result := 'DW_TAG_template_value_parameter';
651     DW_TAG_thrown_type             : Result := 'DW_TAG_thrown_type';
652     DW_TAG_try_block               : Result := 'DW_TAG_try_block';
653     DW_TAG_variant_part            : Result := 'DW_TAG_variant_part';
654     DW_TAG_variable                : Result := 'DW_TAG_variable';
655     DW_TAG_volatile_type           : Result := 'DW_TAG_volatile_type';
656     DW_TAG_dwarf_procedure         : Result := 'DW_TAG_dwarf_procedure';
657     DW_TAG_restrict_type           : Result := 'DW_TAG_restrict_type';
658     DW_TAG_interface_type          : Result := 'DW_TAG_interface_type';
659     DW_TAG_namespace               : Result := 'DW_TAG_namespace';
660     DW_TAG_imported_module         : Result := 'DW_TAG_imported_module';
661     DW_TAG_unspecified_type        : Result := 'DW_TAG_unspecified_type';
662     DW_TAG_partial_unit            : Result := 'DW_TAG_partial_unit';
663     DW_TAG_imported_unit           : Result := 'DW_TAG_imported_unit';
664     DW_TAG_condition               : Result := 'DW_TAG_condition';
665     DW_TAG_shared_type             : Result := 'DW_TAG_shared_type';
666     DW_TAG_lo_user                 : Result := 'DW_TAG_lo_user';
667     DW_TAG_hi_user                 : Result := 'DW_TAG_hi_user';
668   else
669     Result := Format('DW_TAG_%d', [AValue]);
670   end;
671 end;
672 
DwarfChildrenToStringnull673 function DwarfChildrenToString(AValue: Integer): String;
674 begin
675   case AValue of
676     DW_CHILDREN_no  : Result := 'DW_CHILDREN_no';
677     DW_CHILDREN_yes : Result := 'DW_CHILDREN_yes';
678   else
679     Result := Format('DW_CHILDREN_%d', [AValue]);
680   end;
681 end;
682 
DwarfAttributeToStringnull683 function DwarfAttributeToString(AValue: Integer): String;
684 begin
685   case AValue of
686     DW_AT_sibling             : Result := 'DW_AT_sibling';
687     DW_AT_location            : Result := 'DW_AT_location';
688     DW_AT_name                : Result := 'DW_AT_name';
689     DW_AT_ordering            : Result := 'DW_AT_ordering';
690     DW_AT_byte_size           : Result := 'DW_AT_byte_size';
691     DW_AT_bit_offset          : Result := 'DW_AT_bit_offset';
692     DW_AT_bit_size            : Result := 'DW_AT_bit_size';
693     DW_AT_stmt_list           : Result := 'DW_AT_stmt_list';
694     DW_AT_low_pc              : Result := 'DW_AT_low_pc';
695     DW_AT_high_pc             : Result := 'DW_AT_high_pc';
696     DW_AT_language            : Result := 'DW_AT_language';
697     DW_AT_discr               : Result := 'DW_AT_discr';
698     DW_AT_discr_value         : Result := 'DW_AT_discr_value';
699     DW_AT_visibility          : Result := 'DW_AT_visibility';
700     DW_AT_import              : Result := 'DW_AT_import';
701     DW_AT_string_length       : Result := 'DW_AT_string_length';
702     DW_AT_common_reference    : Result := 'DW_AT_common_reference';
703     DW_AT_comp_dir            : Result := 'DW_AT_comp_dir';
704     DW_AT_const_value         : Result := 'DW_AT_const_value';
705     DW_AT_containing_type     : Result := 'DW_AT_containing_type';
706     DW_AT_default_value       : Result := 'DW_AT_default_value';
707     DW_AT_inline              : Result := 'DW_AT_inline';
708     DW_AT_is_optional         : Result := 'DW_AT_is_optional';
709     DW_AT_lower_bound         : Result := 'DW_AT_lower_bound';
710     DW_AT_producer            : Result := 'DW_AT_producer';
711     DW_AT_prototyped          : Result := 'DW_AT_prototyped';
712     DW_AT_return_addr         : Result := 'DW_AT_return_addr';
713     DW_AT_start_scope         : Result := 'DW_AT_start_scope';
714     DW_AT_bit_stride          : Result := 'DW_AT_bit_stride';
715     DW_AT_upper_bound         : Result := 'DW_AT_upper_bound';
716     DW_AT_abstract_origin     : Result := 'DW_AT_abstract_origin';
717     DW_AT_accessibility       : Result := 'DW_AT_accessibility';
718     DW_AT_address_class       : Result := 'DW_AT_address_class';
719     DW_AT_artificial          : Result := 'DW_AT_artificial';
720     DW_AT_base_types          : Result := 'DW_AT_base_types';
721     DW_AT_calling_convention  : Result := 'DW_AT_calling_convention';
722     DW_AT_count               : Result := 'DW_AT_count';
723     DW_AT_data_member_location: Result := 'DW_AT_data_member_location';
724     DW_AT_decl_column         : Result := 'DW_AT_decl_column';
725     DW_AT_decl_file           : Result := 'DW_AT_decl_file';
726     DW_AT_decl_line           : Result := 'DW_AT_decl_line';
727     DW_AT_declaration         : Result := 'DW_AT_declaration';
728     DW_AT_discr_list          : Result := 'DW_AT_discr_list';
729     DW_AT_encoding            : Result := 'DW_AT_encoding';
730     DW_AT_external            : Result := 'DW_AT_external';
731     DW_AT_frame_base          : Result := 'DW_AT_frame_base';
732     DW_AT_friend              : Result := 'DW_AT_friend';
733     DW_AT_identifier_case     : Result := 'DW_AT_identifier_case';
734     DW_AT_macro_info          : Result := 'DW_AT_macro_info';
735     DW_AT_namelist_item       : Result := 'DW_AT_namelist_item';
736     DW_AT_priority            : Result := 'DW_AT_priority';
737     DW_AT_segment             : Result := 'DW_AT_segment';
738     DW_AT_specification       : Result := 'DW_AT_specification';
739     DW_AT_static_link         : Result := 'DW_AT_static_link';
740     DW_AT_type                : Result := 'DW_AT_type';
741     DW_AT_use_location        : Result := 'DW_AT_use_location';
742     DW_AT_variable_parameter  : Result := 'DW_AT_variable_parameter';
743     DW_AT_virtuality          : Result := 'DW_AT_virtuality';
744     DW_AT_vtable_elem_location: Result := 'DW_AT_vtable_elem_location';
745     DW_AT_allocated           : Result := 'DW_AT_allocated';
746     DW_AT_associated          : Result := 'DW_AT_associated';
747     DW_AT_data_location       : Result := 'DW_AT_data_location';
748     DW_AT_byte_stride         : Result := 'DW_AT_byte_stride';
749     DW_AT_entry_pc            : Result := 'DW_AT_entry_pc';
750     DW_AT_use_UTF8            : Result := 'DW_AT_use_UTF8';
751     DW_AT_extension           : Result := 'DW_AT_extension';
752     DW_AT_ranges              : Result := 'DW_AT_ranges';
753     DW_AT_trampoline          : Result := 'DW_AT_trampoline';
754     DW_AT_call_column         : Result := 'DW_AT_call_column';
755     DW_AT_call_file           : Result := 'DW_AT_call_file';
756     DW_AT_call_line           : Result := 'DW_AT_call_line';
757     DW_AT_description         : Result := 'DW_AT_description';
758     DW_AT_binary_scale        : Result := 'DW_AT_binary_scale';
759     DW_AT_decimal_scale       : Result := 'DW_AT_decimal_scale';
760     DW_AT_small               : Result := 'DW_AT_small';
761     DW_AT_decimal_sign        : Result := 'DW_AT_decimal_sign';
762     DW_AT_digit_count         : Result := 'DW_AT_digit_count';
763     DW_AT_picture_string      : Result := 'DW_AT_picture_string';
764     DW_AT_mutable             : Result := 'DW_AT_mutable';
765     DW_AT_threads_scaled      : Result := 'DW_AT_threads_scaled';
766     DW_AT_explicit            : Result := 'DW_AT_explicit';
767     DW_AT_object_pointer      : Result := 'DW_AT_object_pointer';
768     DW_AT_endianity           : Result := 'DW_AT_endianity';
769     DW_AT_elemental           : Result := 'DW_AT_elemental';
770     DW_AT_pure                : Result := 'DW_AT_pure';
771     DW_AT_recursive           : Result := 'DW_AT_recursive';
772     DW_AT_lo_user             : Result := 'DW_AT_lo_user';
773     DW_AT_hi_user             : Result := 'DW_AT_hi_user';
774   else
775     Result := Format('DW_AT_%d', [AValue]);
776   end;
777 end;
778 
DwarfAttributeFormToStringnull779 function DwarfAttributeFormToString(AValue: Integer): String;
780 begin
781   case AValue of
782     DW_FORM_addr     : Result := 'DW_FORM_addr';
783     DW_FORM_block2   : Result := 'DW_FORM_block2';
784     DW_FORM_block4   : Result := 'DW_FORM_block4';
785     DW_FORM_data2    : Result := 'DW_FORM_data2';
786     DW_FORM_data4    : Result := 'DW_FORM_data4';
787     DW_FORM_data8    : Result := 'DW_FORM_data8';
788     DW_FORM_string   : Result := 'DW_FORM_string';
789     DW_FORM_block    : Result := 'DW_FORM_block';
790     DW_FORM_block1   : Result := 'DW_FORM_block1';
791     DW_FORM_data1    : Result := 'DW_FORM_data1';
792     DW_FORM_flag     : Result := 'DW_FORM_flag';
793     DW_FORM_sdata    : Result := 'DW_FORM_sdata';
794     DW_FORM_strp     : Result := 'DW_FORM_strp';
795     DW_FORM_udata    : Result := 'DW_FORM_udata';
796     DW_FORM_ref_addr : Result := 'DW_FORM_ref_addr';
797     DW_FORM_ref1     : Result := 'DW_FORM_ref1';
798     DW_FORM_ref2     : Result := 'DW_FORM_ref2';
799     DW_FORM_ref4     : Result := 'DW_FORM_ref4';
800     DW_FORM_ref8     : Result := 'DW_FORM_ref8';
801     DW_FORM_ref_udata: Result := 'DW_FORM_ref_udata';
802     DW_FORM_indirect : Result := 'DW_FORM_indirect';
803   else
804     Result := Format('DW_FORM_%d', [AValue]);
805   end;
806 end;
807 
DwarfLanguageToStringnull808 function DwarfLanguageToString(AValue: Integer): String;
809 begin
810   case AValue of
811     DW_LANG_C89              : Result := 'DW_LANG_C89';
812     DW_LANG_C                : Result := 'DW_LANG_C';
813     DW_LANG_Ada83            : Result := 'DW_LANG_Ada83 (reserved)';
814     DW_LANG_C_plus_plus      : Result := 'DW_LANG_C_plus_plus';
815     DW_LANG_Cobol74          : Result := 'DW_LANG_Cobol74 (reserved)';
816     DW_LANG_Cobol85          : Result := 'DW_LANG_Cobol85 (reserved)';
817     DW_LANG_Fortran77        : Result := 'DW_LANG_Fortran77';
818     DW_LANG_Fortran90        : Result := 'DW_LANG_Fortran90';
819     DW_LANG_Pascal83         : Result := 'DW_LANG_Pascal83';
820     DW_LANG_Modula2          : Result := 'DW_LANG_Modula2';
821     DW_LANG_Java             : Result := 'DW_LANG_Java';
822     DW_LANG_C99              : Result := 'DW_LANG_C99';
823     DW_LANG_Ada95            : Result := 'DW_LANG_Ada95 (reserved)';
824     DW_LANG_Fortran95        : Result := 'DW_LANG_Fortran95';
825     DW_LANG_PLI              : Result := 'DW_LANG_PLI (reserved)';
826     DW_LANG_ObjC             : Result := 'DW_LANG_ObjC';
827     DW_LANG_ObjC_plus_plus   : Result := 'DW_LANG_ObjC_plus_plus';
828     DW_LANG_UPC              : Result := 'DW_LANG_UPC';
829     DW_LANG_D                : Result := 'DW_LANG_D';
830     DW_LANG_lo_user..DW_LANG_hi_user: Result := Format('DW_LANG_user_%d', [AValue]);
831   else
832     Result := Format('DW_LANG_%d', [AValue]);
833   end;
834 end;
835 
DwarfBaseTypeEncodingToStringnull836 function DwarfBaseTypeEncodingToString(AValue: Integer): String;
837 begin
838   case AValue of
839     DW_ATE_address           : Result := 'DW_ATE_address';
840     DW_ATE_boolean           : Result := 'DW_ATE_boolean';
841     DW_ATE_complex_float     : Result := 'DW_ATE_complex_float';
842     DW_ATE_float             : Result := 'DW_ATE_float';
843     DW_ATE_signed            : Result := 'DW_ATE_signed';
844     DW_ATE_signed_char       : Result := 'DW_ATE_signed_char';
845     DW_ATE_unsigned          : Result := 'DW_ATE_unsigned';
846     DW_ATE_unsigned_char     : Result := 'DW_ATE_unsigned_char';
847     DW_ATE_imaginary_float   : Result := 'DW_ATE_imaginary_float';
848     DW_ATE_packed_decimal    : Result := 'DW_ATE_packed_decimal';
849     DW_ATE_numeric_string    : Result := 'DW_ATE_numeric_string';
850     DW_ATE_edited            : Result := 'DW_ATE_edited';
851     DW_ATE_signed_fixed      : Result := 'DW_ATE_signed_fixed';
852     DW_ATE_unsigned_fixed    : Result := 'DW_ATE_unsigned_fixed';
853     DW_ATE_decimal_float     : Result := 'DW_ATE_decimal_float';
854     DW_ATE_lo_user..DW_ATE_hi_user : Result := Format('DW_ATE_user_%d', [AValue]);
855   else
856     Result := Format('DW_ATE_%d', [AValue]);
857   end;
858 end;
859 
DwarfAccessibilityToStringnull860 function DwarfAccessibilityToString(AValue: Integer): String;
861 begin
862   case AValue of
863     DW_ACCESS_public    : Result := 'DW_ACCESS_public';
864     DW_ACCESS_protected : Result := 'DW_ACCESS_protected';
865     DW_ACCESS_private   : Result := 'DW_ACCESS_private';
866   else
867     Result := Format('DW_ACCESS_%d', [AValue]);
868   end;
869 end;
870 
DwarfVisibilityToStringnull871 function DwarfVisibilityToString(AValue: Integer): String;
872 begin
873   case AValue of
874     DW_VIS_local     : Result := 'DW_VIS_local';
875     DW_VIS_exported  : Result := 'DW_VIS_exported';
876     DW_VIS_qualified : Result := 'DW_VIS_qualified';
877   else
878     Result := Format('DW_FORM_%d', [AValue]);
879   end;
880 end;
881 
DwarfVirtualityToStringnull882 function DwarfVirtualityToString(AValue: Integer): String;
883 begin
884   case AValue of
885     DW_VIRTUALITY_none         : Result := 'DW_VIRTUALITY_none';
886     DW_VIRTUALITY_virtual      : Result := 'DW_VIRTUALITY_virtual';
887     DW_VIRTUALITY_pure_virtual : Result := 'DW_VIRTUALITY_pure_virtual';
888   else
889     Result := Format('DW_VIRTUALITY_%d', [AValue]);
890   end;
891 end;
892 
DwarfIdentifierCaseToStringnull893 function DwarfIdentifierCaseToString(AValue: Integer): String;
894 begin
895   case AValue of
896     DW_ID_case_sensitive   : Result := 'DW_ID_case_sensitive';
897     DW_ID_up_case          : Result := 'DW_ID_up_case';
898     DW_ID_down_case        : Result := 'DW_ID_down_case';
899     DW_ID_case_insensitive : Result := 'DW_ID_case_insensitive';
900   else
901     Result := Format('DW_ID_%d', [AValue]);
902   end;
903 end;
904 
905 end.
906 
907