Skip to content

Commit d591dc4

Browse files
authored
Merge pull request #194 from tromey/dwarf-5-constants
Dwarf 5 constants
2 parents d56ab3a + eb05552 commit d591dc4

File tree

1 file changed

+166
-20
lines changed

1 file changed

+166
-20
lines changed

src/constants.rs

Lines changed: 166 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,20 @@ macro_rules! dw {
8282
};
8383
}
8484

85-
/// Section 7.23:
85+
/// The unit type field in a unit header.
86+
/// See Section 7.5.1, Table 7.2.
87+
dw!(DwUt(u8) {
88+
DW_UT_compile = 0x01,
89+
DW_UT_type = 0x02,
90+
DW_UT_partial = 0x03,
91+
DW_UT_skeleton = 0x04,
92+
DW_UT_split_compile = 0x05,
93+
DW_UT_split_type = 0x06,
94+
DW_UT_lo_user = 0x80,
95+
DW_UT_hi_user = 0xff,
96+
});
97+
98+
/// Section 7.24:
8699
///
87100
/// > Call frame instructions are encoded in one or more bytes. The primary
88101
/// > opcode is encoded in the high order two bits of the first byte (that is,
@@ -126,14 +139,14 @@ dw!(DwCfa(u8) {
126139
});
127140

128141
/// The child determination encodings for DIE attributes.
129-
/// See section 7.5.4, Figure 19.
142+
/// See Section 7.5.3, Table 7.4.
130143
dw!(DwChildren(u8) {
131144
DW_CHILDREN_no = 0,
132145
DW_CHILDREN_yes = 1,
133146
});
134147

