214 lines · plain
1## Test that DWARFv5 .debug_loclists is correctly recognized2## and converted into the DW_FORM_sec_offset form in --garbage-collection3## case or correctly preserved in --no-garbage-collection case.4 5# RUN: yaml2obj %s -o %t.o6 7# RUN: llvm-dwarfutil %t.o %t18# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s9# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK10 11# RUN: llvm-dwarfutil --no-garbage-collection %t.o %t112# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s13# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK14 15# RUN: llvm-dwarfutil --no-garbage-collection --build-accelerator=DWARF %t.o %t116# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s17# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK18 19# RUN: llvm-dwarfutil --linker parallel %t.o %t120# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s21# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK22 23# RUN: llvm-dwarfutil --linker parallel --no-garbage-collection %t.o %t124# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s25# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK26 27# RUN: llvm-dwarfutil --linker parallel --no-garbage-collection --build-accelerator=DWARF %t.o %t128# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s29# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK30 31#CHECK: No errors.32 33#DWARF-CHECK: DW_TAG_compile_unit34#DWARF-CHECK: DW_AT_name {{.*}}"CU1"35#DWARF-CHECK-NOT: DW_AT_loclists_base36#DWARF-CHECK: DW_TAG_variable37#DWARF-CHECK: DW_AT_name {{.*}}"var1"38#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x0000000c:39#DWARF-CHECK: [0x0000000000001130, 0x0000000000001140): DW_OP_reg5 RDI)40#DWARF-CHECK: DW_AT_name {{.*}}"var2"41#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000014:42#DWARF-CHECK: <default>: DW_OP_reg5 RDI)43#DWARF-CHECK: DW_TAG_variable44#DWARF-CHECK: DW_AT_name {{.*}}"var3"45#DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000018:46#DWARF-CHECK: [0x0000000000001140, 0x0000000000001150): DW_OP_reg5 RDI47#DWARF-CHECK: [0x0000000000001160, 0x0000000000001170): DW_OP_reg6 RBP)48 49#UPD-DWARF-CHECK: DW_TAG_compile_unit50#UPD-DWARF-CHECK: DW_AT_name {{.*}}"CU1"51#UPD-DWARF-CHECK: DW_AT_loclists_base [DW_FORM_sec_offset] (0x0000000c)52#UPD-DWARF-CHECK: DW_TAG_variable53#UPD-DWARF-CHECK: DW_AT_name {{.*}}"var1"54#UPD-DWARF-CHECK: DW_AT_location [DW_FORM_loclistx] (indexed (0x0) loclist = 0x00000018:55#UPD-DWARF-CHECK: [0x0000000000001130, 0x0000000000001140): DW_OP_reg5 RDI)56#UPD-DWARF-CHECK: DW_TAG_variable57#UPD-DWARF-CHECK: DW_AT_name {{.*}}"var2"58#UPD-DWARF-CHECK: DW_AT_location [DW_FORM_loclistx] (indexed (0x1) loclist = 0x0000001e:59#UPD-DWARF-CHECK: <default>: DW_OP_reg5 RDI)60#UPD-DWARF-CHECK: DW_TAG_variable61#UPD-DWARF-CHECK: DW_AT_name {{.*}}"var3"62#UPD-DWARF-CHECK: DW_AT_location [DW_FORM_loclistx] (indexed (0x2) loclist = 0x00000022:63#UPD-DWARF-CHECK: [0x0000000000001140, 0x0000000000001150): DW_OP_reg5 RDI64#UPD-DWARF-CHECK: [0x0000000000001160, 0x0000000000001170): DW_OP_reg6 RBP)65 66## Following yaml description has Content of the .debug_rnglists exactly like following data vvvvvvvvvvv67## .debug_rnglists contents:68## 0x00000000: range list header: length = 0x0000003e, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x0000000569## offsets: [70## 0x00000014 => 0x0000002071## 0x00000018 => 0x0000002472## 0x0000001c => 0x0000002873## 0x00000027 => 0x0000003374## 0x00000032 => 0x0000003e75## ]76## ranges:77## 0x00000020: [DW_RLE_startx_length]: 0x0000000000000000, 0x0000000000000010 => [0x0000000000001130, 0x0000000000001140)78## 0x00000023: [DW_RLE_end_of_list ]79## 0x00000024: [DW_RLE_startx_length]: 0x0000000000000001, 0x0000000000000010 => [0x0000000000001140, 0x0000000000001150)80## 0x00000027: [DW_RLE_end_of_list ]81## 0x00000028: [DW_RLE_start_length ]: 0x0000000000001150, 0x0000000000000010 => [0x0000000000001150, 0x0000000000001160)82## 0x00000032: [DW_RLE_end_of_list ]83## 0x00000033: [DW_RLE_start_length ]: 0x0000000000001160, 0x0000000000000010 => [0x0000000000001160, 0x0000000000001170)84## 0x0000003d: [DW_RLE_end_of_list ]85## 0x0000003e: [DW_RLE_startx_length]: 0x0000000000000000, 0x0000000000000040 => [0x0000000000001130, 0x0000000000001170)86## 0x00000041: [DW_RLE_end_of_list ]87 88 89## Following yaml description has Content of the .debug_loclists exactly like following data vvvvvvvvvvv90## .debug_loclists contents:91## 0x00000000: locations list header: length = 0x00000029, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x0000000392## offsets: [93## 0x0000000c => 0x0000001894## 0x00000012 => 0x0000001e95## 0x00000016 => 0x0000002296## ]97## 0x00000018:98## DW_LLE_startx_length (0x0000000000000000, 0x0000000000000010): DW_OP_reg5 RDI99## DW_LLE_end_of_list ()100##101## 0x0000001e:102## DW_LLE_default_location()103## => <default>: DW_OP_reg5 RDI104## DW_LLE_end_of_list ()105##106## 0x00000022:107## DW_LLE_startx_length (0x0000000000000001, 0x0000000000000010): DW_OP_reg5 RDI108## DW_LLE_startx_length (0x0000000000000003, 0x0000000000000010): DW_OP_reg6 RBP109## DW_LLE_end_of_list ()110 111--- !ELF112FileHeader:113 Class: ELFCLASS64114 Data: ELFDATA2LSB115 Type: ET_REL116 Machine: EM_X86_64117Sections:118 - Name: .text119 Type: SHT_PROGBITS120 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]121 Address: 0x1130122 Size: 0x70123 - Name: .debug_rnglists124 Type: SHT_PROGBITS125 Flags: [ ]126 Content: "3e000000050008000500000014000000180000001c000000270000003200000003001000030110000750110000000000001000076011000000000000100003004000"127 - Name: .debug_loclists128 Type: SHT_PROGBITS129 Flags: [ ]130 Content: "2900000005000800030000000c0000001200000016000000030010015500050155000301100155030310015600"131DWARF:132 debug_abbrev:133 - Table:134 - Tag: DW_TAG_compile_unit135 Children: DW_CHILDREN_yes136 Attributes:137 - Attribute: DW_AT_producer138 Form: DW_FORM_string139 - Attribute: DW_AT_language140 Form: DW_FORM_data2141 - Attribute: DW_AT_name142 Form: DW_FORM_string143 - Attribute: DW_AT_low_pc144 Form: DW_FORM_addrx145 - Attribute: DW_AT_ranges146 Form: DW_FORM_rnglistx147 - Attribute: DW_AT_rnglists_base148 Form: DW_FORM_sec_offset149 - Attribute: DW_AT_loclists_base150 Form: DW_FORM_sec_offset151 - Attribute: DW_AT_addr_base152 Form: DW_FORM_sec_offset153 - Tag: DW_TAG_base_type154 Children: DW_CHILDREN_no155 Attributes:156 - Attribute: DW_AT_name157 Form: DW_FORM_string158 - Tag: DW_TAG_variable159 Children: DW_CHILDREN_no160 Attributes:161 - Attribute: DW_AT_name162 Form: DW_FORM_string163 - Attribute: DW_AT_const_value164 Form: DW_FORM_data4165 - Attribute: DW_AT_type166 Form: DW_FORM_ref_addr167 - Attribute: DW_AT_location168 Form: DW_FORM_loclistx169 debug_info:170 - Version: 5171 UnitType: DW_UT_compile172 Entries:173 - AbbrCode: 1174 Values:175 - CStr: by_hand176 - Value: 0x04177 - CStr: CU1178 - Value: 0x0179 - Value: 0x4180 - Value: 0xc181 - Value: 0xc182 - Value: 0x8183 - AbbrCode: 2184 Values:185 - CStr: int186 - AbbrCode: 3187 Values:188 - CStr: var1189 - Value: 0x00000000190 - Value: 0x00000029191 - Value: 0x0192 - AbbrCode: 3193 Values:194 - CStr: var2195 - Value: 0x00000000196 - Value: 0x00000029197 - Value: 0x1198 - AbbrCode: 3199 Values:200 - CStr: var3201 - Value: 0x00000000202 - Value: 0x00000029203 - Value: 0x2204 - AbbrCode: 0205 debug_addr:206 - Version: 5207 AddressSize: 0x08208 Entries:209 - Address: 0x1130210 - Address: 0x1140211 - Address: 0x1150212 - Address: 0x1160213...214