xref: /llvm-project/lldb/test/Shell/SymbolFile/DWARF/x86/dwarf5-split.s (revision 8a64d80a959bf2844df33f9112e456f33de7b468)
1## This test checks that lldb reads debug info from a dwp file when the dwo_id
2## is in a DWARF5 CU header instead of a DW_AT_GNU_dwo_id attribute.
3
4# RUN: llvm-mc --filetype=obj --triple x86_64 %s -o %t --defsym MAIN=1
5# RUN: llvm-mc --filetype=obj --triple x86_64 %s -o %t.dwp
6# RUN: %lldb %t -o "target variable i" -b | FileCheck %s
7# CHECK: (int) i = 42
8
9.ifdef MAIN
10## Main file
11	.text
12	.globl	main                            # -- Begin function main
13main:                                   # @main
14.Lfunc_begin0:
15	pushq	%rbp
16	movq	%rsp, %rbp
17	xorl	%eax, %eax
18	popq	%rbp
19	retq
20.Lfunc_end0:
21                                        # -- End function
22	.data
23i:
24	.long	42                              # 0x2a
25
26
27	.section	.debug_abbrev,"",@progbits
28	.byte	1                               # Abbreviation Code
29	.byte	74                              # DW_TAG_skeleton_unit
30	.byte	0                               # DW_CHILDREN_no
31	.byte	118                             # DW_AT_dwo_name
32	.byte	8                               # DW_FORM_string
33	.byte	17                              # DW_AT_low_pc
34	.byte	27                              # DW_FORM_addrx
35	.byte	18                              # DW_AT_high_pc
36	.byte	6                               # DW_FORM_data4
37	.byte	115                             # DW_AT_addr_base
38	.byte	23                              # DW_FORM_sec_offset
39	.byte	0                               # EOM(1)
40	.byte	0                               # EOM(2)
41	.byte	0                               # EOM(3)
42
43
44	.section	.debug_info,"",@progbits
45.Lcu_begin0:
46	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
47.Ldebug_info_start0:
48	.short	5                             # DWARF version number
49	.byte	4                               # DWARF Unit Type
50	.byte	8                               # Address Size (in bytes)
51	.long	.debug_abbrev                   # Offset Into Abbrev. Section
52	.quad	1026699901672188186             # dwo_id
53	.byte	1                               # Abbrev [1] 0x14:0x14 DW_TAG_skeleton_unit
54	.asciz "hello.dwo"                    # DW_AT_dwo_name
55	.byte	1                               # DW_AT_low_pc
56	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
57	.long	.Laddr_table_base0              # DW_AT_addr_base
58.Ldebug_info_end0:
59
60	.section	.debug_addr,"",@progbits
61	.long	.Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
62.Ldebug_addr_start0:
63	.short	5                               # DWARF version number
64	.byte	8                               # Address size
65	.byte	0                               # Segment selector size
66.Laddr_table_base0:
67	.quad	i
68	.quad	.Lfunc_begin0
69.Ldebug_addr_end0:
70
71.else
72## DWP file
73	.section	.debug_str_offsets.dwo,"e",@progbits
74	.long	28
75	.short	5
76	.short	0
77
78
79	.section	.debug_str.dwo,"eMS",@progbits,1
80.Linfo_string0:
81	.asciz	"i"
82.Linfo_string1:
83	.asciz	"int"
84.Linfo_string2:
85	.asciz	"main"
86.Linfo_string3:
87	.asciz	"hand-tuned clang output"
88.Linfo_string4:
89	.asciz	"hello.c"
90.Linfo_string5:
91	.asciz	"hello.dwo"
92
93
94	.section	.debug_str_offsets.dwo,"e",@progbits
95	.long	.Linfo_string0-.debug_str.dwo
96	.long	.Linfo_string1-.debug_str.dwo
97	.long	.Linfo_string2-.debug_str.dwo
98	.long	.Linfo_string3-.debug_str.dwo
99	.long	.Linfo_string4-.debug_str.dwo
100	.long	.Linfo_string5-.debug_str.dwo
101.Lstr_offsets_end:
102
103
104	.section	.debug_info.dwo,"e",@progbits
105	.long	.Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
106.Ldebug_info_dwo_start0:
107	.short	5                               # DWARF version number
108	.byte	5                               # DWARF Unit Type
109	.byte	8                               # Address Size (in bytes)
110	.long	0                               # Offset Into Abbrev. Section
111	.quad	1026699901672188186             # dwo_id
112	.byte	1                               # Abbrev [1] 0x14:0x25 DW_TAG_compile_unit
113	.byte	3                               # DW_AT_producer
114	.short	12                              # DW_AT_language
115	.byte	4                               # DW_AT_name
116	.byte	5                               # DW_AT_dwo_name
117	.byte	2                               # Abbrev [2] 0x1a:0xb DW_TAG_variable
118	.byte	0                               # DW_AT_name
119	.long	37                              # DW_AT_type
120                                        # DW_AT_external
121	.byte	0                               # DW_AT_decl_file
122	.byte	2                               # DW_AT_decl_line
123	.byte	2                               # DW_AT_location
124	.byte	161
125	.byte	0
126	.byte	3                               # Abbrev [3] 0x25:0x4 DW_TAG_base_type
127	.byte	1                               # DW_AT_name
128	.byte	5                               # DW_AT_encoding
129	.byte	4                               # DW_AT_byte_size
130	.byte	4                               # Abbrev [4] 0x29:0xf DW_TAG_subprogram
131	.byte	1                               # DW_AT_low_pc
132	.long	8       # DW_AT_high_pc
133	.byte	1                               # DW_AT_frame_base
134	.byte	86
135	.byte	2                               # DW_AT_name
136	.byte	0                               # DW_AT_decl_file
137	.byte	3                               # DW_AT_decl_line
138	.long	37                              # DW_AT_type
139                                        # DW_AT_external
140	.byte	0                               # End Of Children Mark
141.Ldebug_info_dwo_end0:
142
143
144	.section	.debug_abbrev.dwo,"e",@progbits
145	.byte	1                               # Abbreviation Code
146	.byte	17                              # DW_TAG_compile_unit
147	.byte	1                               # DW_CHILDREN_yes
148	.byte	37                              # DW_AT_producer
149	.byte	37                              # DW_FORM_strx1
150	.byte	19                              # DW_AT_language
151	.byte	5                               # DW_FORM_data2
152	.byte	3                               # DW_AT_name
153	.byte	37                              # DW_FORM_strx1
154	.byte	118                             # DW_AT_dwo_name
155	.byte	37                              # DW_FORM_strx1
156	.byte	0                               # EOM(1)
157	.byte	0                               # EOM(2)
158	.byte	2                               # Abbreviation Code
159	.byte	52                              # DW_TAG_variable
160	.byte	0                               # DW_CHILDREN_no
161	.byte	3                               # DW_AT_name
162	.byte	37                              # DW_FORM_strx1
163	.byte	73                              # DW_AT_type
164	.byte	19                              # DW_FORM_ref4
165	.byte	63                              # DW_AT_external
166	.byte	25                              # DW_FORM_flag_present
167	.byte	58                              # DW_AT_decl_file
168	.byte	11                              # DW_FORM_data1
169	.byte	59                              # DW_AT_decl_line
170	.byte	11                              # DW_FORM_data1
171	.byte	2                               # DW_AT_location
172	.byte	24                              # DW_FORM_exprloc
173	.byte	0                               # EOM(1)
174	.byte	0                               # EOM(2)
175	.byte	3                               # Abbreviation Code
176	.byte	36                              # DW_TAG_base_type
177	.byte	0                               # DW_CHILDREN_no
178	.byte	3                               # DW_AT_name
179	.byte	37                              # DW_FORM_strx1
180	.byte	62                              # DW_AT_encoding
181	.byte	11                              # DW_FORM_data1
182	.byte	11                              # DW_AT_byte_size
183	.byte	11                              # DW_FORM_data1
184	.byte	0                               # EOM(1)
185	.byte	0                               # EOM(2)
186	.byte	4                               # Abbreviation Code
187	.byte	46                              # DW_TAG_subprogram
188	.byte	0                               # DW_CHILDREN_no
189	.byte	17                              # DW_AT_low_pc
190	.byte	27                              # DW_FORM_addrx
191	.byte	18                              # DW_AT_high_pc
192	.byte	6                               # DW_FORM_data4
193	.byte	64                              # DW_AT_frame_base
194	.byte	24                              # DW_FORM_exprloc
195	.byte	3                               # DW_AT_name
196	.byte	37                              # DW_FORM_strx1
197	.byte	58                              # DW_AT_decl_file
198	.byte	11                              # DW_FORM_data1
199	.byte	59                              # DW_AT_decl_line
200	.byte	11                              # DW_FORM_data1
201	.byte	73                              # DW_AT_type
202	.byte	19                              # DW_FORM_ref4
203	.byte	63                              # DW_AT_external
204	.byte	25                              # DW_FORM_flag_present
205	.byte	0                               # EOM(1)
206	.byte	0                               # EOM(2)
207	.byte	0                               # EOM(3)
208.Ldebug_abbrev_end:
209
210.section .debug_cu_index,"",@progbits
211.short 5  # DWARF version number
212.short 0  # Reserved
213.long  3  # Section count
214.long  1  # Unit count
215.long  2 # Slot count
216
217.quad  1026699901672188186, 0 # Hash table
218.long  1, 0 # Index table
219
220## Table header
221.long 1   # DW_SECT_INFO
222.long 3   # DW_SECT_ABBREV
223.long 6   # DW_SECT_STR_OFFSETS
224
225## Offsets
226.long 0   # offset into .debug_info.dwo
227.long 0   # offset into .debug_abbrev.dwo
228.long 0   # offset into .debug_str_offsets.dwo
229
230## Sizes
231.long .Ldebug_info_dwo_end0 - .debug_info.dwo
232.long .Ldebug_abbrev_end - .debug_abbrev.dwo
233.long .Lstr_offsets_end - .debug_str_offsets.dwo
234
235.endif
236