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).
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
12 # CHECK: Variable{0x0000001e}, name = "X"
13 # CHECK-SAME: type = {0000000000000033} 0x{{[0-9A-F]*}} (char[56])
16 # Generated from "char X[47];"
17 # The array size was modified by hand.
21 .file 1 "/tmp" "<stdin>"
24 .section .debug_str,"MS",@progbits,1
26 .asciz "clang version 8.0.0 (trunk 349604) (llvm/trunk 349608)" # string offset=0
28 .asciz "-" # string offset=55
30 .asciz "/tmp" # string offset=57
32 .asciz "X" # string offset=62
34 .asciz "char" # string offset=64
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
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
53 .byte 2 # Abbreviation Code
54 .byte 52 # DW_TAG_variable
55 .byte 0 # DW_CHILDREN_no
57 .byte 14 # DW_FORM_strp
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
70 .byte 3 # Abbreviation Code
71 .byte 1 # DW_TAG_array_type
72 .byte 1 # DW_CHILDREN_yes
74 .byte 19 # DW_FORM_ref4
77 .byte 4 # Abbreviation Code
78 .byte 33 # DW_TAG_subrange_type
79 .byte 0 # DW_CHILDREN_no
81 .byte 19 # DW_FORM_ref4
82 .byte 55 # DW_AT_count
83 .byte 11 # DW_FORM_data1
86 .byte 5 # Abbreviation Code
87 .byte 36 # DW_TAG_base_type
88 .byte 0 # DW_CHILDREN_no
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
97 .byte 6 # Abbreviation Code
98 .byte 36 # DW_TAG_base_type
99 .byte 0 # DW_CHILDREN_no
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
109 .section .debug_info,"",@progbits
111 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
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
126 .byte 1 # DW_AT_decl_file
127 .byte 1 # DW_AT_decl_line
128 .byte 9 # DW_AT_location
131 .byte 3 # Abbrev [3] 0x33:0xc DW_TAG_array_type
132 .long 63 # DW_AT_type
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