xref: /llvm-project/lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_decl_file-DW_AT_specification-crosscu.s (revision 8a64d80a959bf2844df33f9112e456f33de7b468)
1# Check that DW_AT_decl_file inherited by DW_AT_specification from a different
2# DW_TAG_compile_unit is using the DW_TAG_compile_unit->DW_AT_stmt_list where the
3# DW_AT_decl_file is located (and not where the DW_AT_specification is located).
4
5# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux %s -o %t
6# RUN: %lldb %t \
7# RUN:   -o "image lookup -v -n main" \
8# RUN:   -o exit | FileCheck %s
9
10# CHECK: FuncType: id = {0x0000002a}, byte-size = 0, decl = filename1:1, compiler_type = "int (void)"
11
12	.text
13	.globl	main                            # -- Begin function main
14	.type	main,@function
15main:                                           # @main
16.Lfunc_begin0:
17        .byte 0
18.Lfunc_end0:
19	.size	main, .Lfunc_end0-main
20                                                # -- End function
21	.section	.debug_abbrev,"",@progbits
22	.byte	1                               # Abbreviation Code
23	.byte	17                              # DW_TAG_compile_unit
24	.byte	1                               # DW_CHILDREN_yes
25	.byte	37                              # DW_AT_producer
26	.byte	14                              # DW_FORM_strp
27	.byte	19                              # DW_AT_language
28	.byte	5                               # DW_FORM_data2
29	.byte	3                               # DW_AT_name
30	.byte	14                              # DW_FORM_strp
31	.byte	16                              # DW_AT_stmt_list
32	.byte	23                              # DW_FORM_sec_offset
33	.byte	27                              # DW_AT_comp_dir
34	.byte	14                              # DW_FORM_strp
35	.byte	17                              # DW_AT_low_pc
36	.byte	1                               # DW_FORM_addr
37	.byte	18                              # DW_AT_high_pc
38	.byte	6                               # DW_FORM_data4
39	.byte	0                               # EOM(1)
40	.byte	0                               # EOM(2)
41	.byte	2                               # Abbreviation Code
42	.byte	46                              # DW_TAG_subprogram
43	.byte	0                               # DW_CHILDREN_no
44	.byte	3                               # DW_AT_name
45	.byte	14                              # DW_FORM_strp
46	.byte	17                              # DW_AT_low_pc
47	.byte	1                               # DW_FORM_addr
48	.byte	18                              # DW_AT_high_pc
49	.byte	6                               # DW_FORM_data4
50	.byte	64                              # DW_AT_frame_base
51	.byte	24                              # DW_FORM_exprloc
52	.byte	71                              # DW_AT_specification
53	.byte	16                              # DW_FORM_ref_addr
54	.byte	0                               # EOM(1)
55	.byte	0                               # EOM(2)
56	.byte	3                               # Abbreviation Code
57	.byte	36                              # DW_TAG_base_type
58	.byte	0                               # DW_CHILDREN_no
59	.byte	3                               # DW_AT_name
60	.byte	14                              # DW_FORM_strp
61	.byte	62                              # DW_AT_encoding
62	.byte	11                              # DW_FORM_data1
63	.byte	11                              # DW_AT_byte_size
64	.byte	11                              # DW_FORM_data1
65	.byte	0                               # EOM(1)
66	.byte	0                               # EOM(2)
67	.byte	4                               # Abbreviation Code
68	.byte	46                              # DW_TAG_subprogram
69	.byte	0                               # DW_CHILDREN_no
70	.byte	58                              # DW_AT_decl_file
71	.byte	11                              # DW_FORM_data1
72	.byte	59                              # DW_AT_decl_line
73	.byte	11                              # DW_FORM_data1
74	.byte	39                              # DW_AT_prototyped
75	.byte	25                              # DW_FORM_flag_present
76	.byte	73                              # DW_AT_type
77	.byte	19                              # DW_FORM_ref4
78	.byte	63                              # DW_AT_external
79	.byte	25                              # DW_FORM_flag_present
80	.byte	60                              # DW_AT_declaration
81	.byte	25                              # DW_FORM_flag_present
82	.byte	0                               # EOM(1)
83	.byte	0                               # EOM(2)
84	.byte	0                               # EOM(3)
85
86	.section	.debug_info,"",@progbits
87.Ldebug_cu0:
88
89	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
90.Ldebug_info_start0:
91	.short	4                               # DWARF version number
92	.long	.debug_abbrev                   # Offset Into Abbrev. Section
93	.byte	8                               # Address Size (in bytes)
94	.byte	1                               # Abbrev [1] 0xb:0x40 DW_TAG_compile_unit
95	.long	.Linfo_string_producer          # DW_AT_producer
96	.short	12                              # DW_AT_language
97	.long	.Linfo_string_source            # DW_AT_name
98	.long	.Lline_table_start0             # DW_AT_stmt_list
99	.long	.Linfo_string_directory         # DW_AT_comp_dir
100	.quad	.Lfunc_begin0                   # DW_AT_low_pc
101	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
102	.byte	2                               # Abbrev [2] 0x2a:0x19 DW_TAG_subprogram
103	.long	.Linfo_string_main              # DW_AT_name
104	.quad	.Lfunc_begin0                   # DW_AT_low_pc
105	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
106	.byte	1                               # DW_AT_frame_base
107	.byte	86
108	.long	.Ldebug_info1_main - .Ldebug_cu0 # DW_AT_specification
109	.byte	0                               # End Of Children Mark
110.Ldebug_info_end0:
111
112.Ldebug_info1:
113	.long	.Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
114.Ldebug_info_start1:
115	.short	4                               # DWARF version number
116	.long	.debug_abbrev                   # Offset Into Abbrev. Section
117	.byte	8                               # Address Size (in bytes)
118	.byte	1                               # Abbrev [1] 0xb:0x40 DW_TAG_compile_unit
119	.long	.Linfo_string_producer          # DW_AT_producer
120	.short	12                              # DW_AT_language
121	.long	.Linfo_string_source            # DW_AT_name
122	.long	.Lline_table_start1             # DW_AT_stmt_list
123	.long	.Linfo_string_directory         # DW_AT_comp_dir
124	.quad	.Lfunc_begin0                   # DW_AT_low_pc
125	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
126.Ldebug_info1_main:
127	.byte	4                               # Abbrev [2] 0x2a:0x19 DW_TAG_subprogram
128	.byte	1                               # DW_AT_decl_file
129	.byte	1                               # DW_AT_decl_line
130                                                # DW_AT_prototyped
131	.long	.Ldebug_info1_int - .Ldebug_info1 # DW_AT_type
132                                                # DW_AT_external
133.Ldebug_info1_int:
134	.byte	3                               # Abbrev [3] 0x43:0x7 DW_TAG_base_type
135	.long	.Linfo_string_int               # DW_AT_name
136	.byte	5                               # DW_AT_encoding
137	.byte	4                               # DW_AT_byte_size
138	.byte	0                               # End Of Children Mark
139.Ldebug_info_end1:
140
141	.section	.debug_str,"MS",@progbits,1
142.Linfo_string_producer:
143	.asciz	"clang version 12.0.0" # string offset=0
144.Linfo_string_source:
145	.asciz	"source.c" # string offset=130
146.Linfo_string_directory:
147	.asciz	"/directory" # string offset=196
148.Linfo_string_main:
149	.asciz	"main"
150.Linfo_string_int:
151	.asciz	"int"
152	.ident	"clang version 12.0.0"
153	.section	".note.GNU-stack","",@progbits
154	.addrsig
155
156	.section	.debug_line,"",@progbits
157
158.Lline_table_start0:
159        .long .Lline_table_end0 - 1f  # length from next byte
1601:
161        .short 4                      # version
162        .long .Lline_table_end0 - 2f  # prologue length from next byte
1632:
164        .byte 1                       # minimum instruction length
165        .byte 1                       # maximum ops per instruction
166        .byte 1                       # initial value of is_stmt
167        .byte -5                      # line base
168        .byte 14                      # line range
169        .byte 1                       # opcode base
170                                      # no standard opcodes
171        .asciz "directory0"
172        .byte 0                       # last directory
173        .asciz "filename0"
174        .uleb128 1                    # directory entry
175        .uleb128 0                    # time
176        .uleb128 0                    # file length
177        .byte 0                       # last filename
178.Lline_table_end0:
179
180.Lline_table_start1:
181        .long .Lline_table_end1 - 1f  # length from next byte
1821:
183        .short 4                      # version
184        .long .Lline_table_end1 - 2f  # prologue length from next byte
1852:
186        .byte 1                       # minimum instruction length
187        .byte 1                       # maximum ops per instruction
188        .byte 1                       # initial value of is_stmt
189        .byte -5                      # line base
190        .byte 14                      # line range
191        .byte 1                       # opcode base
192                                      # no standard opcodes
193        .asciz "directory1"
194        .byte 0                       # last directory
195        .asciz "filename1"
196        .uleb128 1                    # directory entry
197        .uleb128 0                    # time
198        .uleb128 0                    # file length
199        .byte 0                       # last filename
200.Lline_table_end1:
201