135148
/// The tag encodings for DIE attributes.
136-
/// See section 7.5.4, Figure 18.
149+
/// See Section 7.5.3, Table 7.3.
137150
dw!(DwTag(u64) {
138151
DW_TAG_null = 0x00,
139152

@@ -209,6 +222,8 @@ dw!(DwTag(u64) {
209222
DW_TAG_atomic_type = 0x47,
210223
DW_TAG_call_site = 0x48,
211224
DW_TAG_call_site_parameter = 0x49,
225+
DW_TAG_skeleton_unit = 0x4a,
226+
DW_TAG_immutable_type = 0x4b,
212227

213228
DW_TAG_lo_user = 0x4080,
214229
DW_TAG_hi_user = 0xffff,
@@ -274,7 +289,7 @@ dw!(DwTag(u64) {
274289
});
275290

276291
/// The attribute encodings for DIE attributes.
277-
/// See section 7.5.4, Figure 20.
292+
/// See Section 7.5.4, Table 7.5.
278293
dw!(DwAt(u64) {
279294
DW_AT_null = 0x00,
280295

@@ -382,12 +397,29 @@ dw!(DwAt(u64) {
382397
DW_AT_str_offsets_base = 0x72,
383398
DW_AT_addr_base = 0x73,
384399
DW_AT_ranges_base = 0x74,
385-
DW_AT_dwo_id = 0x75,
386400
DW_AT_dwo_name = 0x76,
387401
DW_AT_reference = 0x77,
388402
DW_AT_rvalue_reference = 0x78,
389403
DW_AT_macros = 0x79,
404+
DW_AT_call_all_calls = 0x7a,
405+
DW_AT_call_all_source_calls = 0x7b,
406+
DW_AT_call_all_tail_calls = 0x7c,
407+
DW_AT_call_return_pc = 0x7d,
408+
DW_AT_call_value = 0x7e,
409+
DW_AT_call_origin = 0x7f,
410+
DW_AT_call_parameter = 0x80,
411+
DW_AT_call_pc = 0x81,
412+
DW_AT_call_tail_call = 0x82,
413+
DW_AT_call_target = 0x83,
414+
DW_AT_call_target_clobbered = 0x84,
415+
DW_AT_call_data_location = 0x85,
416+
DW_AT_call_data_value = 0x86,
390417
DW_AT_noreturn = 0x87,
418+
DW_AT_alignment = 0x88,
419+
DW_AT_export_symbols = 0x89,
420+
DW_AT_deleted = 0x8a,
421+
DW_AT_defaulted = 0x8b,
422+
DW_AT_loclists_base = 0x8c,
391423

392424
DW_AT_lo_user = 0x2000,
393425
DW_AT_hi_user = 0x3fff,
@@ -562,7 +594,7 @@ dw!(DwAt(u64) {
562594
});
563595

564596
/// The attribute form encodings for DIE attributes.
565-
/// See section 7.5.4, Figure 21.
597+
/// See Section 7.5.6, Table 7.6.
566598
dw!(DwForm(u64) {
567599
DW_FORM_null = 0x00,
568600

@@ -594,6 +626,26 @@ dw!(DwForm(u64) {
594626
DW_FORM_flag_present = 0x19,
595627
DW_FORM_ref_sig8 = 0x20,
596628

629+
// DWARF 5.
630+
DW_FORM_strx = 0x1a,
631+
DW_FORM_addrx = 0x1b,
632+
DW_FORM_ref_sup4 = 0x1c,
633+
DW_FORM_strp_sup = 0x1d,
634+
DW_FORM_data16 = 0x1e,
635+
DW_FORM_line_strp = 0x1f,
636+
DW_FORM_implicit_const = 0x21,
637+
DW_FORM_loclistx = 0x22,
638+
DW_FORM_rnglistx = 0x23,
639+
DW_FORM_ref_sup8 = 0x24,
640+
DW_FORM_strx1 = 0x25,
641+
DW_FORM_strx2 = 0x26,
642+
DW_FORM_strx3 = 0x27,
643+
DW_FORM_strx4 = 0x28,
644+
DW_FORM_addrx1 = 0x29,
645+
DW_FORM_addrx2 = 0x2a,
646+
DW_FORM_addrx3 = 0x2b,
647+
DW_FORM_addrx4 = 0x2c,
648+
597649
// Extensions for Fission proposal
598650
DW_FORM_GNU_addr_index = 0x1f01,
599651
DW_FORM_GNU_str_index = 0x1f02,
@@ -604,7 +656,7 @@ dw!(DwForm(u64) {
604656
});
605657

606658
/// The encodings of the constants used in the `DW_AT_encoding` attribute.
607-
/// See Section 7.8, Figure 25.
659+
/// See Section 7.8, Table 7.11.
608660
dw!(DwAte(u8) {
609661
DW_ATE_address = 0x01,
610662
DW_ATE_boolean = 0x02,
@@ -626,13 +678,29 @@ dw!(DwAte(u8) {
626678

627679
// DWARF 4.
628680
DW_ATE_UTF = 0x10,
681+
DW_ATE_UCS = 0x11,
682+
DW_ATE_ASCII = 0x12,
629683

630684
DW_ATE_lo_user = 0x80,
631685
DW_ATE_hi_user = 0xff,
632686
});
633687

688+
/// The encodings of the constants used in location list entries.
689+
/// See Section 7.7.3, Table 7.10.
690+
dw!(DwLle(u8) {
691+
DW_LLE_end_of_list = 0x00,
692+
DW_LLE_base_addressx = 0x01,
693+
DW_LLE_startx_endx = 0x02,
694+
DW_LLE_startx_length = 0x03,
695+
DW_LLE_offset_pair = 0x04,
696+
DW_LLE_default_location = 0x05,
697+
DW_LLE_base_address = 0x06,
698+
DW_LLE_start_end = 0x07,
699+
DW_LLE_start_length = 0x08,
700+
});
701+
634702
/// The encodings of the constants used in the `DW_AT_decimal_sign` attribute.
635-
/// See Section 7.8, Figure 26.
703+
/// See Section 7.8, Table 7.12.
636704
dw!(DwDs(u8) {
637705
DW_DS_unsigned = 0x01,
638706
DW_DS_leading_overpunch = 0x02,
@@ -642,7 +710,7 @@ dw!(DwDs(u8) {
642710
});
643711

644712
/// The encodings of the constants used in the `DW_AT_endianity` attribute.
645-
/// See Section 7.8, Figure 27.
713+
/// See Section 7.8, Table 7.13.
646714
dw!(DwEnd(u8) {
647715
DW_END_default = 0x00,
648716
DW_END_big = 0x01,
@@ -652,31 +720,31 @@ dw!(DwEnd(u8) {
652720
});
653721

654722
/// The encodings of the constants used in the `DW_AT_accessibility` attribute.
655-
/// See Section 7.9, Figure 28.
723+
/// See Section 7.9, Table 7.14.
656724
dw!(DwAccess(u8) {
657725
DW_ACCESS_public = 0x01,
658726
DW_ACCESS_protected = 0x02,
659727
DW_ACCESS_private = 0x03,
660728
});
661729

662730
/// The encodings of the constants used in the `DW_AT_visibility` attribute.
663-
/// See Section 7.10, Figure 29.
731+
/// See Section 7.10, Table 7.15.
664732
dw!(DwVis(u8) {
665733
DW_VIS_local = 0x01,
666734
DW_VIS_exported = 0x02,
667735
DW_VIS_qualified = 0x03,
668736
});
669737

670738
/// The encodings of the constants used in the `DW_AT_virtuality` attribute.
671-
/// See Section 7.11, Figure 30.
739+
/// See Section 7.11, Table 7.16.
672740
dw!(DwVirtuality(u8) {
673741
DW_VIRTUALITY_none = 0x00,
674742
DW_VIRTUALITY_virtual = 0x01,
675743
DW_VIRTUALITY_pure_virtual = 0x02,
676744
});
677745

678746
/// The encodings of the constants used in the `DW_AT_language` attribute.
679-
/// See Section 7.12, Figure 31.
747+
/// See Section 7.12, Table 7.17.
680748
dw!(DwLang(u16) {
681749
DW_LANG_C89 = 0x0001,
682750
DW_LANG_C = 0x0002,
@@ -713,6 +781,8 @@ dw!(DwLang(u16) {
713781
DW_LANG_C_plus_plus_14 = 0x0021,
714782
DW_LANG_Fortran03 = 0x0022,
715783
DW_LANG_Fortran08 = 0x0023,
784+
DW_LANG_RenderScript = 0x0024,
785+
DW_LANG_BLISS = 0x0025,
716786

717787
DW_LANG_lo_user = 0x8000,
718788
DW_LANG_hi_user = 0xffff,
@@ -732,7 +802,7 @@ dw!(DwAddr(u64) {
732802
});
733803

734804
/// The encodings of the constants used in the `DW_AT_identifier_case` attribute.
735-
/// See Section 7.14, Figure 32.
805+
/// See Section 7.14, Table 7.18.
736806
dw!(DwId(u8) {
737807
DW_ID_case_sensitive = 0x00,
738808
DW_ID_up_case = 0x01,
@@ -741,17 +811,19 @@ dw!(DwId(u8) {
741811
});
742812

743813
/// The encodings of the constants used in the `DW_AT_calling_convention` attribute.
744-
/// See Section 7.15, Figure 33.
814+
/// See Section 7.15, Table 7.19.
745815
dw!(DwCc(u8) {
746816
DW_CC_normal = 0x01,
747817
DW_CC_program = 0x02,
748818
DW_CC_nocall = 0x03,
819+
DW_CC_pass_by_reference = 0x04,
820+
DW_CC_pass_by_value = 0x05,
749821
DW_CC_lo_user = 0x40,
750822
DW_CC_hi_user = 0xff,
751823
});
752824

753825
/// The encodings of the constants used in the `DW_AT_inline` attribute.
754-
/// See Section 7.16, Figure 34.
826+
/// See Section 7.16, Table 7.20.
755827
dw!(DwInl(u8) {
756828
DW_INL_not_inlined = 0x00,
757829
DW_INL_inlined = 0x01,
@@ -760,21 +832,41 @@ dw!(DwInl(u8) {
760832
});
761833

762834
/// The encodings of the constants used in the `DW_AT_ordering` attribute.
763-
/// See Section 7.17, Figure 35.
835+
/// See Section 7.17, Table 7.17.
764836
dw!(DwOrd(u8) {
765837
DW_ORD_row_major = 0x00,
766838
DW_ORD_col_major = 0x01,
767839
});
768840

769841
/// The encodings of the constants used in the `DW_AT_discr_list` attribute.
770-
/// See Section 7.18, Figure 36.
842+
/// See Section 7.18, Table 7.22.
771843
dw!(DwDsc(u8) {
772844
DW_DSC_label = 0x00,
773845
DW_DSC_range = 0x01,
774846
});
775847

848+
/// Name index attribute encodings.
849+
/// See Section 7.19, Table 7.23.
850+
dw!(DwIdx(u16) {
851+
DW_IDX_compile_unit = 1,
852+
DW_IDX_type_unit = 2,
853+
DW_IDX_die_offset = 3,
854+
DW_IDX_parent = 4,
855+
DW_IDX_type_hash = 5,
856+
DW_IDX_lo_user = 0x2000,
857+
DW_IDX_hi_user = 0x3fff,
858+
});
859+
860+
/// The encodings of the constants used in the `DW_AT_defaulted` attribute.
861+
/// See Section 7.20, Table 7.24.
862+
dw!(DwDefaulted(u8) {
863+
DW_DEFAULTED_no = 0x00,
864+
DW_DEFAULTED_in_class = 0x01,
865+
DW_DEFAULTED_out_of_class = 0x02,
866+
});
867+
776868
/// The encodings for the standard opcodes for line number information.
777-
/// See Section 7.21, Figure 37.
869+
/// See Section 7.22, Table 7.25.
778870
dw!(DwLns(u8) {
779871
DW_LNS_copy = 0x01,
780872
DW_LNS_advance_pc = 0x02,
@@ -791,7 +883,7 @@ dw!(DwLns(u8) {
791883
});
792884

793885
/// The encodings for the extended opcodes for line number information.
794-
/// See Section 7.21, Figure 38.
886+
/// See Section 7.22, Table 7.26.
795887
dw!(DwLne(u8) {
796888
DW_LNE_end_sequence = 0x01,
797889
DW_LNE_set_address = 0x02,
@@ -802,6 +894,52 @@ dw!(DwLne(u8) {
802894
DW_LNE_hi_user = 0xff,
803895
});
804896

897+
/// The encodings for the line number header entry formats.
898+
/// See Section 7.22, Table 7.27.
899+
dw!(DwLnct(u16) {
900+
DW_LNCT_path = 0x1,
901+
DW_LNCT_directory_index = 0x2,
902+
DW_LNCT_timestamp = 0x3,
903+
DW_LNCT_size = 0x4,
904+
DW_LNCT_MD5 = 0x5,
905+
DW_LNCT_lo_user = 0x2000,
906+
DW_LNCT_hi_user = 0x3fff,
907+
});
908+
909+
/// The encodings for macro information entry types.
910+
/// See Section 7.23, Table 7.28.
911+
dw!(DwMacro(u8) {
912+
DW_MACRO_define = 0x01,
913+
DW_MACRO_undef = 0x02,
914+
DW_MACRO_start_file = 0x03,
915+
DW_MACRO_end_file = 0x04,
916+
DW_MACRO_define_strp = 0x05,
917+
DW_MACRO_undef_strp = 0x06,
918+
DW_MACRO_import = 0x07,
919+
DW_MACRO_define_sup = 0x08,
920+
DW_MACRO_undef_sup = 0x09,
921+
DW_MACRO_import_sup = 0x0a,
922+
DW_MACRO_define_strx = 0x0b,
923+
DW_MACRO_undef_strx = 0x0c,
924+
DW_MACRO_lo_user = 0xe0,
925+
DW_MACRO_hi_user = 0xff,
926+
});
927+
928+
/// Range list entry encoding values.
929+
/// See Section 7.25, Table 7.30.
930+
dw!(DwRle(u8) {
931+
DW_RLE_end_of_list = 0x00,
932+
DW_RLE_base_addressx = 0x01,
933+
DW_RLE_startx_endx = 0x02,
934+
DW_RLE_startx_length = 0x03,
935+
DW_RLE_offset_pair = 0x04,
936+
DW_RLE_base_address = 0x05,
937+
DW_RLE_start_end = 0x06,
938+
DW_RLE_start_length = 0x07,
939+
});
940+
941+
/// The encodings for DWARF expression operations.
942+
/// See Section 7.7.1, Table 7.9.
805943
dw!(DwOp(u8) {
806944
DW_OP_addr = 0x03,
807945
DW_OP_deref = 0x06,
@@ -958,7 +1096,15 @@ dw!(DwOp(u8) {
9581096
DW_OP_implicit_value = 0x9e,
9591097
DW_OP_stack_value = 0x9f,
9601098
DW_OP_implicit_pointer = 0xa0,
1099+
DW_OP_addrx = 0xa1,
1100+
DW_OP_constx = 0xa2,
9611101
DW_OP_entry_value = 0xa3,
1102+
DW_OP_const_type = 0xa4,
1103+
DW_OP_regval_type = 0xa5,
1104+
DW_OP_deref_type = 0xa6,
1105+
DW_OP_xderef_type = 0xa7,
1106+
DW_OP_convert = 0xa8,
1107+
DW_OP_reinterpret = 0xa9,
9621108

9631109
// GNU extensions that are supported by our expression evaluator.
9641110
DW_OP_GNU_push_tls_address = 0xe0,

0 commit comments

Comments
 (0)