xref: /llvm-project/llvm/test/DebugInfo/X86/dwp-v5-loclists.s (revision a93b77b97f105db911316d896056dc8718a850e3)
149737df7SIgor Kudrin## The test checks that v5 compile units in package files read their
249737df7SIgor Kudrin## location tables from .debug_loclists.dwo sections.
349737df7SIgor Kudrin## See dwp-v2-loc.s for pre-v5 units.
449737df7SIgor Kudrin
549737df7SIgor Kudrin# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \
649737df7SIgor Kudrin# RUN:   llvm-dwarfdump -debug-info -debug-loclists - | \
749737df7SIgor Kudrin# RUN:   FileCheck %s
849737df7SIgor Kudrin
949737df7SIgor Kudrin# CHECK:      .debug_info.dwo contents:
1049737df7SIgor Kudrin# CHECK:      DW_TAG_compile_unit
1149737df7SIgor Kudrin# CHECK:      DW_TAG_variable
1249737df7SIgor Kudrin# CHECK-NEXT:   DW_AT_name ("a")
1349737df7SIgor Kudrin# CHECK-NEXT:   DW_AT_location (0x{{[0-9a-f]+}}:
1449737df7SIgor Kudrin# CHECK-NEXT:     DW_LLE_startx_length (0x0000000000000001, 0x0000000000000010): DW_OP_reg5 RDI)
15*a93b77b9SIgor Kudrin# CHECK:      DW_TAG_variable
16*a93b77b9SIgor Kudrin# CHECK-NEXT:   DW_AT_name ("b")
17*a93b77b9SIgor Kudrin# CHECK-NEXT:   DW_AT_location (indexed (0x1) loclist = 0x{{[0-9a-f]+}}:
18*a93b77b9SIgor Kudrin# CHECK-NEXT:     DW_LLE_startx_length (0x0000000000000005, 0x0000000000000020): DW_OP_regx RDI)
1949737df7SIgor Kudrin
2049737df7SIgor Kudrin# CHECK:      .debug_loclists.dwo contents:
2149737df7SIgor Kudrin# CHECK:      locations list header:
2249737df7SIgor Kudrin# CHECK:      locations list header:
23*a93b77b9SIgor Kudrin# CHECK:      offsets:
2449737df7SIgor Kudrin# CHECK:      0x{{[0-9a-f]+}}:
2549737df7SIgor Kudrin# CHECK-NEXT:   DW_LLE_startx_length (0x0000000000000001, 0x0000000000000010): DW_OP_reg5 RDI
26*a93b77b9SIgor Kudrin# CHECK:      0x{{[0-9a-f]+}}:
27*a93b77b9SIgor Kudrin# CHECK-NEXT:   DW_LLE_startx_length (0x0000000000000005, 0x0000000000000020): DW_OP_regx RDI
2849737df7SIgor Kudrin
2949737df7SIgor Kudrin.section .debug_abbrev.dwo, "e", @progbits
3049737df7SIgor Kudrin.LAbbrevBegin:
3149737df7SIgor Kudrin    .uleb128 1                          # Abbreviation Code
3249737df7SIgor Kudrin    .uleb128 17                         # DW_TAG_compile_unit
3349737df7SIgor Kudrin    .byte 1                             # DW_CHILDREN_yes
3449737df7SIgor Kudrin    .byte 0                             # EOM(1)
3549737df7SIgor Kudrin    .byte 0                             # EOM(2)
3649737df7SIgor Kudrin    .uleb128 2                          # Abbreviation Code
3749737df7SIgor Kudrin    .uleb128 52                         # DW_TAG_variable
3849737df7SIgor Kudrin    .byte 0                             # DW_CHILDREN_no
3949737df7SIgor Kudrin    .uleb128 3                          # DW_AT_name
4049737df7SIgor Kudrin    .uleb128 8                          # DW_FORM_string
4149737df7SIgor Kudrin    .uleb128 2                          # DW_AT_location
4249737df7SIgor Kudrin    .uleb128 23                         # DW_FORM_sec_offset
4349737df7SIgor Kudrin    .byte 0                             # EOM(1)
4449737df7SIgor Kudrin    .byte 0                             # EOM(2)
45*a93b77b9SIgor Kudrin    .uleb128 3                          # Abbreviation Code
46*a93b77b9SIgor Kudrin    .uleb128 52                         # DW_TAG_variable
47*a93b77b9SIgor Kudrin    .byte 0                             # DW_CHILDREN_no
48*a93b77b9SIgor Kudrin    .uleb128 3                          # DW_AT_name
49*a93b77b9SIgor Kudrin    .uleb128 8                          # DW_FORM_string
50*a93b77b9SIgor Kudrin    .uleb128 2                          # DW_AT_location
51*a93b77b9SIgor Kudrin    .uleb128 34                         # DW_FORM_loclistx
52*a93b77b9SIgor Kudrin    .byte 0                             # EOM(1)
53*a93b77b9SIgor Kudrin    .byte 0                             # EOM(2)
5449737df7SIgor Kudrin    .byte 0                             # EOM(3)
5549737df7SIgor Kudrin.LAbbrevEnd:
5649737df7SIgor Kudrin
5749737df7SIgor Kudrin    .section .debug_info.dwo, "e", @progbits
5849737df7SIgor Kudrin.LCUBegin:
5949737df7SIgor Kudrin    .long .LCUEnd-.LCUVersion           # Length of Unit
6049737df7SIgor Kudrin.LCUVersion:
6149737df7SIgor Kudrin    .short 5                            # Version
6249737df7SIgor Kudrin    .byte 5                             # DW_UT_split_compile
6349737df7SIgor Kudrin    .byte 8                             # Address size
6449737df7SIgor Kudrin    .long 0                             # Abbrev offset
6549737df7SIgor Kudrin    .quad 0x1100001122222222            # DWO id
6649737df7SIgor Kudrin    .uleb128 1                          # Abbrev [1] DW_TAG_compile_unit
6749737df7SIgor Kudrin    .uleb128 2                          # Abbrev [2] DW_TAG_variable
6849737df7SIgor Kudrin    .asciz "a"                          # DW_AT_name
69*a93b77b9SIgor Kudrin    .long .LLL0-.LLLBegin               # DW_AT_location (DW_FORM_sec_offset)
70*a93b77b9SIgor Kudrin    .uleb128 3                          # Abbrev [3] DW_TAG_variable
71*a93b77b9SIgor Kudrin    .asciz "b"                          # DW_AT_name
72*a93b77b9SIgor Kudrin    .uleb128 1                          # DW_AT_location (DW_FORM_loclistx)
7349737df7SIgor Kudrin    .byte 0                             # End Of Children Mark
7449737df7SIgor Kudrin.LCUEnd:
7549737df7SIgor Kudrin
7649737df7SIgor Kudrin.section .debug_loclists.dwo, "e", @progbits
7749737df7SIgor Kudrin## Start the section with an unused table to check that the reading offset
7849737df7SIgor Kudrin## of the real table is correctly adjusted.
7949737df7SIgor Kudrin    .long .LLLDummyEnd-.LLLDummyVersion # Length of Unit
8049737df7SIgor Kudrin.LLLDummyVersion:
8149737df7SIgor Kudrin    .short 5                            # Version
8249737df7SIgor Kudrin    .byte 8                             # Address size
8349737df7SIgor Kudrin    .byte 0                             # Segment selector size
8449737df7SIgor Kudrin    .long 0                             # Offset entry count
8549737df7SIgor Kudrin    .byte 0                             # DW_LLE_end_of_list
8649737df7SIgor Kudrin.LLLDummyEnd:
8749737df7SIgor Kudrin
8849737df7SIgor Kudrin.LLLBegin:
8949737df7SIgor Kudrin    .long .LLLEnd-.LLLVersion           # Length of Unit
9049737df7SIgor Kudrin.LLLVersion:
9149737df7SIgor Kudrin    .short 5                            # Version
9249737df7SIgor Kudrin    .byte 8                             # Address size
9349737df7SIgor Kudrin    .byte 0                             # Segment selector size
94*a93b77b9SIgor Kudrin    .long 2                             # Offset entry count
95*a93b77b9SIgor Kudrin.LLLBase:
96*a93b77b9SIgor Kudrin    .long .LLL0-.LLLBase
97*a93b77b9SIgor Kudrin    .long .LLL1-.LLLBase
9849737df7SIgor Kudrin.LLL0:
9949737df7SIgor Kudrin    .byte 3                             # DW_LLE_startx_length
10049737df7SIgor Kudrin    .uleb128 1                          # Index
10149737df7SIgor Kudrin    .uleb128 0x10                       # Length
10249737df7SIgor Kudrin    .uleb128 1                          # Loc expr size
10349737df7SIgor Kudrin    .byte 85                            # DW_OP_reg5
10449737df7SIgor Kudrin    .byte 0                             # DW_LLE_end_of_list
105*a93b77b9SIgor Kudrin.LLL1:
106*a93b77b9SIgor Kudrin    .byte 3                             # DW_LLE_startx_length
107*a93b77b9SIgor Kudrin    .uleb128 5                          # Index
108*a93b77b9SIgor Kudrin    .uleb128 0x20                       # Length
109*a93b77b9SIgor Kudrin    .uleb128 2                          # Loc expr size
110*a93b77b9SIgor Kudrin    .byte 144                           # DW_OP_regx
111*a93b77b9SIgor Kudrin    .uleb128 5                          # RDI
112*a93b77b9SIgor Kudrin    .byte 0                             # DW_LLE_end_of_list
11349737df7SIgor Kudrin.LLLEnd:
11449737df7SIgor Kudrin
11549737df7SIgor Kudrin    .section .debug_cu_index, "", @progbits
11649737df7SIgor Kudrin## Header:
11749737df7SIgor Kudrin    .short 5                            # Version
11849737df7SIgor Kudrin    .space 2                            # Padding
11949737df7SIgor Kudrin    .long 3                             # Section count
12049737df7SIgor Kudrin    .long 1                             # Unit count
12149737df7SIgor Kudrin    .long 2                             # Slot count
12249737df7SIgor Kudrin## Hash Table of Signatures:
12349737df7SIgor Kudrin    .quad 0x1100001122222222
12449737df7SIgor Kudrin    .quad 0
12549737df7SIgor Kudrin## Parallel Table of Indexes:
12649737df7SIgor Kudrin    .long 1
12749737df7SIgor Kudrin    .long 0
12849737df7SIgor Kudrin## Table of Section Offsets:
12949737df7SIgor Kudrin## Row 0:
13049737df7SIgor Kudrin    .long 1                             # DW_SECT_INFO
13149737df7SIgor Kudrin    .long 3                             # DW_SECT_ABBREV
13249737df7SIgor Kudrin    .long 5                             # DW_SECT_LOCLISTS
13349737df7SIgor Kudrin## Row 1:
13449737df7SIgor Kudrin    .long 0                             # Offset in .debug_info.dwo
13549737df7SIgor Kudrin    .long 0                             # Offset in .debug_abbrev.dwo
13649737df7SIgor Kudrin    .long .LLLBegin-.debug_loclists.dwo # Offset in .debug_loclists.dwo
13749737df7SIgor Kudrin## Table of Section Sizes:
13849737df7SIgor Kudrin    .long .LCUEnd-.LCUBegin             # Size in .debug_info.dwo
13949737df7SIgor Kudrin    .long .LAbbrevEnd-.LAbbrevBegin     # Size in .debug_abbrev.dwo
14049737df7SIgor Kudrin    .long .LLLEnd-.LLLBegin             # Size in .debug_loclists.dwo
141