1 # RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj -o - | not llvm-dwarfdump -verify - | FileCheck %s
3 # CHECK: error: Name Index @ 0x0: Unable to get string associated with name 1.
4 # CHECK: error: Name Index @ 0x0: Entry @ 0x73 contains an invalid CU index (47).
5 # CHECK: error: Name Index @ 0x0: Entry @ 0x79 references a non-existing DIE @ 0x3fa.
6 # CHECK: error: Name Index @ 0x0: Entry @ 0x85: mismatched CU of DIE @ 0x30: index - 0x0; debug_info - 0x1e.
7 # CHECK: error: Name Index @ 0x0: Entry @ 0x8b: mismatched Tag of DIE @ 0x17: index - DW_TAG_subprogram; debug_info - DW_TAG_variable.
8 # CHECK: error: Name Index @ 0x0: Entry @ 0x91: mismatched Name of DIE @ 0x35: index - foo; debug_info - bar, _Z3bar.
9 # CHECK: error: Name Index @ 0x0: Name 2 (foo): Incorrectly terminated entry list.
10 # CHECK: error: Name Index @ 0x0: Name 3 (bar) is not associated with any entries.
11 # CHECK: error: Name Index @ 0x0: Entry @ 0x69: mismatched Name of DIE @ 0x1c: index - (pseudonymous namespace); debug_info - (anonymous namespace).
13 .section .debug_str,"MS",@progbits,1
20 .Lstring_pseudo_namespace:
21 .asciz "(pseudonymous namespace)"
23 .asciz "Hand-written dwarf"
25 .section .debug_abbrev,"",@progbits
27 .byte 1 # Abbreviation Code
28 .byte 17 # DW_TAG_compile_unit
29 .byte 1 # DW_CHILDREN_yes
30 .byte 37 # DW_AT_producer
31 .byte 14 # DW_FORM_strp
32 .byte 19 # DW_AT_language
33 .byte 5 # DW_FORM_data2
36 .byte 2 # Abbreviation Code
37 .byte 46 # DW_TAG_subprogram
38 .byte 0 # DW_CHILDREN_no
40 .byte 14 # DW_FORM_strp
41 .byte 63 # DW_AT_external
42 .byte 25 # DW_FORM_flag_present
45 .byte 3 # Abbreviation Code
46 .byte 52 # DW_TAG_variable
47 .byte 0 # DW_CHILDREN_no
49 .byte 14 # DW_FORM_strp
52 .byte 4 # Abbreviation Code
53 .byte 57 # DW_TAG_namespace
54 .byte 0 # DW_CHILDREN_no
57 .byte 5 # Abbreviation Code
58 .byte 52 # DW_TAG_variable
59 .byte 0 # DW_CHILDREN_no
61 .byte 14 # DW_FORM_strp
62 .byte 110 # DW_AT_linkage_name
63 .byte 14 # DW_FORM_strp
68 .section .debug_info,"",@progbits
70 .long .Lcu_end0-.Lcu_start0 # Length of Unit
72 .short 4 # DWARF version number
73 .long .Lsection_abbrev # Offset Into Abbrev. Section
74 .byte 8 # Address Size (in bytes)
75 .byte 1 # Abbrev [1] DW_TAG_compile_unit
76 .long .Lstring_producer # DW_AT_producer
77 .short 12 # DW_AT_language
79 .byte 2 # Abbrev [2] DW_TAG_subprogram
80 .long .Lstring_foo # DW_AT_name
83 .byte 3 # Abbrev [3] DW_TAG_variable
84 .long .Lstring_foo # DW_AT_name
86 .byte 4 # Abbrev [3] DW_TAG_namespace
87 .byte 0 # End Of Children Mark
91 .long .Lcu_end1-.Lcu_start1 # Length of Unit
93 .short 4 # DWARF version number
94 .long .Lsection_abbrev # Offset Into Abbrev. Section
95 .byte 8 # Address Size (in bytes)
96 .byte 1 # Abbrev [1] DW_TAG_compile_unit
97 .long .Lstring_producer # DW_AT_producer
98 .short 12 # DW_AT_language
100 .byte 2 # Abbrev [2] DW_TAG_subprogram
101 .long .Lstring_foo # DW_AT_name
104 .byte 5 # Abbrev [2] DW_TAG_variable
105 .long .Lstring_bar # DW_AT_name
106 .long .Lstring_bar_mangled # DW_AT_linkage_name
107 .byte 0 # End Of Children Mark
111 .section .debug_names,"",@progbits
112 .long .Lnames_end0-.Lnames_start0 # Header: contribution length
114 .short 5 # Header: version
115 .short 0 # Header: padding
116 .long 2 # Header: compilation unit count
117 .long 0 # Header: local type unit count
118 .long 0 # Header: foreign type unit count
119 .long 0 # Header: bucket count
120 .long 4 # Header: name count
121 .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size
122 .long 0 # Header: augmentation length
123 .long .Lcu_begin0 # Compilation unit 0
124 .long .Lcu_begin1 # Compilation unit 1
125 .long .Lstring_foo+1000 # String 1: <broken>
126 .long .Lstring_foo # String 2: foo
127 .long .Lstring_bar # String 3: bar
128 .long .Lstring_pseudo_namespace # String 4: (pseudonymous namespace)
129 .long .Lnames0-.Lnames_entries0 # Offset 1
130 .long .Lnames0-.Lnames_entries0 # Offset 2
131 .long .Lnames1-.Lnames_entries0 # Offset 3
132 .long .Lnames2-.Lnames_entries0 # Offset 4
133 .Lnames_abbrev_start0:
134 .byte 46 # Abbrev code
135 .byte 46 # DW_TAG_subprogram
136 .byte 1 # DW_IDX_compile_unit
137 .byte 11 # DW_FORM_data1
138 .byte 3 # DW_IDX_die_offset
139 .byte 19 # DW_FORM_ref4
140 .byte 0 # End of abbrev
141 .byte 0 # End of abbrev
142 .byte 57 # Abbrev code
143 .byte 57 # DW_TAG_namespace
144 .byte 1 # DW_IDX_compile_unit
145 .byte 11 # DW_FORM_data1
146 .byte 3 # DW_IDX_die_offset
147 .byte 19 # DW_FORM_ref4
148 .byte 0 # End of abbrev
149 .byte 0 # End of abbrev
150 .byte 52 # Abbrev code
151 .byte 52 # DW_TAG_variable
152 .byte 1 # DW_IDX_compile_unit
153 .byte 11 # DW_FORM_data1
154 .byte 3 # DW_IDX_die_offset
155 .byte 19 # DW_FORM_ref4
156 .byte 0 # End of abbrev
157 .byte 0 # End of abbrev
158 .byte 0 # End of abbrev list
162 .long 0 # End of list: bar
164 .byte 57 # Abbrev code
165 .byte 0 # DW_IDX_compile_unit
166 .long .Ldie_namespace-.Lcu_begin0 # DW_IDX_die_offset
167 .long 0 # End of list: (pseudonymous namespace)
169 .byte 46 # Abbrev code
170 .byte 47 # DW_IDX_compile_unit
171 .long .Ldie_foo-.Lcu_begin0 # DW_IDX_die_offset
172 .byte 46 # Abbrev code
173 .byte 0 # DW_IDX_compile_unit
174 .long .Ldie_foo-.Lcu_begin0+1000 # DW_IDX_die_offset
175 .byte 46 # Abbrev code
176 .byte 0 # DW_IDX_compile_unit
177 .long .Ldie_foo-.Lcu_begin0 # DW_IDX_die_offset
178 .byte 46 # Abbrev code
179 .byte 0 # DW_IDX_compile_unit
180 .long .Ldie_foo2-.Lcu_begin0 # DW_IDX_die_offset
181 .byte 46 # Abbrev code
182 .byte 0 # DW_IDX_compile_unit
183 .long .Ldie_foo_var-.Lcu_begin0 # DW_IDX_die_offset
184 .byte 52 # Abbrev code
185 .byte 1 # DW_IDX_compile_unit
186 .long .Ldie_bar_linkage-.Lcu_begin1 # DW_IDX_die_offset
187 #.long 0 # End of list deliberately missing