1# REQUIRES: system-linux 2 3# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o 4# RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q 5# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections 6# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt > %t.txt 7# RUN: llvm-dwarfdump --show-form --verbose --debug-names %t.bolt >> %t.txt 8# RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s 9 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_unit 13# 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 Index 18# POSTCHECK-NOT: "InnerState" 19 20## -g2 -O0 -fdebug-types-section -gpubnames 21## 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 .text 36 .file "main.cpp" 37 .globl main # -- Begin function main 38 .p2align 4, 0x90 39 .type main,@function 40main: # @main 41.Lfunc_begin0: 42 .file 0 "/DW_TAG_enumeration_type" "main.cpp" md5 0x2e8962f8ef4bf6eb6f8bd92966c0848b 43 .loc 0 10 0 # main.cpp:10:0 44 .cfi_startproc 45# %bb.0: # %entry 46 pushq %rbp 47 .cfi_def_cfa_offset 16 48 .cfi_offset %rbp, -16 49 movq %rsp, %rbp 50 .cfi_def_cfa_register %rbp 51 movl $0, -4(%rbp) 52.Ltmp0: 53 .loc 0 12 3 prologue_end # main.cpp:12:3 54 xorl %eax, %eax 55 .loc 0 12 3 epilogue_begin is_stmt 0 # main.cpp:12:3 56 popq %rbp 57 .cfi_def_cfa %rsp, 8 58 retq 59.Ltmp1: 60.Lfunc_end0: 61 .size main, .Lfunc_end0-main 62 .cfi_endproc 63 # -- End function 64 .section .debug_info,"G",@progbits,8822129917070965541,comdat 65.Ltu_begin0: 66 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 67.Ldebug_info_start0: 68 .short 5 # DWARF version number 69 .byte 2 # DWARF Unit Type 70 .byte 8 # Address Size (in bytes) 71 .long .debug_abbrev # Offset Into Abbrev. Section 72 .quad 8822129917070965541 # Type Signature 73 .long 37 # Type DIE Offset 74 .byte 1 # Abbrev [1] 0x18:0x2d DW_TAG_type_unit 75 .short 33 # DW_AT_language 76 .long .Lline_table_start0 # DW_AT_stmt_list 77 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base 78 .byte 2 # Abbrev [2] 0x23:0x1d DW_TAG_namespace 79 .byte 6 # DW_AT_name 80 .byte 3 # Abbrev [3] 0x25:0x1a DW_TAG_class_type 81 .byte 5 # DW_AT_calling_convention 82 .byte 10 # DW_AT_name 83 .byte 4 # DW_AT_byte_size 84 .byte 0 # DW_AT_decl_file 85 .byte 3 # DW_AT_decl_line 86 .byte 4 # Abbrev [4] 0x2b:0x6 DW_TAG_template_type_parameter 87 .long 64 # DW_AT_type 88 .byte 7 # DW_AT_name 89 .byte 5 # Abbrev [5] 0x31:0xa DW_TAG_member 90 .byte 8 # DW_AT_name 91 .long 59 # DW_AT_type 92 .byte 0 # DW_AT_decl_file 93 .byte 6 # DW_AT_decl_line 94 .byte 0 # DW_AT_data_member_location 95 .byte 1 # DW_AT_accessibility 96 # DW_ACCESS_public 97 .byte 6 # Abbrev [6] 0x3b:0x3 DW_TAG_enumeration_type 98 .byte 9 # DW_AT_name 99 .byte 4 # DW_AT_byte_size 100 # DW_AT_declaration 101 .byte 0 # End Of Children Mark 102 .byte 0 # End Of Children Mark 103 .byte 7 # Abbrev [7] 0x40:0x4 DW_TAG_base_type 104 .byte 4 # DW_AT_name 105 .byte 5 # DW_AT_encoding 106 .byte 4 # DW_AT_byte_size 107 .byte 0 # End Of Children Mark 108.Ldebug_info_end0: 109 .section .debug_abbrev,"",@progbits 110 .byte 1 # Abbreviation Code 111 .byte 65 # DW_TAG_type_unit 112 .byte 1 # DW_CHILDREN_yes 113 .byte 19 # DW_AT_language 114 .byte 5 # DW_FORM_data2 115 .byte 16 # DW_AT_stmt_list 116 .byte 23 # DW_FORM_sec_offset 117 .byte 114 # DW_AT_str_offsets_base 118 .byte 23 # DW_FORM_sec_offset 119 .byte 0 # EOM(1) 120 .byte 0 # EOM(2) 121 .byte 2 # Abbreviation Code 122 .byte 57 # DW_TAG_namespace 123 .byte 1 # DW_CHILDREN_yes 124 .byte 3 # DW_AT_name 125 .byte 37 # DW_FORM_strx1 126 .byte 0 # EOM(1) 127 .byte 0 # EOM(2) 128 .byte 3 # Abbreviation Code 129 .byte 2 # DW_TAG_class_type 130 .byte 1 # DW_CHILDREN_yes 131 .byte 54 # DW_AT_calling_convention 132 .byte 11 # DW_FORM_data1 133 .byte 3 # DW_AT_name 134 .byte 37 # DW_FORM_strx1 135 .byte 11 # DW_AT_byte_size 136 .byte 11 # DW_FORM_data1 137 .byte 58 # DW_AT_decl_file 138 .byte 11 # DW_FORM_data1 139 .byte 59 # DW_AT_decl_line 140 .byte 11 # DW_FORM_data1 141 .byte 0 # EOM(1) 142 .byte 0 # EOM(2) 143 .byte 4 # Abbreviation Code 144 .byte 47 # DW_TAG_template_type_parameter 145 .byte 0 # DW_CHILDREN_no 146 .byte 73 # DW_AT_type 147 .byte 19 # DW_FORM_ref4 148 .byte 3 # DW_AT_name 149 .byte 37 # DW_FORM_strx1 150 .byte 0 # EOM(1) 151 .byte 0 # EOM(2) 152 .byte 5 # Abbreviation Code 153 .byte 13 # DW_TAG_member 154 .byte 0 # DW_CHILDREN_no 155 .byte 3 # DW_AT_name 156 .byte 37 # DW_FORM_strx1 157 .byte 73 # DW_AT_type 158 .byte 19 # DW_FORM_ref4 159 .byte 58 # DW_AT_decl_file 160 .byte 11 # DW_FORM_data1 161 .byte 59 # DW_AT_decl_line 162 .byte 11 # DW_FORM_data1 163 .byte 56 # DW_AT_data_member_location 164 .byte 11 # DW_FORM_data1 165 .byte 50 # DW_AT_accessibility 166 .byte 11 # DW_FORM_data1 167 .byte 0 # EOM(1) 168 .byte 0 # EOM(2) 169 .byte 6 # Abbreviation Code 170 .byte 4 # DW_TAG_enumeration_type 171 .byte 0 # DW_CHILDREN_no 172 .byte 3 # DW_AT_name 173 .byte 37 # DW_FORM_strx1 174 .byte 11 # DW_AT_byte_size 175 .byte 11 # DW_FORM_data1 176 .byte 60 # DW_AT_declaration 177 .byte 25 # DW_FORM_flag_present 178 .byte 0 # EOM(1) 179 .byte 0 # EOM(2) 180 .byte 7 # Abbreviation Code 181 .byte 36 # DW_TAG_base_type 182 .byte 0 # DW_CHILDREN_no 183 .byte 3 # DW_AT_name 184 .byte 37 # DW_FORM_strx1 185 .byte 62 # DW_AT_encoding 186 .byte 11 # DW_FORM_data1 187 .byte 11 # DW_AT_byte_size 188 .byte 11 # DW_FORM_data1 189 .byte 0 # EOM(1) 190 .byte 0 # EOM(2) 191 .byte 8 # Abbreviation Code 192 .byte 17 # DW_TAG_compile_unit 193 .byte 1 # DW_CHILDREN_yes 194 .byte 37 # DW_AT_producer 195 .byte 37 # DW_FORM_strx1 196 .byte 19 # DW_AT_language 197 .byte 5 # DW_FORM_data2 198 .byte 3 # DW_AT_name 199 .byte 37 # DW_FORM_strx1 200 .byte 114 # DW_AT_str_offsets_base 201 .byte 23 # DW_FORM_sec_offset 202 .byte 16 # DW_AT_stmt_list 203 .byte 23 # DW_FORM_sec_offset 204 .byte 27 # DW_AT_comp_dir 205 .byte 37 # DW_FORM_strx1 206 .byte 17 # DW_AT_low_pc 207 .byte 27 # DW_FORM_addrx 208 .byte 18 # DW_AT_high_pc 209 .byte 6 # DW_FORM_data4 210 .byte 115 # DW_AT_addr_base 211 .byte 23 # DW_FORM_sec_offset 212 .byte 0 # EOM(1) 213 .byte 0 # EOM(2) 214 .byte 9 # Abbreviation Code 215 .byte 46 # DW_TAG_subprogram 216 .byte 1 # DW_CHILDREN_yes 217 .byte 17 # DW_AT_low_pc 218 .byte 27 # DW_FORM_addrx 219 .byte 18 # DW_AT_high_pc 220 .byte 6 # DW_FORM_data4 221 .byte 64 # DW_AT_frame_base 222 .byte 24 # DW_FORM_exprloc 223 .byte 3 # DW_AT_name 224 .byte 37 # DW_FORM_strx1 225 .byte 58 # DW_AT_decl_file 226 .byte 11 # DW_FORM_data1 227 .byte 59 # DW_AT_decl_line 228 .byte 11 # DW_FORM_data1 229 .byte 73 # DW_AT_type 230 .byte 19 # DW_FORM_ref4 231 .byte 63 # DW_AT_external 232 .byte 25 # DW_FORM_flag_present 233 .byte 0 # EOM(1) 234 .byte 0 # EOM(2) 235 .byte 10 # Abbreviation Code 236 .byte 52 # DW_TAG_variable 237 .byte 0 # DW_CHILDREN_no 238 .byte 2 # DW_AT_location 239 .byte 24 # DW_FORM_exprloc 240 .byte 3 # DW_AT_name 241 .byte 37 # DW_FORM_strx1 242 .byte 58 # DW_AT_decl_file 243 .byte 11 # DW_FORM_data1 244 .byte 59 # DW_AT_decl_line 245 .byte 11 # DW_FORM_data1 246 .byte 73 # DW_AT_type 247 .byte 19 # DW_FORM_ref4 248 .byte 0 # EOM(1) 249 .byte 0 # EOM(2) 250 .byte 11 # Abbreviation Code 251 .byte 2 # DW_TAG_class_type 252 .byte 0 # DW_CHILDREN_no 253 .byte 60 # DW_AT_declaration 254 .byte 25 # DW_FORM_flag_present 255 .byte 105 # DW_AT_signature 256 .byte 32 # DW_FORM_ref_sig8 257 .byte 0 # EOM(1) 258 .byte 0 # EOM(2) 259 .byte 0 # EOM(3) 260 .section .debug_info,"",@progbits 261.Lcu_begin0: 262 .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit 263.Ldebug_info_start1: 264 .short 5 # DWARF version number 265 .byte 1 # DWARF Unit Type 266 .byte 8 # Address Size (in bytes) 267 .long .debug_abbrev # Offset Into Abbrev. Section 268 .byte 8 # Abbrev [8] 0xc:0x43 DW_TAG_compile_unit 269 .byte 0 # DW_AT_producer 270 .short 33 # DW_AT_language 271 .byte 1 # DW_AT_name 272 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base 273 .long .Lline_table_start0 # DW_AT_stmt_list 274 .byte 2 # DW_AT_comp_dir 275 .byte 0 # DW_AT_low_pc 276 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc 277 .long .Laddr_table_base0 # DW_AT_addr_base 278 .byte 9 # Abbrev [9] 0x23:0x1b DW_TAG_subprogram 279 .byte 0 # DW_AT_low_pc 280 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc 281 .byte 1 # DW_AT_frame_base 282 .byte 86 283 .byte 3 # DW_AT_name 284 .byte 0 # DW_AT_decl_file 285 .byte 10 # DW_AT_decl_line 286 .long 62 # DW_AT_type 287 # DW_AT_external 288 .byte 10 # Abbrev [10] 0x32:0xb DW_TAG_variable 289 .byte 2 # DW_AT_location 290 .byte 145 291 .byte 120 292 .byte 5 # DW_AT_name 293 .byte 0 # DW_AT_decl_file 294 .byte 11 # DW_AT_decl_line 295 .long 68 # DW_AT_type 296 .byte 0 # End Of Children Mark 297 .byte 7 # Abbrev [7] 0x3e:0x4 DW_TAG_base_type 298 .byte 4 # DW_AT_name 299 .byte 5 # DW_AT_encoding 300 .byte 4 # DW_AT_byte_size 301 .byte 2 # Abbrev [2] 0x42:0xc DW_TAG_namespace 302 .byte 6 # DW_AT_name 303 .byte 11 # Abbrev [11] 0x44:0x9 DW_TAG_class_type 304 # DW_AT_declaration 305 .quad 8822129917070965541 # DW_AT_signature 306 .byte 0 # End Of Children Mark 307 .byte 0 # End Of Children Mark 308.Ldebug_info_end1: 309 .section .debug_str_offsets,"",@progbits 310 .long 48 # Length of String Offsets Set 311 .short 5 312 .short 0 313.Lstr_offsets_base0: 314 .section .debug_str,"MS",@progbits,1 315.Linfo_string0: 316 .asciz "clang version 19.0.0git" # string offset=0 317.Linfo_string1: 318 .asciz "main.cpp" # string offset=24 319.Linfo_string2: 320 .asciz "/home/ayermolo/local/tasks/T190087639/DW_TAG_enumeration_type" # string offset=33 321.Linfo_string3: 322 .asciz "main" # string offset=95 323.Linfo_string4: 324 .asciz "int" # string offset=100 325.Linfo_string5: 326 .asciz "S" # string offset=104 327.Linfo_string6: 328 .asciz "B" # string offset=106 329.Linfo_string7: 330 .asciz "Task" # string offset=108 331.Linfo_string8: 332 .asciz "St" # string offset=113 333.Linfo_string9: 334 .asciz "InnerState" # string offset=116 335.Linfo_string10: 336 .asciz "State<int>" # string offset=127 337 .section .debug_str_offsets,"",@progbits 338 .long .Linfo_string0 339 .long .Linfo_string1 340 .long .Linfo_string2 341 .long .Linfo_string3 342 .long .Linfo_string4 343 .long .Linfo_string5 344 .long .Linfo_string6 345 .long .Linfo_string7 346 .long .Linfo_string8 347 .long .Linfo_string9 348 .long .Linfo_string10 349 .section .debug_addr,"",@progbits 350 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution 351.Ldebug_addr_start0: 352 .short 5 # DWARF version number 353 .byte 8 # Address size 354 .byte 0 # Segment selector size 355.Laddr_table_base0: 356 .quad .Lfunc_begin0 357.Ldebug_addr_end0: 358 .section .debug_names,"",@progbits 359 .long .Lnames_end0-.Lnames_start0 # Header: unit length 360.Lnames_start0: 361 .short 5 # Header: version 362 .short 0 # Header: padding 363 .long 1 # Header: compilation unit count 364 .long 1 # Header: local type unit count 365 .long 0 # Header: foreign type unit count 366 .long 4 # Header: bucket count 367 .long 4 # Header: name count 368 .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size 369 .long 8 # Header: augmentation string size 370 .ascii "LLVM0700" # Header: augmentation string 371 .long .Lcu_begin0 # Compilation unit 0 372 .long .Ltu_begin0 # Type unit 0 373 .long 1 # Bucket 0 374 .long 0 # Bucket 1 375 .long 2 # Bucket 2 376 .long 3 # Bucket 3 377 .long 193495088 # Hash in Bucket 0 378 .long 2090499946 # Hash in Bucket 2 379 .long 177671 # Hash in Bucket 3 380 .long 624407275 # Hash in Bucket 3 381 .long .Linfo_string4 # String in Bucket 0: int 382 .long .Linfo_string3 # String in Bucket 2: main 383 .long .Linfo_string6 # String in Bucket 3: B 384 .long .Linfo_string10 # String in Bucket 3: State<int> 385 .long .Lnames1-.Lnames_entries0 # Offset in Bucket 0 386 .long .Lnames0-.Lnames_entries0 # Offset in Bucket 2 387 .long .Lnames2-.Lnames_entries0 # Offset in Bucket 3 388 .long .Lnames3-.Lnames_entries0 # Offset in Bucket 3 389.Lnames_abbrev_start0: 390 .byte 1 # Abbrev code 391 .byte 36 # DW_TAG_base_type 392 .byte 3 # DW_IDX_die_offset 393 .byte 19 # DW_FORM_ref4 394 .byte 4 # DW_IDX_parent 395 .byte 25 # DW_FORM_flag_present 396 .byte 0 # End of abbrev 397 .byte 0 # End of abbrev 398 .byte 2 # Abbrev code 399 .byte 36 # DW_TAG_base_type 400 .byte 2 # DW_IDX_type_unit 401 .byte 11 # DW_FORM_data1 402 .byte 3 # DW_IDX_die_offset 403 .byte 19 # DW_FORM_ref4 404 .byte 4 # DW_IDX_parent 405 .byte 25 # DW_FORM_flag_present 406 .byte 0 # End of abbrev 407 .byte 0 # End of abbrev 408 .byte 3 # Abbrev code 409 .byte 46 # DW_TAG_subprogram 410 .byte 3 # DW_IDX_die_offset 411 .byte 19 # DW_FORM_ref4 412 .byte 4 # DW_IDX_parent 413 .byte 25 # DW_FORM_flag_present 414 .byte 0 # End of abbrev 415 .byte 0 # End of abbrev 416 .byte 4 # Abbrev code 417 .byte 57 # DW_TAG_namespace 418 .byte 2 # DW_IDX_type_unit 419 .byte 11 # DW_FORM_data1 420 .byte 3 # DW_IDX_die_offset 421 .byte 19 # DW_FORM_ref4 422 .byte 4 # DW_IDX_parent 423 .byte 25 # DW_FORM_flag_present 424 .byte 0 # End of abbrev 425 .byte 0 # End of abbrev 426 .byte 5 # Abbrev code 427 .byte 57 # DW_TAG_namespace 428 .byte 3 # DW_IDX_die_offset 429 .byte 19 # DW_FORM_ref4 430 .byte 4 # DW_IDX_parent 431 .byte 25 # DW_FORM_flag_present 432 .byte 0 # End of abbrev 433 .byte 0 # End of abbrev 434 .byte 6 # Abbrev code 435 .byte 2 # DW_TAG_class_type 436 .byte 2 # DW_IDX_type_unit 437 .byte 11 # DW_FORM_data1 438 .byte 3 # DW_IDX_die_offset 439 .byte 19 # DW_FORM_ref4 440 .byte 4 # DW_IDX_parent 441 .byte 19 # DW_FORM_ref4 442 .byte 0 # End of abbrev 443 .byte 0 # End of abbrev 444 .byte 0 # End of abbrev list 445.Lnames_abbrev_end0: 446.Lnames_entries0: 447.Lnames1: 448.L0: 449 .byte 1 # Abbreviation code 450 .long 62 # DW_IDX_die_offset 451.L2: # DW_IDX_parent 452 .byte 2 # Abbreviation code 453 .byte 0 # DW_IDX_type_unit 454 .long 64 # DW_IDX_die_offset 455 .byte 0 # DW_IDX_parent 456 # End of list: int 457.Lnames0: 458.L3: 459 .byte 3 # Abbreviation code 460 .long 35 # DW_IDX_die_offset 461 .byte 0 # DW_IDX_parent 462 # End of list: main 463.Lnames2: 464 .byte 4 # Abbreviation code 465 .byte 0 # DW_IDX_type_unit 466 .long 35 # DW_IDX_die_offset 467.L1: # DW_IDX_parent 468 .byte 5 # Abbreviation code 469 .long 66 # DW_IDX_die_offset 470 .byte 0 # DW_IDX_parent 471 # End of list: B 472.Lnames3: 473.L4: 474 .byte 6 # Abbreviation code 475 .byte 0 # DW_IDX_type_unit 476 .long 37 # DW_IDX_die_offset 477 .long .L3-.Lnames_entries0 # DW_IDX_parent 478 .byte 0 # End of list: State<int> 479 .p2align 2, 0x0 480.Lnames_end0: 481 .ident "clang version 19.0.0git" 482 .section ".note.GNU-stack","",@progbits 483 .addrsig 484 .section .debug_line,"",@progbits 485.Lline_table_start0: 486