xref: /llvm-project/llvm/test/tools/dsymutil/X86/location-expression.test (revision f1fdfe6888f93b9f6dfb4689e1f3206de584ff5b)
1## This test checks that size of DW_AT_location attribute
2## of the DW_FORM_block1 form is correctly written to the
3## output.
4
5# RUN: yaml2obj %s -o %t.o
6# RUN: echo '---' > %t2.map
7# RUN: echo "triple:          'x86_64-apple-darwin'" >> %t2.map
8# RUN: echo 'objects:'  >> %t2.map
9# RUN: echo " -  filename: '%t.o'" >> %t2.map
10# RUN: echo '    symbols:' >> %t2.map
11# RUN: echo '      - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x10000, size: 0x10 }' >> %t2.map
12# RUN: echo '...' >> %t2.map
13# RUN: dsymutil -y %t2.map -f -o - | llvm-dwarfdump -a --verbose - | FileCheck %s
14# RUN: dsymutil --linker parallel -y %t2.map -f -o - | llvm-dwarfdump -a --verbose - | FileCheck %s
15
16# CHECK: file format Mach-O 64-bit x86-64
17# CHECK: .debug_info contents:
18# CHECK: Compile Unit:
19# CHECK: DW_TAG_compile_unit
20# CHECK: DW_AT_name{{.*}}"CU1"
21# CHECK: DW_TAG_variable
22# CHECK: DW_AT_name {{.*}}"var1"
23# CHECK: DW_AT_type {{.*}}"class1"
24# CHECK:   DW_AT_location [DW_FORM_block1]  (DW_OP_const8u 0x{{.*}}, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address)
25# CHECK: DW_TAG_variable
26# CHECK: DW_AT_name {{.*}}"var2"
27# CHECK: DW_AT_type {{.*}}"class1"
28# CHECK:   DW_AT_location [DW_FORM_block]  (DW_OP_const8u 0x{{.*}}, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address, DW_OP_const8u 0x2000, DW_OP_form_tls_address)
29# CHECK: DW_TAG_variable
30# CHECK: DW_AT_name {{.*}}"var3"
31# CHECK: DW_AT_type {{.*}}"class1"
32#
33
34--- !mach-o
35FileHeader:
36  magic:      0xFEEDFACF
37  cputype:    0x01000007
38  cpusubtype: 0x00000003
39  filetype:   0x00000001
40  ncmds:      2
41  sizeofcmds: 376
42  flags:      0x00002000
43  reserved:   0x00000000
44LoadCommands:
45  - cmd:      LC_SEGMENT_64
46    cmdsize:  232
47    segname:  ''
48    vmaddr:   0x00
49    vmsize:   0x300
50    fileoff:  0x300
51    filesize: 0x300
52    maxprot:  7
53    initprot: 7
54    nsects:   2
55    flags:    0
56    Sections:
57      - sectname:  __debug_abbrev
58        segname:   __DWARF
59        addr:      0x000000000000000F
60        size:      0x38
61        offset:    0x00000380
62        align:     0
63        reloff:    0x00000000
64        nreloc:    0
65        flags:     0x02000000
66        reserved1: 0x00000000
67        reserved2: 0x00000000
68        reserved3: 0x00000000
69      - sectname:  __debug_info
70        segname:   __DWARF
71        addr:      0x000000000000100
72        size:      0x15e
73        offset:    0x00000410
74        align:     0
75        reloff:    0x00000600
76        nreloc:    2
77        flags:     0x02000000
78        reserved1: 0x00000000
79        reserved2: 0x00000000
80        reserved3: 0x00000000
81        relocations:
82          - address:         0x30
83            symbolnum:       1
84            pcrel:           true
85            length:          3
86            extern:          true
87            type:            0
88            scattered:       false
89            value:           0
90          - address:         0xc2
91            symbolnum:       1
92            pcrel:           true
93            length:          3
94            extern:          true
95            type:            0
96            scattered:       false
97            value:           0
98  - cmd:             LC_SYMTAB
99    cmdsize:         24
100    symoff:          0x700
101    nsyms:           2
102    stroff:          0x720
103    strsize:         10
104LinkEditData:
105  NameList:
106    - n_strx:          1
107      n_type:          0x0F
108      n_sect:          1
109      n_desc:          0
110      n_value:         0
111    - n_strx:          1
112      n_type:          0x0F
113      n_sect:          1
114      n_desc:          0
115      n_value:         0
116  StringTable:
117    - ''
118    - '__Z3foov'
119    - ''
120DWARF:
121  debug_abbrev:
122    - Table:
123      - Tag:      DW_TAG_compile_unit
124        Children: DW_CHILDREN_yes
125        Attributes:
126          - Attribute: DW_AT_producer
127            Form:      DW_FORM_string
128          - Attribute: DW_AT_language
129            Form:      DW_FORM_data2
130          - Attribute: DW_AT_name
131            Form:      DW_FORM_string
132      - Tag:      DW_TAG_class_type
133        Children: DW_CHILDREN_no
134        Attributes:
135          - Attribute: DW_AT_name
136            Form:      DW_FORM_string
137      - Tag:      DW_TAG_variable
138        Children: DW_CHILDREN_no
139        Attributes:
140          - Attribute: DW_AT_name
141            Form:      DW_FORM_string
142          - Attribute: DW_AT_const_value
143            Form:      DW_FORM_data4
144          - Attribute: DW_AT_type
145            Form:      DW_FORM_ref4
146          - Attribute: DW_AT_location
147            Form:      DW_FORM_block1
148      - Tag:      DW_TAG_variable
149        Children: DW_CHILDREN_no
150        Attributes:
151          - Attribute: DW_AT_name
152            Form:      DW_FORM_string
153          - Attribute: DW_AT_const_value
154            Form:      DW_FORM_data4
155          - Attribute: DW_AT_type
156            Form:      DW_FORM_ref4
157          - Attribute: DW_AT_location
158            Form:      DW_FORM_block
159      - Tag:      DW_TAG_variable
160        Children: DW_CHILDREN_no
161        Attributes:
162          - Attribute: DW_AT_name
163            Form:      DW_FORM_string
164          - Attribute: DW_AT_const_value
165            Form:      DW_FORM_data4
166          - Attribute: DW_AT_type
167            Form:      DW_FORM_ref4
168  debug_info:
169    - Version: 4
170      Entries:
171        - AbbrCode: 1
172          Values:
173            - CStr: by_hand
174            - Value:  0x04
175            - CStr: CU1
176        - AbbrCode: 2
177          Values:
178            - CStr: class1
179        - AbbrCode: 3
180          Values:
181            - CStr: var1
182            - Value:  0x00000000
183            - Value:  0x0000001a
184            - BlockData:
185                - 0x0e
186                - 0x00
187                - 0x20
188                - 0x00
189                - 0x00
190                - 0x00
191                - 0x00
192                - 0x00
193                - 0x00
194                - 0x9b
195                - 0x0e
196                - 0x00
197                - 0x20
198                - 0x00
199                - 0x00
200                - 0x00
201                - 0x00
202                - 0x00
203                - 0x00
204                - 0x9b
205                - 0x0e
206                - 0x00
207                - 0x20
208                - 0x00
209                - 0x00
210                - 0x00
211                - 0x00
212                - 0x00
213                - 0x00
214                - 0x9b
215                - 0x0e
216                - 0x00
217                - 0x20
218                - 0x00
219                - 0x00
220                - 0x00
221                - 0x00
222                - 0x00
223                - 0x00
224                - 0x9b
225                - 0x0e
226                - 0x00
227                - 0x20
228                - 0x00
229                - 0x00
230                - 0x00
231                - 0x00
232                - 0x00
233                - 0x00
234                - 0x9b
235                - 0x0e
236                - 0x00
237                - 0x20
238                - 0x00
239                - 0x00
240                - 0x00
241                - 0x00
242                - 0x00
243                - 0x00
244                - 0x9b
245                - 0x0e
246                - 0x00
247                - 0x20
248                - 0x00
249                - 0x00
250                - 0x00
251                - 0x00
252                - 0x00
253                - 0x00
254                - 0x9b
255                - 0x0e
256                - 0x00
257                - 0x20
258                - 0x00
259                - 0x00
260                - 0x00
261                - 0x00
262                - 0x00
263                - 0x00
264                - 0x9b
265                - 0x0e
266                - 0x00
267                - 0x20
268                - 0x00
269                - 0x00
270                - 0x00
271                - 0x00
272                - 0x00
273                - 0x00
274                - 0x9b
275                - 0x0e
276                - 0x00
277                - 0x20
278                - 0x00
279                - 0x00
280                - 0x00
281                - 0x00
282                - 0x00
283                - 0x00
284                - 0x9b
285                - 0x0e
286                - 0x00
287                - 0x20
288                - 0x00
289                - 0x00
290                - 0x00
291                - 0x00
292                - 0x00
293                - 0x00
294                - 0x9b
295                - 0x0e
296                - 0x00
297                - 0x20
298                - 0x00
299                - 0x00
300                - 0x00
301                - 0x00
302                - 0x00
303                - 0x00
304                - 0x9b
305                - 0x0e
306                - 0x00
307                - 0x20
308                - 0x00
309                - 0x00
310                - 0x00
311                - 0x00
312                - 0x00
313                - 0x00
314                - 0x9b
315        - AbbrCode: 4
316          Values:
317            - CStr: var2
318            - Value:  0x00000000
319            - Value:  0x0000001a
320            - BlockData:
321                - 0x0e
322                - 0x00
323                - 0x20
324                - 0x00
325                - 0x00
326                - 0x00
327                - 0x00
328                - 0x00
329                - 0x00
330                - 0x9b
331                - 0x0e
332                - 0x00
333                - 0x20
334                - 0x00
335                - 0x00
336                - 0x00
337                - 0x00
338                - 0x00
339                - 0x00
340                - 0x9b
341                - 0x0e
342                - 0x00
343                - 0x20
344                - 0x00
345                - 0x00
346                - 0x00
347                - 0x00
348                - 0x00
349                - 0x00
350                - 0x9b
351                - 0x0e
352                - 0x00
353                - 0x20
354                - 0x00
355                - 0x00
356                - 0x00
357                - 0x00
358                - 0x00
359                - 0x00
360                - 0x9b
361                - 0x0e
362                - 0x00
363                - 0x20
364                - 0x00
365                - 0x00
366                - 0x00
367                - 0x00
368                - 0x00
369                - 0x00
370                - 0x9b
371                - 0x0e
372                - 0x00
373                - 0x20
374                - 0x00
375                - 0x00
376                - 0x00
377                - 0x00
378                - 0x00
379                - 0x00
380                - 0x9b
381                - 0x0e
382                - 0x00
383                - 0x20
384                - 0x00
385                - 0x00
386                - 0x00
387                - 0x00
388                - 0x00
389                - 0x00
390                - 0x9b
391                - 0x0e
392                - 0x00
393                - 0x20
394                - 0x00
395                - 0x00
396                - 0x00
397                - 0x00
398                - 0x00
399                - 0x00
400                - 0x9b
401                - 0x0e
402                - 0x00
403                - 0x20
404                - 0x00
405                - 0x00
406                - 0x00
407                - 0x00
408                - 0x00
409                - 0x00
410                - 0x9b
411                - 0x0e
412                - 0x00
413                - 0x20
414                - 0x00
415                - 0x00
416                - 0x00
417                - 0x00
418                - 0x00
419                - 0x00
420                - 0x9b
421                - 0x0e
422                - 0x00
423                - 0x20
424                - 0x00
425                - 0x00
426                - 0x00
427                - 0x00
428                - 0x00
429                - 0x00
430                - 0x9b
431                - 0x0e
432                - 0x00
433                - 0x20
434                - 0x00
435                - 0x00
436                - 0x00
437                - 0x00
438                - 0x00
439                - 0x00
440                - 0x9b
441                - 0x0e
442                - 0x00
443                - 0x20
444                - 0x00
445                - 0x00
446                - 0x00
447                - 0x00
448                - 0x00
449                - 0x00
450                - 0x9b
451                - 0x0e
452                - 0x00
453                - 0x20
454                - 0x00
455                - 0x00
456                - 0x00
457                - 0x00
458                - 0x00
459                - 0x00
460                - 0x9b
461        - AbbrCode: 5
462          Values:
463            - CStr: var3
464            - Value:  0x00000000
465            - Value:  0x0000001a
466        - AbbrCode: 0
467...
468