1 ## Test that DWARFv5 .debug_loclists is correctly recognized
2 ## and converted into the DW_FORM_sec_offset form in --garbage-collection
3 ## case or correctly preserved in --no-garbage-collection case.
5 # RUN: yaml2obj %s -o %t.o
7 # RUN: llvm-dwarfutil %t.o %t1
8 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
9 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK
11 # RUN: llvm-dwarfutil --no-garbage-collection %t.o %t1
12 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
13 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
15 # RUN: llvm-dwarfutil --no-garbage-collection --build-accelerator=DWARF %t.o %t1
16 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
17 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
19 # RUN: llvm-dwarfutil --linker parallel %t.o %t1
20 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
21 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix DWARF-CHECK
23 # RUN: llvm-dwarfutil --linker parallel --no-garbage-collection %t.o %t1
24 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
25 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
27 # RUN: llvm-dwarfutil --linker parallel --no-garbage-collection --build-accelerator=DWARF %t.o %t1
28 # RUN: llvm-dwarfdump -verify %t1 | FileCheck %s
29 # RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s --check-prefix UPD-DWARF-CHECK
33 #DWARF-CHECK: DW_TAG_compile_unit
34 #DWARF-CHECK: DW_AT_name {{.*}}"CU1"
35 #DWARF-CHECK-NOT: DW_AT_loclists_base
36 #DWARF-CHECK: DW_TAG_variable
37 #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_variable
44 #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 RDI
47 #DWARF-CHECK: [0x0000000000001160, 0x0000000000001170): DW_OP_reg6 RBP)
49 #UPD-DWARF-CHECK: DW_TAG_compile_unit
50 #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_variable
53 #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_variable
57 #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_variable
61 #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 RDI
64 #UPD-DWARF-CHECK: [0x0000000000001160, 0x0000000000001170): DW_OP_reg6 RBP)
66 ## Following yaml description has Content of the .debug_rnglists exactly like following data vvvvvvvvvvv
67 ## .debug_rnglists contents:
68 ## 0x00000000: range list header: length = 0x0000003e, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000005
70 ## 0x00000014 => 0x00000020
71 ## 0x00000018 => 0x00000024
72 ## 0x0000001c => 0x00000028
73 ## 0x00000027 => 0x00000033
74 ## 0x00000032 => 0x0000003e
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 ]
89 ## Following yaml description has Content of the .debug_loclists exactly like following data vvvvvvvvvvv
90 ## .debug_loclists contents:
91 ## 0x00000000: locations list header: length = 0x00000029, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000003
93 ## 0x0000000c => 0x00000018
94 ## 0x00000012 => 0x0000001e
95 ## 0x00000016 => 0x00000022
98 ## DW_LLE_startx_length (0x0000000000000000, 0x0000000000000010): DW_OP_reg5 RDI
99 ## DW_LLE_end_of_list ()
102 ## DW_LLE_default_location()
103 ## => <default>: DW_OP_reg5 RDI
104 ## DW_LLE_end_of_list ()
107 ## DW_LLE_startx_length (0x0000000000000001, 0x0000000000000010): DW_OP_reg5 RDI
108 ## DW_LLE_startx_length (0x0000000000000003, 0x0000000000000010): DW_OP_reg6 RBP
109 ## DW_LLE_end_of_list ()
120 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
123 - Name: .debug_rnglists
126 Content: "3e000000050008000500000014000000180000001c000000270000003200000003001000030110000750110000000000001000076011000000000000100003004000"
127 - Name: .debug_loclists
130 Content: "2900000005000800030000000c0000001200000016000000030010015500050155000301100155030310015600"
134 - Tag: DW_TAG_compile_unit
135 Children: DW_CHILDREN_yes
137 - Attribute: DW_AT_producer
139 - Attribute: DW_AT_language
141 - Attribute: DW_AT_name
143 - Attribute: DW_AT_low_pc
145 - Attribute: DW_AT_ranges
146 Form: DW_FORM_rnglistx
147 - Attribute: DW_AT_rnglists_base
148 Form: DW_FORM_sec_offset
149 - Attribute: DW_AT_loclists_base
150 Form: DW_FORM_sec_offset
151 - Attribute: DW_AT_addr_base
152 Form: DW_FORM_sec_offset
153 - Tag: DW_TAG_base_type
154 Children: DW_CHILDREN_no
156 - Attribute: DW_AT_name
158 - Tag: DW_TAG_variable
159 Children: DW_CHILDREN_no
161 - Attribute: DW_AT_name
163 - Attribute: DW_AT_const_value
165 - Attribute: DW_AT_type
166 Form: DW_FORM_ref_addr
167 - Attribute: DW_AT_location
168 Form: DW_FORM_loclistx
171 UnitType: DW_UT_compile