1# This tests a bug where we would incorrectly parse the size of an array if that 2# size happened to match an existing DIE offset. This happened because we 3# misinterpreted that value as a reference to a DIE specifying the VLA size even 4# though the form was a data form (as it should be). 5 6# REQUIRES: lld 7 8# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o 9# RUN: ld.lld %t.o -o %t 10# RUN: lldb-test symbols %t | FileCheck %s 11 12# CHECK: Variable{0x0000001e}, name = "X" 13# CHECK-SAME: type = {0000000000000033} 0x{{[0-9A-F]*}} (char[56]) 14 15 16# Generated from "char X[47];" 17# The array size was modified by hand. 18 19 .text 20 .file "-" 21 .file 1 "/tmp" "<stdin>" 22 .type X,@object # @X 23 .comm X,63,16 24 .section .debug_str,"MS",@progbits,1 25.Linfo_string0: 26 .asciz "clang version 8.0.0 (trunk 349604) (llvm/trunk 349608)" # string offset=0 27.Linfo_string1: 28 .asciz "-" # string offset=55 29.Linfo_string2: 30 .asciz "/tmp" # string offset=57 31.Linfo_string3: 32 .asciz "X" # string offset=62 33.Linfo_string4: 34 .asciz "char" # string offset=64 35.Linfo_string5: 36 .asciz "__ARRAY_SIZE_TYPE__" # string offset=69 37 .section .debug_abbrev,"",@progbits 38 .byte 1 # Abbreviation Code 39 .byte 17 # DW_TAG_compile_unit 40 .byte 1 # DW_CHILDREN_yes 41 .byte 37 # DW_AT_producer 42 .byte 14 # DW_FORM_strp 43 .byte 19 # DW_AT_language 44 .byte 5 # DW_FORM_data2 45 .byte 3 # DW_AT_name 46 .byte 14 # DW_FORM_strp 47 .byte 16 # DW_AT_stmt_list 48 .byte 23 # DW_FORM_sec_offset 49 .byte 27 # DW_AT_comp_dir 50 .byte 14 # DW_FORM_strp 51 .byte 0 # EOM(1) 52 .byte 0 # EOM(2) 53 .byte 2 # Abbreviation Code 54 .byte 52 # DW_TAG_variable 55 .byte 0 # DW_CHILDREN_no 56 .byte 3 # DW_AT_name 57 .byte 14 # DW_FORM_strp 58 .byte 73 # DW_AT_type 59 .byte 19 # DW_FORM_ref4 60 .byte 63 # DW_AT_external 61 .byte 25 # DW_FORM_flag_present 62 .byte 58 # DW_AT_decl_file 63 .byte 11 # DW_FORM_data1 64 .byte 59 # DW_AT_decl_line 65 .byte 11 # DW_FORM_data1 66 .byte 2 # DW_AT_location 67 .byte 24 # DW_FORM_exprloc 68 .byte 0 # EOM(1) 69 .byte 0 # EOM(2) 70 .byte 3 # Abbreviation Code 71 .byte 1 # DW_TAG_array_type 72 .byte 1 # DW_CHILDREN_yes 73 .byte 73 # DW_AT_type 74 .byte 19 # DW_FORM_ref4 75 .byte 0 # EOM(1) 76 .byte 0 # EOM(2) 77 .byte 4 # Abbreviation Code 78 .byte 33 # DW_TAG_subrange_type 79 .byte 0 # DW_CHILDREN_no 80 .byte 73 # DW_AT_type 81 .byte 19 # DW_FORM_ref4 82 .byte 55 # DW_AT_count 83 .byte 11 # DW_FORM_data1 84 .byte 0 # EOM(1) 85 .byte 0 # EOM(2) 86 .byte 5 # Abbreviation Code 87 .byte 36 # DW_TAG_base_type 88 .byte 0 # DW_CHILDREN_no 89 .byte 3 # DW_AT_name 90 .byte 14 # DW_FORM_strp 91 .byte 62 # DW_AT_encoding 92 .byte 11 # DW_FORM_data1 93 .byte 11 # DW_AT_byte_size 94 .byte 11 # DW_FORM_data1 95 .byte 0 # EOM(1) 96 .byte 0 # EOM(2) 97 .byte 6 # Abbreviation Code 98 .byte 36 # DW_TAG_base_type 99 .byte 0 # DW_CHILDREN_no 100 .byte 3 # DW_AT_name 101 .byte 14 # DW_FORM_strp 102 .byte 11 # DW_AT_byte_size 103 .byte 11 # DW_FORM_data1 104 .byte 62 # DW_AT_encoding 105 .byte 11 # DW_FORM_data1 106 .byte 0 # EOM(1) 107 .byte 0 # EOM(2) 108 .byte 0 # EOM(3) 109 .section .debug_info,"",@progbits 110.Lcu_begin0: 111 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 112.Ldebug_info_start0: 113 .short 4 # DWARF version number 114 .long .debug_abbrev # Offset Into Abbrev. Section 115 .byte 8 # Address Size (in bytes) 116 .byte 1 # Abbrev [1] 0xb:0x43 DW_TAG_compile_unit 117 .long .Linfo_string0 # DW_AT_producer 118 .short 12 # DW_AT_language 119 .long .Linfo_string1 # DW_AT_name 120 .long 0 # DW_AT_stmt_list 121 .long .Linfo_string2 # DW_AT_comp_dir 122 .byte 2 # Abbrev [2] 0x1e:0x15 DW_TAG_variable 123 .long .Linfo_string3 # DW_AT_name 124 .long 51 # DW_AT_type 125 # DW_AT_external 126 .byte 1 # DW_AT_decl_file 127 .byte 1 # DW_AT_decl_line 128 .byte 9 # DW_AT_location 129 .byte 3 130 .quad X 131 .byte 3 # Abbrev [3] 0x33:0xc DW_TAG_array_type 132 .long 63 # DW_AT_type 133.Ldie: 134 .byte 4 # Abbrev [4] 0x38:0x6 DW_TAG_subrange_type 135 .long 70 # DW_AT_type 136 .byte .Ldie-.Lcu_begin0 # DW_AT_count - should match the offset of an existing die 137 .byte 0 # End Of Children Mark 138 .byte 5 # Abbrev [5] 0x3f:0x7 DW_TAG_base_type 139 .long .Linfo_string4 # DW_AT_name 140 .byte 6 # DW_AT_encoding 141 .byte 1 # DW_AT_byte_size 142 .byte 6 # Abbrev [6] 0x46:0x7 DW_TAG_base_type 143 .long .Linfo_string5 # DW_AT_name 144 .byte 8 # DW_AT_byte_size 145 .byte 7 # DW_AT_encoding 146 .byte 0 # End Of Children Mark 147.Ldebug_info_end0: 148