486 lines · plain
1# REQUIRES: system-linux2 3# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o4# RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q5# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections6# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt > %t.txt7# RUN: llvm-dwarfdump --show-form --verbose --debug-names %t.bolt >> %t.txt8# RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s9 10## This tests that BOLT doesn't generate entry for a DW_TAG_enumeration_type declaration with DW_AT_name.11 12# POSTCHECK: DW_TAG_type_unit13# POSTCHECK: DW_TAG_enumeration_type [6]14# POSTCHECK-NEXT: DW_AT_name [DW_FORM_strx1] (indexed (00000009) string = "InnerState")15# POSTCHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x04)16# POSTCHECK-NEXT: DW_AT_declaration [DW_FORM_flag_present] (true)17# POSTCHECK: Name Index18# POSTCHECK-NOT: "InnerState"19 20## -g2 -O0 -fdebug-types-section -gpubnames21## namespace B {22## template <typename Task>23## class State {24## public:25## enum class InnerState { STATE0 };26## InnerState St;27## };28## }29##30## int main() {31## B::State<int> S;32## return 0;33## }34 35 .text36 .file "main.cpp"37 .globl main # -- Begin function main38 .p2align 4, 0x9039 .type main,@function40main: # @main41.Lfunc_begin0:42 .file 0 "/DW_TAG_enumeration_type" "main.cpp" md5 0x2e8962f8ef4bf6eb6f8bd92966c0848b43 .loc 0 10 0 # main.cpp:10:044 .cfi_startproc45# %bb.0: # %entry46 pushq %rbp47 .cfi_def_cfa_offset 1648 .cfi_offset %rbp, -1649 movq %rsp, %rbp50 .cfi_def_cfa_register %rbp51 movl $0, -4(%rbp)52.Ltmp0:53 .loc 0 12 3 prologue_end # main.cpp:12:354 xorl %eax, %eax55 .loc 0 12 3 epilogue_begin is_stmt 0 # main.cpp:12:356 popq %rbp57 .cfi_def_cfa %rsp, 858 retq59.Ltmp1:60.Lfunc_end0:61 .size main, .Lfunc_end0-main62 .cfi_endproc63 # -- End function64 .section .debug_info,"G",@progbits,8822129917070965541,comdat65.Ltu_begin0:66 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit67.Ldebug_info_start0:68 .short 5 # DWARF version number69 .byte 2 # DWARF Unit Type70 .byte 8 # Address Size (in bytes)71 .long .debug_abbrev # Offset Into Abbrev. Section72 .quad 8822129917070965541 # Type Signature73 .long 37 # Type DIE Offset74 .byte 1 # Abbrev [1] 0x18:0x2d DW_TAG_type_unit75 .short 33 # DW_AT_language76 .long .Lline_table_start0 # DW_AT_stmt_list77 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base78 .byte 2 # Abbrev [2] 0x23:0x1d DW_TAG_namespace79 .byte 6 # DW_AT_name80 .byte 3 # Abbrev [3] 0x25:0x1a DW_TAG_class_type81 .byte 5 # DW_AT_calling_convention82 .byte 10 # DW_AT_name83 .byte 4 # DW_AT_byte_size84 .byte 0 # DW_AT_decl_file85 .byte 3 # DW_AT_decl_line86 .byte 4 # Abbrev [4] 0x2b:0x6 DW_TAG_template_type_parameter87 .long 64 # DW_AT_type88 .byte 7 # DW_AT_name89 .byte 5 # Abbrev [5] 0x31:0xa DW_TAG_member90 .byte 8 # DW_AT_name91 .long 59 # DW_AT_type92 .byte 0 # DW_AT_decl_file93 .byte 6 # DW_AT_decl_line94 .byte 0 # DW_AT_data_member_location95 .byte 1 # DW_AT_accessibility96 # DW_ACCESS_public97 .byte 6 # Abbrev [6] 0x3b:0x3 DW_TAG_enumeration_type98 .byte 9 # DW_AT_name99 .byte 4 # DW_AT_byte_size100 # DW_AT_declaration101 .byte 0 # End Of Children Mark102 .byte 0 # End Of Children Mark103 .byte 7 # Abbrev [7] 0x40:0x4 DW_TAG_base_type104 .byte 4 # DW_AT_name105 .byte 5 # DW_AT_encoding106 .byte 4 # DW_AT_byte_size107 .byte 0 # End Of Children Mark108.Ldebug_info_end0:109 .section .debug_abbrev,"",@progbits110 .byte 1 # Abbreviation Code111 .byte 65 # DW_TAG_type_unit112 .byte 1 # DW_CHILDREN_yes113 .byte 19 # DW_AT_language114 .byte 5 # DW_FORM_data2115 .byte 16 # DW_AT_stmt_list116 .byte 23 # DW_FORM_sec_offset117 .byte 114 # DW_AT_str_offsets_base118 .byte 23 # DW_FORM_sec_offset119 .byte 0 # EOM(1)120 .byte 0 # EOM(2)121 .byte 2 # Abbreviation Code122 .byte 57 # DW_TAG_namespace123 .byte 1 # DW_CHILDREN_yes124 .byte 3 # DW_AT_name125 .byte 37 # DW_FORM_strx1126 .byte 0 # EOM(1)127 .byte 0 # EOM(2)128 .byte 3 # Abbreviation Code129 .byte 2 # DW_TAG_class_type130 .byte 1 # DW_CHILDREN_yes131 .byte 54 # DW_AT_calling_convention132 .byte 11 # DW_FORM_data1133 .byte 3 # DW_AT_name134 .byte 37 # DW_FORM_strx1135 .byte 11 # DW_AT_byte_size136 .byte 11 # DW_FORM_data1137 .byte 58 # DW_AT_decl_file138 .byte 11 # DW_FORM_data1139 .byte 59 # DW_AT_decl_line140 .byte 11 # DW_FORM_data1141 .byte 0 # EOM(1)142 .byte 0 # EOM(2)143 .byte 4 # Abbreviation Code144 .byte 47 # DW_TAG_template_type_parameter145 .byte 0 # DW_CHILDREN_no146 .byte 73 # DW_AT_type147 .byte 19 # DW_FORM_ref4148 .byte 3 # DW_AT_name149 .byte 37 # DW_FORM_strx1150 .byte 0 # EOM(1)151 .byte 0 # EOM(2)152 .byte 5 # Abbreviation Code153 .byte 13 # DW_TAG_member154 .byte 0 # DW_CHILDREN_no155 .byte 3 # DW_AT_name156 .byte 37 # DW_FORM_strx1157 .byte 73 # DW_AT_type158 .byte 19 # DW_FORM_ref4159 .byte 58 # DW_AT_decl_file160 .byte 11 # DW_FORM_data1161 .byte 59 # DW_AT_decl_line162 .byte 11 # DW_FORM_data1163 .byte 56 # DW_AT_data_member_location164 .byte 11 # DW_FORM_data1165 .byte 50 # DW_AT_accessibility166 .byte 11 # DW_FORM_data1167 .byte 0 # EOM(1)168 .byte 0 # EOM(2)169 .byte 6 # Abbreviation Code170 .byte 4 # DW_TAG_enumeration_type171 .byte 0 # DW_CHILDREN_no172 .byte 3 # DW_AT_name173 .byte 37 # DW_FORM_strx1174 .byte 11 # DW_AT_byte_size175 .byte 11 # DW_FORM_data1176 .byte 60 # DW_AT_declaration177 .byte 25 # DW_FORM_flag_present178 .byte 0 # EOM(1)179 .byte 0 # EOM(2)180 .byte 7 # Abbreviation Code181 .byte 36 # DW_TAG_base_type182 .byte 0 # DW_CHILDREN_no183 .byte 3 # DW_AT_name184 .byte 37 # DW_FORM_strx1185 .byte 62 # DW_AT_encoding186 .byte 11 # DW_FORM_data1187 .byte 11 # DW_AT_byte_size188 .byte 11 # DW_FORM_data1189 .byte 0 # EOM(1)190 .byte 0 # EOM(2)191 .byte 8 # Abbreviation Code192 .byte 17 # DW_TAG_compile_unit193 .byte 1 # DW_CHILDREN_yes194 .byte 37 # DW_AT_producer195 .byte 37 # DW_FORM_strx1196 .byte 19 # DW_AT_language197 .byte 5 # DW_FORM_data2198 .byte 3 # DW_AT_name199 .byte 37 # DW_FORM_strx1200 .byte 114 # DW_AT_str_offsets_base201 .byte 23 # DW_FORM_sec_offset202 .byte 16 # DW_AT_stmt_list203 .byte 23 # DW_FORM_sec_offset204 .byte 27 # DW_AT_comp_dir205 .byte 37 # DW_FORM_strx1206 .byte 17 # DW_AT_low_pc207 .byte 27 # DW_FORM_addrx208 .byte 18 # DW_AT_high_pc209 .byte 6 # DW_FORM_data4210 .byte 115 # DW_AT_addr_base211 .byte 23 # DW_FORM_sec_offset212 .byte 0 # EOM(1)213 .byte 0 # EOM(2)214 .byte 9 # Abbreviation Code215 .byte 46 # DW_TAG_subprogram216 .byte 1 # DW_CHILDREN_yes217 .byte 17 # DW_AT_low_pc218 .byte 27 # DW_FORM_addrx219 .byte 18 # DW_AT_high_pc220 .byte 6 # DW_FORM_data4221 .byte 64 # DW_AT_frame_base222 .byte 24 # DW_FORM_exprloc223 .byte 3 # DW_AT_name224 .byte 37 # DW_FORM_strx1225 .byte 58 # DW_AT_decl_file226 .byte 11 # DW_FORM_data1227 .byte 59 # DW_AT_decl_line228 .byte 11 # DW_FORM_data1229 .byte 73 # DW_AT_type230 .byte 19 # DW_FORM_ref4231 .byte 63 # DW_AT_external232 .byte 25 # DW_FORM_flag_present233 .byte 0 # EOM(1)234 .byte 0 # EOM(2)235 .byte 10 # Abbreviation Code236 .byte 52 # DW_TAG_variable237 .byte 0 # DW_CHILDREN_no238 .byte 2 # DW_AT_location239 .byte 24 # DW_FORM_exprloc240 .byte 3 # DW_AT_name241 .byte 37 # DW_FORM_strx1242 .byte 58 # DW_AT_decl_file243 .byte 11 # DW_FORM_data1244 .byte 59 # DW_AT_decl_line245 .byte 11 # DW_FORM_data1246 .byte 73 # DW_AT_type247 .byte 19 # DW_FORM_ref4248 .byte 0 # EOM(1)249 .byte 0 # EOM(2)250 .byte 11 # Abbreviation Code251 .byte 2 # DW_TAG_class_type252 .byte 0 # DW_CHILDREN_no253 .byte 60 # DW_AT_declaration254 .byte 25 # DW_FORM_flag_present255 .byte 105 # DW_AT_signature256 .byte 32 # DW_FORM_ref_sig8257 .byte 0 # EOM(1)258 .byte 0 # EOM(2)259 .byte 0 # EOM(3)260 .section .debug_info,"",@progbits261.Lcu_begin0:262 .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit263.Ldebug_info_start1:264 .short 5 # DWARF version number265 .byte 1 # DWARF Unit Type266 .byte 8 # Address Size (in bytes)267 .long .debug_abbrev # Offset Into Abbrev. Section268 .byte 8 # Abbrev [8] 0xc:0x43 DW_TAG_compile_unit269 .byte 0 # DW_AT_producer270 .short 33 # DW_AT_language271 .byte 1 # DW_AT_name272 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base273 .long .Lline_table_start0 # DW_AT_stmt_list274 .byte 2 # DW_AT_comp_dir275 .byte 0 # DW_AT_low_pc276 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc277 .long .Laddr_table_base0 # DW_AT_addr_base278 .byte 9 # Abbrev [9] 0x23:0x1b DW_TAG_subprogram279 .byte 0 # DW_AT_low_pc280 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc281 .byte 1 # DW_AT_frame_base282 .byte 86283 .byte 3 # DW_AT_name284 .byte 0 # DW_AT_decl_file285 .byte 10 # DW_AT_decl_line286 .long 62 # DW_AT_type287 # DW_AT_external288 .byte 10 # Abbrev [10] 0x32:0xb DW_TAG_variable289 .byte 2 # DW_AT_location290 .byte 145291 .byte 120292 .byte 5 # DW_AT_name293 .byte 0 # DW_AT_decl_file294 .byte 11 # DW_AT_decl_line295 .long 68 # DW_AT_type296 .byte 0 # End Of Children Mark297 .byte 7 # Abbrev [7] 0x3e:0x4 DW_TAG_base_type298 .byte 4 # DW_AT_name299 .byte 5 # DW_AT_encoding300 .byte 4 # DW_AT_byte_size301 .byte 2 # Abbrev [2] 0x42:0xc DW_TAG_namespace302 .byte 6 # DW_AT_name303 .byte 11 # Abbrev [11] 0x44:0x9 DW_TAG_class_type304 # DW_AT_declaration305 .quad 8822129917070965541 # DW_AT_signature306 .byte 0 # End Of Children Mark307 .byte 0 # End Of Children Mark308.Ldebug_info_end1:309 .section .debug_str_offsets,"",@progbits310 .long 48 # Length of String Offsets Set311 .short 5312 .short 0313.Lstr_offsets_base0:314 .section .debug_str,"MS",@progbits,1315.Linfo_string0:316 .asciz "clang version 19.0.0git" # string offset=0317.Linfo_string1:318 .asciz "main.cpp" # string offset=24319.Linfo_string2:320 .asciz "/home/ayermolo/local/tasks/T190087639/DW_TAG_enumeration_type" # string offset=33321.Linfo_string3:322 .asciz "main" # string offset=95323.Linfo_string4:324 .asciz "int" # string offset=100325.Linfo_string5:326 .asciz "S" # string offset=104327.Linfo_string6:328 .asciz "B" # string offset=106329.Linfo_string7:330 .asciz "Task" # string offset=108331.Linfo_string8:332 .asciz "St" # string offset=113333.Linfo_string9:334 .asciz "InnerState" # string offset=116335.Linfo_string10:336 .asciz "State<int>" # string offset=127337 .section .debug_str_offsets,"",@progbits338 .long .Linfo_string0339 .long .Linfo_string1340 .long .Linfo_string2341 .long .Linfo_string3342 .long .Linfo_string4343 .long .Linfo_string5344 .long .Linfo_string6345 .long .Linfo_string7346 .long .Linfo_string8347 .long .Linfo_string9348 .long .Linfo_string10349 .section .debug_addr,"",@progbits350 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution351.Ldebug_addr_start0:352 .short 5 # DWARF version number353 .byte 8 # Address size354 .byte 0 # Segment selector size355.Laddr_table_base0:356 .quad .Lfunc_begin0357.Ldebug_addr_end0:358 .section .debug_names,"",@progbits359 .long .Lnames_end0-.Lnames_start0 # Header: unit length360.Lnames_start0:361 .short 5 # Header: version362 .short 0 # Header: padding363 .long 1 # Header: compilation unit count364 .long 1 # Header: local type unit count365 .long 0 # Header: foreign type unit count366 .long 4 # Header: bucket count367 .long 4 # Header: name count368 .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size369 .long 8 # Header: augmentation string size370 .ascii "LLVM0700" # Header: augmentation string371 .long .Lcu_begin0 # Compilation unit 0372 .long .Ltu_begin0 # Type unit 0373 .long 1 # Bucket 0374 .long 0 # Bucket 1375 .long 2 # Bucket 2376 .long 3 # Bucket 3377 .long 193495088 # Hash in Bucket 0378 .long 2090499946 # Hash in Bucket 2379 .long 177671 # Hash in Bucket 3380 .long 624407275 # Hash in Bucket 3381 .long .Linfo_string4 # String in Bucket 0: int382 .long .Linfo_string3 # String in Bucket 2: main383 .long .Linfo_string6 # String in Bucket 3: B384 .long .Linfo_string10 # String in Bucket 3: State<int>385 .long .Lnames1-.Lnames_entries0 # Offset in Bucket 0386 .long .Lnames0-.Lnames_entries0 # Offset in Bucket 2387 .long .Lnames2-.Lnames_entries0 # Offset in Bucket 3388 .long .Lnames3-.Lnames_entries0 # Offset in Bucket 3389.Lnames_abbrev_start0:390 .byte 1 # Abbrev code391 .byte 36 # DW_TAG_base_type392 .byte 3 # DW_IDX_die_offset393 .byte 19 # DW_FORM_ref4394 .byte 4 # DW_IDX_parent395 .byte 25 # DW_FORM_flag_present396 .byte 0 # End of abbrev397 .byte 0 # End of abbrev398 .byte 2 # Abbrev code399 .byte 36 # DW_TAG_base_type400 .byte 2 # DW_IDX_type_unit401 .byte 11 # DW_FORM_data1402 .byte 3 # DW_IDX_die_offset403 .byte 19 # DW_FORM_ref4404 .byte 4 # DW_IDX_parent405 .byte 25 # DW_FORM_flag_present406 .byte 0 # End of abbrev407 .byte 0 # End of abbrev408 .byte 3 # Abbrev code409 .byte 46 # DW_TAG_subprogram410 .byte 3 # DW_IDX_die_offset411 .byte 19 # DW_FORM_ref4412 .byte 4 # DW_IDX_parent413 .byte 25 # DW_FORM_flag_present414 .byte 0 # End of abbrev415 .byte 0 # End of abbrev416 .byte 4 # Abbrev code417 .byte 57 # DW_TAG_namespace418 .byte 2 # DW_IDX_type_unit419 .byte 11 # DW_FORM_data1420 .byte 3 # DW_IDX_die_offset421 .byte 19 # DW_FORM_ref4422 .byte 4 # DW_IDX_parent423 .byte 25 # DW_FORM_flag_present424 .byte 0 # End of abbrev425 .byte 0 # End of abbrev426 .byte 5 # Abbrev code427 .byte 57 # DW_TAG_namespace428 .byte 3 # DW_IDX_die_offset429 .byte 19 # DW_FORM_ref4430 .byte 4 # DW_IDX_parent431 .byte 25 # DW_FORM_flag_present432 .byte 0 # End of abbrev433 .byte 0 # End of abbrev434 .byte 6 # Abbrev code435 .byte 2 # DW_TAG_class_type436 .byte 2 # DW_IDX_type_unit437 .byte 11 # DW_FORM_data1438 .byte 3 # DW_IDX_die_offset439 .byte 19 # DW_FORM_ref4440 .byte 4 # DW_IDX_parent441 .byte 19 # DW_FORM_ref4442 .byte 0 # End of abbrev443 .byte 0 # End of abbrev444 .byte 0 # End of abbrev list445.Lnames_abbrev_end0:446.Lnames_entries0:447.Lnames1:448.L0:449 .byte 1 # Abbreviation code450 .long 62 # DW_IDX_die_offset451.L2: # DW_IDX_parent452 .byte 2 # Abbreviation code453 .byte 0 # DW_IDX_type_unit454 .long 64 # DW_IDX_die_offset455 .byte 0 # DW_IDX_parent456 # End of list: int457.Lnames0:458.L3:459 .byte 3 # Abbreviation code460 .long 35 # DW_IDX_die_offset461 .byte 0 # DW_IDX_parent462 # End of list: main463.Lnames2:464 .byte 4 # Abbreviation code465 .byte 0 # DW_IDX_type_unit466 .long 35 # DW_IDX_die_offset467.L1: # DW_IDX_parent468 .byte 5 # Abbreviation code469 .long 66 # DW_IDX_die_offset470 .byte 0 # DW_IDX_parent471 # End of list: B472.Lnames3:473.L4:474 .byte 6 # Abbreviation code475 .byte 0 # DW_IDX_type_unit476 .long 37 # DW_IDX_die_offset477 .long .L3-.Lnames_entries0 # DW_IDX_parent478 .byte 0 # End of list: State<int>479 .p2align 2, 0x0480.Lnames_end0:481 .ident "clang version 19.0.0git"482 .section ".note.GNU-stack","",@progbits483 .addrsig484 .section .debug_line,"",@progbits485.Lline_table_start0:486