xref: /llvm-project/llvm/test/DebugInfo/X86/dwp-v2-loc.s (revision 49737df7679347aea59d891e82350a057f1a03c7)
1## The test checks that pre-v5 compile units in package files read their
2## location tables from .debug_loc.dwo sections.
3## See dwp-v5-loclists.s for v5 units.
4
5# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \
6# RUN:   llvm-dwarfdump -debug-info -debug-loc - | \
7# RUN:   FileCheck %s
8
9# CHECK:      .debug_info.dwo contents:
10# CHECK:      DW_TAG_compile_unit
11# CHECK-NEXT:   DW_AT_GNU_dwo_id (0x1100001122222222)
12# CHECK:      DW_TAG_variable
13# CHECK-NEXT:   DW_AT_name ("a")
14# CHECK-NEXT:   DW_AT_location (0x00000000:
15# CHECK-NEXT:     DW_LLE_startx_length (0x0000000000000001, 0x0000000000000010): DW_OP_reg5 RDI)
16
17# CHECK:      .debug_loc.dwo contents:
18# CHECK:      0x00000013:
19# CHECK-NEXT:   DW_LLE_startx_length (0x00000001, 0x00000010): DW_OP_reg5 RDI
20
21.section .debug_abbrev.dwo, "e", @progbits
22.LAbbrevBegin:
23    .uleb128 1                      # Abbreviation Code
24    .uleb128 17                     # DW_TAG_compile_unit
25    .byte 1                         # DW_CHILDREN_yes
26    .uleb128 0x2131                 # DW_AT_GNU_dwo_id
27    .uleb128 7                      # DW_FORM_data8
28    .byte 0                         # EOM(1)
29    .byte 0                         # EOM(2)
30    .uleb128 2                      # Abbreviation Code
31    .uleb128 52                     # DW_TAG_variable
32    .byte 0                         # DW_CHILDREN_no
33    .uleb128 3                      # DW_AT_name
34    .uleb128 8                      # DW_FORM_string
35    .uleb128 2                      # DW_AT_location
36    .uleb128 23                     # DW_FORM_sec_offset
37    .byte 0                         # EOM(1)
38    .byte 0                         # EOM(2)
39    .byte 0                         # EOM(3)
40.LAbbrevEnd:
41
42    .section .debug_info.dwo, "e", @progbits
43.LCUBegin:
44    .long .LCUEnd-.LCUVersion       # Length of Unit
45.LCUVersion:
46    .short 4                        # Version
47    .long 0                         # Abbrev offset
48    .byte 8                         # Address size
49    .uleb128 1                      # Abbrev [1] DW_TAG_compile_unit
50    .quad 0x1100001122222222        # DW_AT_GNU_dwo_id
51    .uleb128 2                      # Abbrev [2] DW_TAG_variable
52    .asciz "a"                      # DW_AT_name
53    .long 0                         # DW_AT_location
54    .byte 0                         # End Of Children Mark
55.LCUEnd:
56
57.section .debug_loc.dwo, "e", @progbits
58## Start the section with a number of dummy DW_LLE_end_of_list entries to check
59## that the reading offset is correctly adjusted.
60    .zero 0x13
61.LLocBegin:
62    .byte 3                         # DW_LLE_startx_length
63    .uleb128 1                      # Index
64    .long 0x10                      # Length
65    .short 1                        # Loc expr size
66    .byte 85                        # DW_OP_reg5
67    .byte 0                         # DW_LLE_end_of_list
68.LLocEnd:
69
70    .section .debug_cu_index, "", @progbits
71## Header:
72    .long 2                         # Version
73    .long 3                         # Section count
74    .long 1                         # Unit count
75    .long 2                         # Slot count
76## Hash Table of Signatures:
77    .quad 0x1100001122222222
78    .quad 0
79## Parallel Table of Indexes:
80    .long 1
81    .long 0
82## Table of Section Offsets:
83## Row 0:
84    .long 1                         # DW_SECT_INFO
85    .long 3                         # DW_SECT_ABBREV
86    .long 5                         # DW_SECT_LOC
87## Row 1:
88    .long 0                         # Offset in .debug_info.dwo
89    .long 0                         # Offset in .debug_abbrev.dwo
90    .long .LLocBegin-.debug_loc.dwo # Offset in .debug_loc.dwo
91## Table of Section Sizes:
92    .long .LCUEnd-.LCUBegin         # Size in .debug_info.dwo
93    .long .LAbbrevEnd-.LAbbrevBegin # Size in .debug_abbrev.dwo
94    .long .LLocEnd-.LLocBegin       # Size in .debug_loc.dwo
95