266 lines · plain
1## Test that we can correctly complete types even if the debug_names index2## contains entries referring to declaration dies (clang emitted entries like3## that until bd5c6367bd7).4##5## This test consists of two compile units and one type unit. CU1 has the6## definition of a variable, but only a forward-declaration of its type. When7## attempting to find a definition, the debug_names lookup will return the DIE8## in CU0, which is also a forward-declaration (with a reference to a type9## unit). LLDB needs to find the definition of the type within the type unit.10 11# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t12# RUN: %lldb %t -o "target variable s" -o exit | FileCheck %s13 14# CHECK: (lldb) target variable s15# CHECK-NEXT: (Struct) s = (member = 47)16 17 .data18 .p2align 2, 0x019 .long 020s:21 .long 47 # 0x2f22 23 .section .debug_abbrev,"",@progbits24 .byte 1 # Abbreviation Code25 .byte 65 # DW_TAG_type_unit26 .byte 1 # DW_CHILDREN_yes27 .byte 19 # DW_AT_language28 .byte 5 # DW_FORM_data229 .byte 0 # EOM(1)30 .byte 0 # EOM(2)31 .byte 2 # Abbreviation Code32 .byte 19 # DW_TAG_structure_type33 .byte 1 # DW_CHILDREN_yes34 .byte 54 # DW_AT_calling_convention35 .byte 11 # DW_FORM_data136 .byte 3 # DW_AT_name37 .byte 14 # DW_FORM_strp38 .byte 11 # DW_AT_byte_size39 .byte 11 # DW_FORM_data140 .byte 0 # EOM(1)41 .byte 0 # EOM(2)42 .byte 3 # Abbreviation Code43 .byte 13 # DW_TAG_member44 .byte 0 # DW_CHILDREN_no45 .byte 3 # DW_AT_name46 .byte 14 # DW_FORM_strp47 .byte 73 # DW_AT_type48 .byte 19 # DW_FORM_ref449 .byte 56 # DW_AT_data_member_location50 .byte 11 # DW_FORM_data151 .byte 0 # EOM(1)52 .byte 0 # EOM(2)53 .byte 4 # Abbreviation Code54 .byte 36 # DW_TAG_base_type55 .byte 0 # DW_CHILDREN_no56 .byte 3 # DW_AT_name57 .byte 14 # DW_FORM_strp58 .byte 62 # DW_AT_encoding59 .byte 11 # DW_FORM_data160 .byte 11 # DW_AT_byte_size61 .byte 11 # DW_FORM_data162 .byte 0 # EOM(1)63 .byte 0 # EOM(2)64 .byte 5 # Abbreviation Code65 .byte 17 # DW_TAG_compile_unit66 .byte 1 # DW_CHILDREN_yes67 .byte 37 # DW_AT_producer68 .byte 8 # DW_FORM_string69 .byte 19 # DW_AT_language70 .byte 5 # DW_FORM_data271 .byte 0 # EOM(1)72 .byte 0 # EOM(2)73 .byte 6 # Abbreviation Code74 .byte 52 # DW_TAG_variable75 .byte 0 # DW_CHILDREN_no76 .byte 3 # DW_AT_name77 .byte 14 # DW_FORM_strp78 .byte 73 # DW_AT_type79 .byte 19 # DW_FORM_ref480 .byte 2 # DW_AT_location81 .byte 24 # DW_FORM_exprloc82 .byte 0 # EOM(1)83 .byte 0 # EOM(2)84 .byte 7 # Abbreviation Code85 .byte 19 # DW_TAG_structure_type86 .byte 0 # DW_CHILDREN_no87 .byte 60 # DW_AT_declaration88 .byte 25 # DW_FORM_flag_present89 .byte 105 # DW_AT_signature90 .byte 32 # DW_FORM_ref_sig891 .byte 0 # EOM(1)92 .byte 0 # EOM(2)93 .byte 8 # Abbreviation Code94 .byte 19 # DW_TAG_structure_type95 .byte 0 # DW_CHILDREN_no96 .byte 3 # DW_AT_name97 .byte 14 # DW_FORM_strp98 .byte 60 # DW_AT_declaration99 .byte 25 # DW_FORM_flag_present100 .byte 0 # EOM(1)101 .byte 0 # EOM(2)102 .byte 0 # EOM(3)103 104 .section .debug_info,"",@progbits105.Ltu_begin0:106 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit107.Ldebug_info_start0:108 .short 5 # DWARF version number109 .byte 2 # DWARF Unit Type110 .byte 8 # Address Size (in bytes)111 .long .debug_abbrev # Offset Into Abbrev. Section112 .quad 4878254330033667422 # Type Signature113 .long .LStruct_def-.Ltu_begin0 # Type DIE Offset114 .byte 1 # Abbrev [1] 0x18:0x20 DW_TAG_type_unit115 .short 33 # DW_AT_language116.LStruct_def:117 .byte 2 # Abbrev [2] 0x23:0x10 DW_TAG_structure_type118 .byte 5 # DW_AT_calling_convention119 .long .Linfo_string6 # DW_AT_name120 .byte 4 # DW_AT_byte_size121 .byte 3 # Abbrev [3] 0x29:0x9 DW_TAG_member122 .long .Linfo_string4 # DW_AT_name123 .long .Lint-.Ltu_begin0 # DW_AT_type124 .byte 0 # DW_AT_data_member_location125 .byte 0 # End Of Children Mark126.Lint:127 .byte 4 # Abbrev [4] 0x33:0x4 DW_TAG_base_type128 .long .Linfo_string5 # DW_AT_name129 .byte 5 # DW_AT_encoding130 .byte 4 # DW_AT_byte_size131 .byte 0 # End Of Children Mark132.Ldebug_info_end0:133 134.Lcu_begin0:135 .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit136.Ldebug_info_start1:137 .short 5 # DWARF version number138 .byte 1 # DWARF Unit Type139 .byte 8 # Address Size (in bytes)140 .long .debug_abbrev # Offset Into Abbrev. Section141 .byte 5 # Abbrev [5] 0xc:0x27 DW_TAG_compile_unit142 .asciz "Hand-written DWARF" # DW_AT_producer143 .short 33 # DW_AT_language144.Ls:145 .byte 6 # Abbrev [6] 0x1e:0xb DW_TAG_variable146 .long .Linfo_string3 # DW_AT_name147 .long .LStruct_decl2-.Lcu_begin0 # DW_AT_type148 .byte 9 # DW_AT_location149 .byte 3150 .quad s151.LStruct_decl2:152 .byte 8 # Abbrev [8] 0x29:0x9 DW_TAG_structure_type153 .long .Linfo_string6 # DW_AT_name154 # DW_AT_declaration155 .byte 0 # End Of Children Mark156.Ldebug_info_end1:157 158.Lcu_begin1:159 .long .Ldebug_info_end2-.Ldebug_info_start2 # Length of Unit160.Ldebug_info_start2:161 .short 5 # DWARF version number162 .byte 1 # DWARF Unit Type163 .byte 8 # Address Size (in bytes)164 .long .debug_abbrev # Offset Into Abbrev. Section165 .byte 5 # Abbrev [5] 0xc:0x27 DW_TAG_compile_unit166 .asciz "Hand-written DWARF" # DW_AT_producer167 .short 33 # DW_AT_language168.LStruct_decl:169 .byte 7 # Abbrev [7] 0x29:0x9 DW_TAG_structure_type170 # DW_AT_declaration171 .quad 4878254330033667422 # DW_AT_signature172 .byte 0 # End Of Children Mark173.Ldebug_info_end2:174 175 .section .debug_str,"MS",@progbits,1176.Linfo_string3:177 .asciz "s" # string offset=60178.Linfo_string4:179 .asciz "member" # string offset=62180.Linfo_string5:181 .asciz "int" # string offset=69182.Linfo_string6:183 .asciz "Struct" # string offset=73184 185 .section .debug_names,"",@progbits186 .long .Lnames_end0-.Lnames_start0 # Header: unit length187.Lnames_start0:188 .short 5 # Header: version189 .short 0 # Header: padding190 .long 2 # Header: compilation unit count191 .long 1 # Header: local type unit count192 .long 0 # Header: foreign type unit count193 .long 0 # Header: bucket count194 .long 3 # Header: name count195 .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size196 .long 8 # Header: augmentation string size197 .ascii "LLVM0700" # Header: augmentation string198 .long .Lcu_begin0 # Compilation unit 0199 .long .Lcu_begin1 # Compilation unit 1200 .long .Ltu_begin0 # Type unit 0201 .long .Linfo_string6 # String in Bucket 0: Struct202 .long .Linfo_string3 # String in Bucket 1: s203 .long .Linfo_string5 # String in Bucket 2: int204 .long .Lnames1-.Lnames_entries0 # Offset in Bucket 0205 .long .Lnames2-.Lnames_entries0 # Offset in Bucket 1206 .long .Lnames0-.Lnames_entries0 # Offset in Bucket 2207.Lnames_abbrev_start0:208 .byte 1 # Abbrev code209 .byte 19 # DW_TAG_structure_type210 .byte 2 # DW_IDX_type_unit211 .byte 11 # DW_FORM_data1212 .byte 3 # DW_IDX_die_offset213 .byte 19 # DW_FORM_ref4214 .byte 0 # End of abbrev215 .byte 0 # End of abbrev216 .byte 2 # Abbrev code217 .byte 52 # DW_TAG_variable218 .byte 1 # DW_IDX_compile_unit219 .byte 11 # DW_FORM_data1220 .byte 3 # DW_IDX_die_offset221 .byte 19 # DW_FORM_ref4222 .byte 0 # End of abbrev223 .byte 0 # End of abbrev224 .byte 3 # Abbrev code225 .byte 36 # DW_TAG_base_type226 .byte 2 # DW_IDX_type_unit227 .byte 11 # DW_FORM_data1228 .byte 3 # DW_IDX_die_offset229 .byte 19 # DW_FORM_ref4230 .byte 0 # End of abbrev231 .byte 0 # End of abbrev232 .byte 4 # Abbrev code233 .byte 19 # DW_TAG_structure_type234 .byte 1 # DW_IDX_compile_unit235 .byte 11 # DW_FORM_data1236 .byte 3 # DW_IDX_die_offset237 .byte 19 # DW_FORM_ref4238 .byte 0 # End of abbrev239 .byte 0 # End of abbrev240 .byte 0 # End of abbrev list241.Lnames_abbrev_end0:242.Lnames_entries0:243.Lnames1:244 .byte 4 # Abbreviation code245 .byte 1 # DW_IDX_compile_unit246 .long .LStruct_decl-.Lcu_begin1 # DW_IDX_die_offset247 .byte 1 # Abbreviation code248 .byte 0 # DW_IDX_type_unit249 .long .LStruct_def-.Ltu_begin0 # DW_IDX_die_offset250 .byte 0251 # End of list: Struct252.Lnames2:253 .byte 2 # Abbreviation code254 .byte 0 # DW_IDX_compile_unit255 .long .Ls-.Lcu_begin0 # DW_IDX_die_offset256 .byte 0257 # End of list: s258.Lnames0:259 .byte 3 # Abbreviation code260 .byte 0 # DW_IDX_type_unit261 .long .Lint-.Ltu_begin0 # DW_IDX_die_offset262 .byte 0263 # End of list: int264 .p2align 2, 0x0265.Lnames_end0:266