xref: /llvm-project/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-forms.s (revision b6a2eb0ecc8299a449ce1314a0fd9ac4010b3ce6)
1# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj | \
2# RUN:   not llvm-dwarfdump -verify - | FileCheck %s
3
4# CHECK: error: NameIndex @ 0x0: Abbreviation 0x2: DW_IDX_compile_unit uses an unexpected form DW_FORM_ref1 (expected form class constant).
5# CHECK: error: NameIndex @ 0x0: Abbreviation 0x2: DW_IDX_type_unit uses an unexpected form DW_FORM_ref1 (expected form class constant).
6# CHECK: error: NameIndex @ 0x0: Abbreviation 0x2: DW_IDX_type_hash uses an unexpected form DW_FORM_data4 (should be DW_FORM_data8).
7# CHECK: warning: NameIndex @ 0x0: Abbreviation 0x2 contains an unknown index attribute: DW_IDX_unknown_2020.
8# CHECK: error: NameIndex @ 0x0: Abbreviation 0x4 contains multiple DW_IDX_die_offset attributes.
9# CHECK: NameIndex @ 0x0: Abbreviation 0x1: DW_IDX_die_offset uses an unknown form: DW_FORM_unknown_1fff.
10# CHECK: warning: NameIndex @ 0x0: Abbreviation 0x3 references an unknown tag: DW_TAG_unknown_8080.
11# CHECK: error: NameIndex @ 0x0: Abbreviation 0x5 has no DW_IDX_die_offset attribute.
12# CHECK: error: NameIndex @ 0x55: Indexing multiple compile units and abbreviation 0x1 has no DW_IDX_compile_unit or DW_IDX_type_unit attribute.
13
14	.section	.debug_str,"MS",@progbits,1
15.Lstring_producer:
16	.asciz	"Hand-written dwarf"
17
18	.section	.debug_abbrev,"",@progbits
19.Lsection_abbrev:
20	.byte	1                       # Abbreviation Code
21	.byte	17                      # DW_TAG_compile_unit
22	.byte	1                       # DW_CHILDREN_yes
23	.byte	37                      # DW_AT_producer
24	.byte	14                      # DW_FORM_strp
25	.byte	19                      # DW_AT_language
26	.byte	5                       # DW_FORM_data2
27	.byte	0                       # EOM(1)
28	.byte	0                       # EOM(2)
29	.byte	0                       # EOM(3)
30
31	.section	.debug_info,"",@progbits
32.Lcu_begin0:
33	.long	.Lcu_end0-.Lcu_start0   # Length of Unit
34.Lcu_start0:
35	.short	4                       # DWARF version number
36	.long	.Lsection_abbrev        # Offset Into Abbrev. Section
37	.byte	8                       # Address Size (in bytes)
38	.byte	1                       # Abbrev [1] DW_TAG_compile_unit
39	.long	.Lstring_producer       # DW_AT_producer
40	.short	12                      # DW_AT_language
41	.byte	0                       # End Of Children Mark
42.Lcu_end0:
43
44.Lcu_begin1:
45	.long	.Lcu_end1-.Lcu_start1   # Length of Unit
46.Lcu_start1:
47	.short	4                       # DWARF version number
48	.long	.Lsection_abbrev        # Offset Into Abbrev. Section
49	.byte	8                       # Address Size (in bytes)
50	.byte	1                       # Abbrev [1] DW_TAG_compile_unit
51	.long	.Lstring_producer       # DW_AT_producer
52	.short	12                      # DW_AT_language
53	.byte	0                       # End Of Children Mark
54.Lcu_end1:
55
56.Lcu_begin2:
57	.long	.Lcu_end2-.Lcu_start2   # Length of Unit
58.Lcu_start2:
59	.short	4                       # DWARF version number
60	.long	.Lsection_abbrev        # Offset Into Abbrev. Section
61	.byte	8                       # Address Size (in bytes)
62	.byte	1                       # Abbrev [1] DW_TAG_compile_unit
63	.long	.Lstring_producer       # DW_AT_producer
64	.short	12                      # DW_AT_language
65	.byte	0                       # End Of Children Mark
66.Lcu_end2:
67
68	.section	.debug_names,"",@progbits
69	.long	.Lnames_end0-.Lnames_start0 # Header: contribution length
70.Lnames_start0:
71	.short	5                       # Header: version
72	.short	0                       # Header: padding
73	.long	1                       # Header: compilation unit count
74	.long	0                       # Header: local type unit count
75	.long	0                       # Header: foreign type unit count
76	.long	0                       # Header: bucket count
77	.long	0                       # Header: name count
78	.long	.Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size
79	.long	0                       # Header: augmentation length
80	.long	.Lcu_begin0             # Compilation unit 0
81.Lnames_abbrev_start0:
82	.byte	1                       # Abbrev code
83	.byte	46                      # DW_TAG_subprogram
84	.byte	3                       # DW_IDX_die_offset
85	.uleb128 0x1fff                 # DW_FORM_unknown_1fff
86	.byte	0                       # End of abbrev
87	.byte	0                       # End of abbrev
88	.byte	2                       # Abbrev code
89	.byte	46                      # DW_TAG_subprogram
90	.byte	1                       # DW_IDX_compile_unit
91	.byte   17                      # DW_FORM_ref1
92	.byte	2                       # DW_IDX_type_unit
93	.byte   17                      # DW_FORM_ref1
94	.byte	2                       # DW_IDX_type_unit
95	.byte   5                       # DW_FORM_data2
96	.byte	5                       # DW_IDX_type_hash
97	.byte   6                       # DW_FORM_data4
98	.uleb128 0x2020                 # DW_IDX_unknown_2020
99	.byte   6                       # DW_FORM_data4
100	.byte	0                       # End of abbrev
101	.byte	0                       # End of abbrev
102	.byte	3                       # Abbrev code
103	.uleb128 0x8080                 # DW_TAG_unknown_8080
104	.byte	3                       # DW_IDX_die_offset
105	.byte   17                      # DW_FORM_ref1
106	.byte	0                       # End of abbrev
107	.byte	0                       # End of abbrev
108	.byte	4                       # Abbrev code
109	.byte	46                      # DW_TAG_subprogram
110	.byte	3                       # DW_IDX_die_offset
111	.byte   17                      # DW_FORM_ref1
112	.byte	3                       # DW_IDX_die_offset
113	.byte   17                      # DW_FORM_ref1
114	.byte	0                       # End of abbrev
115	.byte	0                       # End of abbrev
116	.byte	5                       # Abbrev code
117	.byte	46                      # DW_TAG_subprogram
118	.byte	4                       # DW_IDX_parent
119	.byte   5                       # DW_FORM_data2
120	.byte	0                       # End of abbrev
121	.byte	0                       # End of abbrev
122	.byte	0                       # End of abbrev list
123.Lnames_abbrev_end0:
124.Lnames_end0:
125
126	.long	.Lnames_end1-.Lnames_start1 # Header: contribution length
127.Lnames_start1:
128	.short	5                       # Header: version
129	.short	0                       # Header: padding
130	.long	2                       # Header: compilation unit count
131	.long	0                       # Header: local type unit count
132	.long	0                       # Header: foreign type unit count
133	.long	0                       # Header: bucket count
134	.long	0                       # Header: name count
135	.long	.Lnames_abbrev_end1-.Lnames_abbrev_start1 # Header: abbreviation table size
136	.long	0                       # Header: augmentation length
137	.long	.Lcu_begin1             # Compilation unit 0
138	.long	.Lcu_begin2             # Compilation unit 1
139.Lnames_abbrev_start1:
140	.byte	1                       # Abbrev code
141	.byte	46                      # DW_TAG_subprogram
142	.byte	3                       # DW_IDX_die_offset
143	.byte   17                      # DW_FORM_ref1
144	.byte	0                       # End of abbrev
145	.byte	0                       # End of abbrev
146	.byte	0                       # End of abbrev list
147.Lnames_abbrev_end1:
148.Lnames_end1:
149