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