xref: /llvm-project/lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists-dwp.s (revision ec671f3ea00bcbd7cca7f0d9209c9d775dd47c39)
1## This tests if .debug_rnglists.dwo are correctly read if they are part
2## of a dwp file.
3
4# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s --defsym MAIN=0 > %t
5# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t.dwp
6# RUN: %lldb %t -o "image lookup -v -s lookup_rnglists" -o exit | FileCheck %s
7
8# CHECK-LABEL: image lookup -v -s lookup_rnglists
9# CHECK:  Function: id = {{.*}}, name = "rnglists", range = [0x0000000000000000-0x0000000000000003)
10# CHECK:    Blocks: id = {{.*}}, range = [0x00000000-0x00000003)
11# CHECK-NEXT:       id = {{.*}}, range = [0x00000001-0x00000002)
12
13        .text
14rnglists:
15        nop
16.Lblock1_begin:
17lookup_rnglists:
18        nop
19.Lblock1_end:
20        nop
21.Lrnglists_end:
22
23## The main file.
24.ifdef MAIN
25        .section        .debug_abbrev,"",@progbits
26        .byte   1                       # Abbreviation Code
27        .byte   17                      # DW_TAG_compile_unit
28        .byte   0                       # DW_CHILDREN_no
29        .byte   0x76                    # DW_AT_dwo_name
30        .byte   8                       # DW_FORM_string
31        .byte   115                     # DW_AT_addr_base
32        .byte   23                      # DW_FORM_sec_offset
33        .byte   85                      # DW_AT_ranges
34        .byte   35                      # DW_FORM_rnglistx
35        .byte   116                     # DW_AT_rnglists_base
36        .byte   23                      # DW_FORM_sec_offset
37        .byte   0                       # EOM(1)
38        .byte   0                       # EOM(2)
39        .byte   0                       # EOM(3)
40
41        .section        .debug_info,"",@progbits
42.Lcu_begin0:
43        .long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
44.Ldebug_info_start0:
45        .short  5                       # DWARF version number
46        .byte   4                       # DWARF Unit Type
47        .byte   8                       # Address Size (in bytes)
48        .long   .debug_abbrev           # Offset Into Abbrev. Section
49        .quad   1026699901672188186     # DWO id
50        .byte   1                       # Abbrev [1] DW_TAG_compile_unit
51        .asciz  "debug_rnglists-dwp.s.tmp.dwo"  # DW_AT_dwo_name
52        .long   .Laddr_table_base0      # DW_AT_addr_base
53        .byte   0                       # DW_AT_ranges
54        .long   .Lskel_rnglists_table_base # DW_AT_rnglists_base
55.Ldebug_info_end0:
56
57        .section        .debug_addr,"",@progbits
58        .long   .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
59.Ldebug_addr_start0:
60        .short  5                       # DWARF version number
61        .byte   8                       # Address size
62        .byte   0                       # Segment selector size
63.Laddr_table_base0:
64        .quad   rnglists
65        .quad   .Lblock1_begin
66.Ldebug_addr_end0:
67
68        .section        .debug_rnglists,"",@progbits
69        .long   .Lskel_rnglist_table_end-.Lskel_rnglist_table_start # Length
70.Lskel_rnglist_table_start:
71        .short  5                       # Version
72        .byte   8                       # Address size
73        .byte   0                       # Segment selector size
74        .long   1                       # Offset entry count
75.Lskel_rnglists_table_base:
76        .long   .Lskel_ranges0-.Lskel_rnglists_table_base
77.Lskel_ranges0:
78        .byte   7                       # DW_RLE_start_length
79        .quad   rnglists
80        .uleb128   .Lrnglists_end-rnglists
81        .byte   0                       # DW_RLE_end_of_list
82.Lskel_rnglist_table_end:
83 .else
84 ## DWP file starts here.
85        .section        .debug_abbrev.dwo,"e",@progbits
86.LAbbrevBegin:
87        .byte   1                       # Abbreviation Code
88        .byte   17                      # DW_TAG_compile_unit
89        .byte   1                       # DW_CHILDREN_yes
90        .byte   37                      # DW_AT_producer
91        .byte   8                       # DW_FORM_string
92        .byte   0                       # EOM(1)
93        .byte   0                       # EOM(2)
94        .byte   2                       # Abbreviation Code
95        .byte   46                      # DW_TAG_subprogram
96        .byte   1                       # DW_CHILDREN_yes
97        .byte   17                      # DW_AT_low_pc
98        .byte   27                      # DW_FORM_addrx
99        .byte   18                      # DW_AT_high_pc
100        .byte   6                       # DW_FORM_data4
101        .byte   3                       # DW_AT_name
102        .byte   8                       # DW_FORM_string
103        .byte   0                       # EOM(1)
104        .byte   0                       # EOM(2)
105        .byte   5                       # Abbreviation Code
106        .byte   11                      # DW_TAG_lexical_block
107        .byte   0                       # DW_CHILDREN_no
108        .byte   85                      # DW_AT_ranges
109        .byte   35                      # DW_FORM_rnglistx
110        .byte   0                       # EOM(1)
111        .byte   0                       # EOM(2)
112        .byte   0                       # EOM(3)
113.LAbbrevEnd:
114        .section        .debug_info.dwo,"e",@progbits
115.LCUBegin:
116        .long   .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
117.Ldebug_info_start1:
118        .short  5                       # DWARF version number
119        .byte   5                       # DWARF Unit Type
120        .byte   8                       # Address Size (in bytes)
121        .long   0                       # Offset Into Abbrev. Section
122        .quad   1026699901672188186      # DWO id
123        .byte   1                       # Abbrev [1] DW_TAG_compile_unit
124        .asciz  "Hand-written DWARF"    # DW_AT_producer
125        .byte   2                       # Abbrev [2] DW_TAG_subprogram
126        .byte   0                       # DW_AT_low_pc
127        .long   .Lrnglists_end-rnglists # DW_AT_high_pc
128        .asciz  "rnglists"              # DW_AT_name
129        .byte   5                       # Abbrev [5] DW_TAG_lexical_block
130        .byte   0                       # DW_AT_ranges
131        .byte   0                       # End Of Children Mark
132        .byte   0                       # End Of Children Mark
133.Ldebug_info_end1:
134.LCUEnd:
135        .section        .debug_rnglists.dwo,"e",@progbits
136## Fake rnglists to check if the cu index is taken into account
137        .long   .Lfake_rnglist_end-.Lfake_rnglist_start # Length
138.Lfake_rnglist_start:
139        .short  5                       # Version
140        .byte   8                       # Address size
141        .byte   0                       # Segment selector size
142        .long   0                       # Offset entry count
143        .byte   0                       # DW_RLE_end_of_list
144.Lfake_rnglist_end:
145.LRLBegin:
146        .long   .Ldwo_rnglist_table_end-.Ldwo_rnglist_table_start # Length
147.Ldwo_rnglist_table_start:
148        .short  5                       # Version
149        .byte   8                       # Address size
150        .byte   0                       # Segment selector size
151        .long   1                       # Offset entry count
152.Ldwo_rnglists_table_base:
153        .long   .Ldwo_ranges-.Ldwo_rnglists_table_base
154.Ldwo_ranges:
155        .byte   3                       # DW_RLE_startx_length
156        .uleb128 1
157        .uleb128 .Lblock1_end-.Lblock1_begin
158        .byte   0                       # DW_RLE_end_of_list
159.Ldwo_rnglist_table_end:
160.LRLEnd:
161        .section .debug_cu_index, "", @progbits
162## Header:
163        .short 5                        # Version
164        .short 0                        # Padding
165        .long 3                         # Section count
166        .long 1                         # Unit count
167        .long 2                         # Slot count
168## Hash Table of Signatures:
169        .quad 1026699901672188186
170        .quad 0
171## Parallel Table of Indexes:
172        .long 1
173        .long 0
174## Table of Section Offsets:
175## Row 0:
176        .long 1                         # DW_SECT_INFO
177        .long 3                         # DW_SECT_ABBREV
178        .long 8                         # DW_SECT_RNGLISTS
179## Row 1:
180        .long 0                         # Offset in .debug_info.dwo
181        .long 0                         # Offset in .debug_abbrev.dwo
182        .long .LRLBegin-.debug_rnglists.dwo # Offset in .debug_rnglists.dwo
183## Table of Section Sizes:
184        .long .LCUEnd-.LCUBegin         # Size in .debug_info.dwo
185        .long .LAbbrevEnd-.LAbbrevBegin # Size in .debug_abbrev.dwo
186        .long .LRLEnd-.LRLBegin         # Size in .debug_rnglists.dwo
187.endif
188