xref: /llvm-project/lldb/test/Shell/SymbolFile/DWARF/dwo-relative-path.s (revision 4139461d4e7788128c2da5f77712b8d39898f189)
1# Test to verify LLDB searches for dwos with relative paths relative to the
2# binary location, not relative to LLDB's launch location.
3
4# REQUIRES: x86
5
6# RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t.o
7# RUN: llvm-objcopy --split-dwo=%T/dwo-relative-path.dwo %t.o
8
9# RUN: cd ../..
10
11# RUN: %lldb %t.o -o "target var x" -b 2>&1 | FileCheck %s
12
13# CHECK: x = 10
14
15	.file	"dwo-relative-path.cpp"
16	.file	0 "." "dwo-relative-path.cpp" md5 0xadc61d242247514c5d402d62db34b825
17	.type	x,@object                       # @x
18	.data
19	.globl	x
20	.p2align	2
21x:
22	.long	10                              # 0xa
23	.size	x, 4
24
25	.section	.debug_abbrev,"",@progbits
26	.byte	1                               # Abbreviation Code
27	.byte	74                              # DW_TAG_skeleton_unit
28	.byte	0                               # DW_CHILDREN_no
29	.byte	16                              # DW_AT_stmt_list
30	.byte	23                              # DW_FORM_sec_offset
31	.byte	114                             # DW_AT_str_offsets_base
32	.byte	23                              # DW_FORM_sec_offset
33	.byte	27                              # DW_AT_comp_dir
34	.byte	37                              # DW_FORM_strx1
35	.ascii	"\264B"                         # DW_AT_GNU_pubnames
36	.byte	25                              # DW_FORM_flag_present
37	.byte	118                             # DW_AT_dwo_name
38	.byte	37                              # DW_FORM_strx1
39	.byte	115                             # DW_AT_addr_base
40	.byte	23                              # DW_FORM_sec_offset
41	.byte	0                               # EOM(1)
42	.byte	0                               # EOM(2)
43	.byte	0                               # EOM(3)
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	3752513468363206953
53	.byte	1                               # Abbrev [1] 0x14:0x14 DW_TAG_skeleton_unit
54	.long	.Lline_table_start0             # DW_AT_stmt_list
55	.long	.Lstr_offsets_base0             # DW_AT_str_offsets_base
56	.byte	0                               # DW_AT_comp_dir
57                                        # DW_AT_GNU_pubnames
58	.byte	1                               # DW_AT_dwo_name
59	.long	.Laddr_table_base0              # DW_AT_addr_base
60.Ldebug_info_end0:
61	.section	.debug_str_offsets,"",@progbits
62	.long	12                              # Length of String Offsets Set
63	.short	5
64	.short	0
65.Lstr_offsets_base0:
66	.section	.debug_str,"MS",@progbits,1
67.Lskel_string0:
68	.asciz	"."                             # string offset=0
69.Lskel_string1:
70	.asciz	"dwo-relative-path.dwo"         # string offset=2
71	.section	.debug_str_offsets,"",@progbits
72	.long	.Lskel_string0
73	.long	.Lskel_string1
74	.section	.debug_str_offsets.dwo,"e",@progbits
75	.long	24                              # Length of String Offsets Set
76	.short	5
77	.short	0
78	.section	.debug_str.dwo,"eMS",@progbits,1
79.Linfo_string0:
80	.asciz	"x"
81.Linfo_string1:
82	.asciz	"int"
83.Linfo_string2:
84	.asciz	"clang version 13.0.0 (https://chromium.googlesource.com/external/github.com/llvm/llvm-project 6666e0d7a29c639df7a1652b6d3bf16f28edd45a)"
85.Linfo_string3:
86	.asciz	"dwo-relative-path.cpp"
87.Linfo_string10:
88	.asciz	"dwo-relative-path.dwo"
89	.section	.debug_str_offsets.dwo,"e",@progbits
90	.long	.Linfo_string0-.debug_str.dwo
91	.long	.Linfo_string1-.debug_str.dwo
92	.long	.Linfo_string2-.debug_str.dwo
93	.long	.Linfo_string3-.debug_str.dwo
94	.section	.debug_info.dwo,"e",@progbits
95	.long	.Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
96.Ldebug_info_dwo_start0:
97	.short	5                               # DWARF version number
98	.byte	5                               # DWARF Unit Type
99	.byte	8                               # Address Size (in bytes)
100	.long	0                               # Offset Into Abbrev. Section
101	.quad	3752513468363206953
102	.byte	1                               # Abbrev [1] 0x14:0x65 DW_TAG_compile_unit
103	.byte	8                               # DW_AT_producer
104	.short	33                              # DW_AT_language
105	.byte	9                               # DW_AT_name
106	.byte	10                              # DW_AT_dwo_name
107	.byte	2                               # Abbrev [2] 0x1a:0xb DW_TAG_variable
108	.byte	0                               # DW_AT_name
109	.long	37                              # DW_AT_type
110                                        # DW_AT_external
111	.byte	0                               # DW_AT_decl_file
112	.byte	11                              # DW_AT_decl_line
113	.byte	2                               # DW_AT_location
114	.byte	161
115	.byte	0
116	.byte	3                               # Abbrev [3] 0x25:0x4 DW_TAG_base_type
117	.byte	1                               # DW_AT_name
118	.byte	5                               # DW_AT_encoding
119	.byte	4                               # DW_AT_byte_size
120	.byte	0                               # End Of Children Mark
121.Ldebug_info_dwo_end0:
122	.section	.debug_abbrev.dwo,"e",@progbits
123	.byte	1                               # Abbreviation Code
124	.byte	17                              # DW_TAG_compile_unit
125	.byte	1                               # DW_CHILDREN_yes
126	.byte	37                              # DW_AT_producer
127	.byte	37                              # DW_FORM_strx1
128	.byte	19                              # DW_AT_language
129	.byte	5                               # DW_FORM_data2
130	.byte	3                               # DW_AT_name
131	.byte	37                              # DW_FORM_strx1
132	.byte	118                             # DW_AT_dwo_name
133	.byte	37                              # DW_FORM_strx1
134	.byte	0                               # EOM(1)
135	.byte	0                               # EOM(2)
136	.byte	2                               # Abbreviation Code
137	.byte	52                              # DW_TAG_variable
138	.byte	0                               # DW_CHILDREN_no
139	.byte	3                               # DW_AT_name
140	.byte	37                              # DW_FORM_strx1
141	.byte	73                              # DW_AT_type
142	.byte	19                              # DW_FORM_ref4
143	.byte	63                              # DW_AT_external
144	.byte	25                              # DW_FORM_flag_present
145	.byte	58                              # DW_AT_decl_file
146	.byte	11                              # DW_FORM_data1
147	.byte	59                              # DW_AT_decl_line
148	.byte	11                              # DW_FORM_data1
149	.byte	2                               # DW_AT_location
150	.byte	24                              # DW_FORM_exprloc
151	.byte	0                               # EOM(1)
152	.byte	0                               # EOM(2)
153	.byte	3                               # Abbreviation Code
154	.byte	36                              # DW_TAG_base_type
155	.byte	0                               # DW_CHILDREN_no
156	.byte	3                               # DW_AT_name
157	.byte	37                              # DW_FORM_strx1
158	.byte	62                              # DW_AT_encoding
159	.byte	11                              # DW_FORM_data1
160	.byte	11                              # DW_AT_byte_size
161	.byte	11                              # DW_FORM_data1
162	.byte	0                               # EOM(1)
163	.byte	0                               # EOM(2)
164	.byte	0                               # EOM(3)
165	.section	.debug_addr,"",@progbits
166	.long	.Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
167.Ldebug_addr_start0:
168	.short	5                               # DWARF version number
169	.byte	8                               # Address size
170	.byte	0                               # Segment selector size
171.Laddr_table_base0:
172	.quad	x
173.Ldebug_addr_end0:
174	.section	.debug_line,"",@progbits
175.Lline_table_start0:
176