xref: /llvm-project/llvm/test/tools/llvm-symbolizer/split-dwarf-base-addr.s (revision 88732ed86b9d741c911e45b12fd166cbb9cd026b)
1# REQUIRES: x86-registered-target
2
3# RUN: rm -rf %t
4# RUN: mkdir -p %t
5# RUN: llvm-mc --triple x86_64 %s -o %t/test.o -filetype=obj
6# RUN: cd %t
7
8# RUN: llvm-symbolizer -e test.o 0x30 | FileCheck %s
9
10# CHECK: f1()
11# CHECK: .{{/|\\}}test.cpp:6:3
12# CHECK: main
13# CHECK: .{{/|\\}}test.cpp:7:3
14
15
16	.text
17	.zero 42
18	.file	"test.cpp"
19	.file	0 "./" "test.cpp" md5 0x03b7c6de668697331888d80c6ad0d69e
20	.globl	main                            # -- Begin function main
21	.p2align	4, 0x90
22	.type	main,@function
23main:                                   # @main
24.Lfunc_begin0:
25	.cfi_startproc
26# %bb.0:                                # %entry
27	.loc	0 6 3 prologue_end              # test.cpp:6:3
28	incl	i(%rip)
29.Ltmp0:
30	.loc	0 3 3                           # test.cpp:3:3
31	incl	i(%rip)
32.Ltmp1:
33	.loc	0 8 1                           # test.cpp:8:1
34	xorl	%eax, %eax
35	retq
36.Ltmp2:
37.Lfunc_end0:
38	.size	main, .Lfunc_end0-main
39	.cfi_endproc
40                                        # -- End function
41	.type	i,@object                       # @i
42	.bss
43	.globl	i
44	.p2align	2, 0x0
45i:
46	.long	0                               # 0x0
47	.size	i, 4
48
49	.section	.debug_abbrev,"",@progbits
50	.byte	1                               # Abbreviation Code
51	.byte	74                              # DW_TAG_skeleton_unit
52	.byte	0                               # DW_CHILDREN_no
53	.byte	16                              # DW_AT_stmt_list
54	.byte	23                              # DW_FORM_sec_offset
55	.byte	114                             # DW_AT_str_offsets_base
56	.byte	23                              # DW_FORM_sec_offset
57	.byte	27                              # DW_AT_comp_dir
58	.byte	37                              # DW_FORM_strx1
59	.ascii	"\264B"                         # DW_AT_GNU_pubnames
60	.byte	25                              # DW_FORM_flag_present
61	.byte	118                             # DW_AT_dwo_name
62	.byte	37                              # DW_FORM_strx1
63	.byte	17                              # DW_AT_low_pc
64	.byte	27                              # DW_FORM_addrx
65	.byte	18                              # DW_AT_high_pc
66	.byte	6                               # DW_FORM_data4
67	.byte	115                             # DW_AT_addr_base
68	.byte	23                              # DW_FORM_sec_offset
69	.byte	0                               # EOM(1)
70	.byte	0                               # EOM(2)
71	.byte	0                               # EOM(3)
72	.section	.debug_info,"",@progbits
73.Lcu_begin0:
74	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
75.Ldebug_info_start0:
76	.short	5                               # DWARF version number
77	.byte	4                               # DWARF Unit Type
78	.byte	8                               # Address Size (in bytes)
79	.long	.debug_abbrev                   # Offset Into Abbrev. Section
80	.quad	6427667746655966506
81	.byte	1                               # Abbrev [1] 0x14:0x14 DW_TAG_skeleton_unit
82	.long	.Lline_table_start0             # DW_AT_stmt_list
83	.long	.Lstr_offsets_base0             # DW_AT_str_offsets_base
84	.byte	0                               # DW_AT_comp_dir
85                                        # DW_AT_GNU_pubnames
86	.byte	1                               # DW_AT_dwo_name
87	.byte	1                               # DW_AT_low_pc
88	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
89	.long	.Laddr_table_base0              # DW_AT_addr_base
90.Ldebug_info_end0:
91	.section	.debug_str_offsets,"",@progbits
92	.long	12                              # Length of String Offsets Set
93	.short	5
94	.short	0
95.Lstr_offsets_base0:
96	.section	.debug_str,"MS",@progbits,1
97.Lskel_string0:
98	.asciz	"." # string offset=0
99.Lskel_string1:
100	.asciz	"test.o"                        # string offset=43
101	.section	.debug_str_offsets,"",@progbits
102	.long	.Lskel_string0
103	.long	.Lskel_string1
104	.section	.debug_str_offsets.dwo,"e",@progbits
105	.long	36                              # Length of String Offsets Set
106	.short	5
107	.short	0
108	.section	.debug_str.dwo,"eMS",@progbits,1
109.Linfo_string0:
110	.asciz	"i"                             # string offset=0
111.Linfo_string1:
112	.asciz	"int"                           # string offset=2
113.Linfo_string2:
114	.asciz	"_Z2f1v"                        # string offset=6
115.Linfo_string3:
116	.asciz	"f1"                            # string offset=13
117.Linfo_string4:
118	.asciz	"main"                          # string offset=16
119.Linfo_string5:
120	.asciz	"clang version 17.0.0 (git@github.com:llvm/llvm-project.git 6963c61f0f6e4be2039cb45e824ea1e83a8f1526)" # string offset=21
121.Linfo_string6:
122	.asciz	"test.cpp"                      # string offset=122
123.Linfo_string7:
124	.asciz	"test.o"                        # string offset=131
125	.section	.debug_str_offsets.dwo,"e",@progbits
126	.long	0
127	.long	2
128	.long	6
129	.long	13
130	.long	16
131	.long	21
132	.long	122
133	.long	131
134	.section	.debug_info.dwo,"e",@progbits
135	.long	.Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
136.Ldebug_info_dwo_start0:
137	.short	5                               # DWARF version number
138	.byte	5                               # DWARF Unit Type
139	.byte	8                               # Address Size (in bytes)
140	.long	0                               # Offset Into Abbrev. Section
141	.quad	6427667746655966506
142	.byte	1                               # Abbrev [1] 0x14:0x39 DW_TAG_compile_unit
143	.byte	5                               # DW_AT_producer
144	.short	33                              # DW_AT_language
145	.byte	6                               # DW_AT_name
146	.byte	7                               # DW_AT_dwo_name
147	.byte	2                               # Abbrev [2] 0x1a:0xb DW_TAG_variable
148	.byte	0                               # DW_AT_name
149	.long	37                              # DW_AT_type
150                                        # DW_AT_external
151	.byte	0                               # DW_AT_decl_file
152	.byte	1                               # DW_AT_decl_line
153	.byte	2                               # DW_AT_location
154	.byte	161
155	.byte	0
156	.byte	3                               # Abbrev [3] 0x25:0x5 DW_TAG_volatile_type
157	.long	42                              # DW_AT_type
158	.byte	4                               # Abbrev [4] 0x2a:0x4 DW_TAG_base_type
159	.byte	1                               # DW_AT_name
160	.byte	5                               # DW_AT_encoding
161	.byte	4                               # DW_AT_byte_size
162	.byte	5                               # Abbrev [5] 0x2e:0x5 DW_TAG_subprogram
163	.byte	2                               # DW_AT_linkage_name
164	.byte	3                               # DW_AT_name
165	.byte	0                               # DW_AT_decl_file
166	.byte	2                               # DW_AT_decl_line
167                                        # DW_AT_external
168                                        # DW_AT_inline
169	.byte	6                               # Abbrev [6] 0x33:0x19 DW_TAG_subprogram
170	.byte	1                               # DW_AT_low_pc
171	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
172	.byte	1                               # DW_AT_frame_base
173	.byte	87
174                                        # DW_AT_call_all_calls
175	.byte	4                               # DW_AT_name
176	.byte	0                               # DW_AT_decl_file
177	.byte	5                               # DW_AT_decl_line
178	.long	42                              # DW_AT_type
179                                        # DW_AT_external
180	.byte	7                               # Abbrev [7] 0x42:0x9 DW_TAG_inlined_subroutine
181	.long	46                              # DW_AT_abstract_origin
182	.byte	0                               # DW_AT_ranges
183	.byte	0                               # DW_AT_call_file
184	.byte	7                               # DW_AT_call_line
185	.byte	3                               # DW_AT_call_column
186	.byte	0                               # End Of Children Mark
187	.byte	0                               # End Of Children Mark
188.Ldebug_info_dwo_end0:
189	.section	.debug_abbrev.dwo,"e",@progbits
190	.byte	1                               # Abbreviation Code
191	.byte	17                              # DW_TAG_compile_unit
192	.byte	1                               # DW_CHILDREN_yes
193	.byte	37                              # DW_AT_producer
194	.byte	37                              # DW_FORM_strx1
195	.byte	19                              # DW_AT_language
196	.byte	5                               # DW_FORM_data2
197	.byte	3                               # DW_AT_name
198	.byte	37                              # DW_FORM_strx1
199	.byte	118                             # DW_AT_dwo_name
200	.byte	37                              # DW_FORM_strx1
201	.byte	0                               # EOM(1)
202	.byte	0                               # EOM(2)
203	.byte	2                               # Abbreviation Code
204	.byte	52                              # DW_TAG_variable
205	.byte	0                               # DW_CHILDREN_no
206	.byte	3                               # DW_AT_name
207	.byte	37                              # DW_FORM_strx1
208	.byte	73                              # DW_AT_type
209	.byte	19                              # DW_FORM_ref4
210	.byte	63                              # DW_AT_external
211	.byte	25                              # DW_FORM_flag_present
212	.byte	58                              # DW_AT_decl_file
213	.byte	11                              # DW_FORM_data1
214	.byte	59                              # DW_AT_decl_line
215	.byte	11                              # DW_FORM_data1
216	.byte	2                               # DW_AT_location
217	.byte	24                              # DW_FORM_exprloc
218	.byte	0                               # EOM(1)
219	.byte	0                               # EOM(2)
220	.byte	3                               # Abbreviation Code
221	.byte	53                              # DW_TAG_volatile_type
222	.byte	0                               # DW_CHILDREN_no
223	.byte	73                              # DW_AT_type
224	.byte	19                              # DW_FORM_ref4
225	.byte	0                               # EOM(1)
226	.byte	0                               # EOM(2)
227	.byte	4                               # Abbreviation Code
228	.byte	36                              # DW_TAG_base_type
229	.byte	0                               # DW_CHILDREN_no
230	.byte	3                               # DW_AT_name
231	.byte	37                              # DW_FORM_strx1
232	.byte	62                              # DW_AT_encoding
233	.byte	11                              # DW_FORM_data1
234	.byte	11                              # DW_AT_byte_size
235	.byte	11                              # DW_FORM_data1
236	.byte	0                               # EOM(1)
237	.byte	0                               # EOM(2)
238	.byte	5                               # Abbreviation Code
239	.byte	46                              # DW_TAG_subprogram
240	.byte	0                               # DW_CHILDREN_no
241	.byte	110                             # DW_AT_linkage_name
242	.byte	37                              # DW_FORM_strx1
243	.byte	3                               # DW_AT_name
244	.byte	37                              # DW_FORM_strx1
245	.byte	58                              # DW_AT_decl_file
246	.byte	11                              # DW_FORM_data1
247	.byte	59                              # DW_AT_decl_line
248	.byte	11                              # DW_FORM_data1
249	.byte	63                              # DW_AT_external
250	.byte	25                              # DW_FORM_flag_present
251	.byte	32                              # DW_AT_inline
252	.byte	33                              # DW_FORM_implicit_const
253	.byte	1
254	.byte	0                               # EOM(1)
255	.byte	0                               # EOM(2)
256	.byte	6                               # Abbreviation Code
257	.byte	46                              # DW_TAG_subprogram
258	.byte	1                               # DW_CHILDREN_yes
259	.byte	17                              # DW_AT_low_pc
260	.byte	27                              # DW_FORM_addrx
261	.byte	18                              # DW_AT_high_pc
262	.byte	6                               # DW_FORM_data4
263	.byte	64                              # DW_AT_frame_base
264	.byte	24                              # DW_FORM_exprloc
265	.byte	122                             # DW_AT_call_all_calls
266	.byte	25                              # DW_FORM_flag_present
267	.byte	3                               # DW_AT_name
268	.byte	37                              # DW_FORM_strx1
269	.byte	58                              # DW_AT_decl_file
270	.byte	11                              # DW_FORM_data1
271	.byte	59                              # DW_AT_decl_line
272	.byte	11                              # DW_FORM_data1
273	.byte	73                              # DW_AT_type
274	.byte	19                              # DW_FORM_ref4
275	.byte	63                              # DW_AT_external
276	.byte	25                              # DW_FORM_flag_present
277	.byte	0                               # EOM(1)
278	.byte	0                               # EOM(2)
279	.byte	7                               # Abbreviation Code
280	.byte	29                              # DW_TAG_inlined_subroutine
281	.byte	0                               # DW_CHILDREN_no
282	.byte	49                              # DW_AT_abstract_origin
283	.byte	19                              # DW_FORM_ref4
284	.byte	85                              # DW_AT_ranges
285	.byte	35                              # DW_FORM_rnglistx
286	.byte	88                              # DW_AT_call_file
287	.byte	11                              # DW_FORM_data1
288	.byte	89                              # DW_AT_call_line
289	.byte	11                              # DW_FORM_data1
290	.byte	87                              # DW_AT_call_column
291	.byte	11                              # DW_FORM_data1
292	.byte	0                               # EOM(1)
293	.byte	0                               # EOM(2)
294	.byte	0                               # EOM(3)
295	.section	.debug_rnglists.dwo,"e",@progbits
296	.long	.Ldebug_list_header_end0-.Ldebug_list_header_start0 # Length
297.Ldebug_list_header_start0:
298	.short	5                               # Version
299	.byte	8                               # Address size
300	.byte	0                               # Segment selector size
301	.long	1                               # Offset entry count
302.Lrnglists_dwo_table_base0:
303	.long	.Ldebug_ranges0-.Lrnglists_dwo_table_base0
304.Ldebug_ranges0:
305	.byte	4                               # DW_RLE_offset_pair
306	.uleb128 .Ltmp0-.Lfunc_begin0           #   starting offset
307	.uleb128 .Ltmp1-.Lfunc_begin0           #   ending offset
308	.byte	0                               # DW_RLE_end_of_list
309.Ldebug_list_header_end0:
310	.section	.debug_addr,"",@progbits
311	.long	.Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
312.Ldebug_addr_start0:
313	.short	5                               # DWARF version number
314	.byte	8                               # Address size
315	.byte	0                               # Segment selector size
316.Laddr_table_base0:
317	.quad	i
318	.quad	42
319.Ldebug_addr_end0:
320	.section	.debug_gnu_pubnames,"",@progbits
321	.long	.LpubNames_end0-.LpubNames_start0 # Length of Public Names Info
322.LpubNames_start0:
323	.short	2                               # DWARF Version
324	.long	.Lcu_begin0                     # Offset of Compilation Unit Info
325	.long	40                              # Compilation Unit Length
326	.long	46                              # DIE offset
327	.byte	48                              # Attributes: FUNCTION, EXTERNAL
328	.asciz	"f1"                            # External Name
329	.long	26                              # DIE offset
330	.byte	32                              # Attributes: VARIABLE, EXTERNAL
331	.asciz	"i"                             # External Name
332	.long	51                              # DIE offset
333	.byte	48                              # Attributes: FUNCTION, EXTERNAL
334	.asciz	"main"                          # External Name
335	.long	0                               # End Mark
336.LpubNames_end0:
337	.section	.debug_gnu_pubtypes,"",@progbits
338	.long	.LpubTypes_end0-.LpubTypes_start0 # Length of Public Types Info
339.LpubTypes_start0:
340	.short	2                               # DWARF Version
341	.long	.Lcu_begin0                     # Offset of Compilation Unit Info
342	.long	40                              # Compilation Unit Length
343	.long	42                              # DIE offset
344	.byte	144                             # Attributes: TYPE, STATIC
345	.asciz	"int"                           # External Name
346	.long	0                               # End Mark
347.LpubTypes_end0:
348	.ident	"clang version 17.0.0 (git@github.com:llvm/llvm-project.git 6963c61f0f6e4be2039cb45e824ea1e83a8f1526)"
349	.section	".note.GNU-stack","",@progbits
350	.addrsig
351	.addrsig_sym i
352	.section	.debug_line,"",@progbits
353.Lline_table_start0:
354