Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / COFF / symbolizer-line-numbers.s
blob9357b572ff00c9b62ee0774f3d3dad4aa8f32198
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj %s -o %t.obj -triple x86_64-windows-msvc
3 # RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug
4 # RUN: llvm-symbolizer --obj=%t.exe --relative-address \
5 # RUN: 0x1000 0x1003 0x1010 0x1013 | FileCheck %s
7 # Compiled from this cpp code:
8 # int f1(int x) {
9 # int y = x + 1;
10 # return y;
11 # }
12 # int f2(int n) {
13 # return f1(n);
14 # }
15 # int main() {
16 # return f2(100);
17 # }
19 .text
20 .def @feat.00;
21 .scl 3;
22 .type 0;
23 .endef
24 .globl @feat.00
25 .set @feat.00, 0
26 .file "t.cpp"
27 .def "?f1@@YAHH@Z";
28 .scl 2;
29 .type 32;
30 .endef
31 .globl "?f1@@YAHH@Z" # -- Begin function ?f1@@YAHH@Z
32 .p2align 4, 0x90
33 "?f1@@YAHH@Z": # @"?f1@@YAHH@Z"
34 .Lfunc_begin0:
35 .cv_func_id 0
36 # %bb.0: # %entry
37 .cv_file 1 "C:\\src\\tests\\t.cpp" "E6E6D87A9021656AD44E74484F5BA421" 1
39 # CHECK: f1(int)
40 # CHECK-NEXT: t.cpp:2:13
41 .cv_loc 0 1 2 13 # t.cpp:2:13
42 # kill: def $ecx killed $ecx def $rcx
43 leal 1(%rcx), %eax
45 # CHECK: f1(int)
46 # CHECK-NEXT: t.cpp:3:3
47 .cv_loc 0 1 3 3 # t.cpp:3:3
48 retq
49 .Ltmp0:
50 .Lfunc_end0:
51 # -- End function
52 .def "?f2@@YAHH@Z";
53 .scl 2;
54 .type 32;
55 .endef
56 .globl "?f2@@YAHH@Z" # -- Begin function ?f2@@YAHH@Z
57 .p2align 4, 0x90
58 "?f2@@YAHH@Z": # @"?f2@@YAHH@Z"
59 .Lfunc_begin1:
60 .cv_func_id 1
61 # %bb.0: # %entry
62 # CHECK: f1
63 # CHECK-NEXT: t.cpp:2:0
64 # CHECK-NEXT: f2(int)
65 # CHECK-NEXT: t.cpp:6:10
66 .cv_inline_site_id 2 within 1 inlined_at 1 6 10
67 .cv_loc 2 1 2 13 # t.cpp:2:13
68 # kill: def $ecx killed $ecx def $rcx
69 leal 1(%rcx), %eax
70 .Ltmp1:
71 # CHECK: f2(int)
72 # CHECK-NEXT: t.cpp:6:3
73 .cv_loc 1 1 6 3 # t.cpp:6:3
74 retq
75 .Ltmp2:
76 .Lfunc_end1:
77 # -- End function
78 .def main;
79 .scl 2;
80 .type 32;
81 .endef
82 .globl main # -- Begin function main
83 .p2align 4, 0x90
84 main: # @main
85 .Lfunc_begin2:
86 .cv_func_id 3
87 # %bb.0: # %entry
88 .cv_loc 3 1 9 3 # t.cpp:9:3
89 movl $101, %eax
90 retq
91 .Ltmp3:
92 .Lfunc_end2:
93 # -- End function
94 .section .debug$S,"dr"
95 .p2align 2
96 .long 4 # Debug section magic
97 .long 241
98 .long .Ltmp5-.Ltmp4 # Subsection size
99 .Ltmp4:
100 .short .Ltmp7-.Ltmp6 # Record length
101 .Ltmp6:
102 .short 4412 # Record kind: S_COMPILE3
103 .long 1 # Flags and language
104 .short 208 # CPUType
105 .short 12 # Frontend version
106 .short 0
107 .short 0
108 .short 0
109 .short 12000 # Backend version
110 .short 0
111 .short 0
112 .short 0
113 .asciz "clang version 12.0.0 (https://github.com/llvm/llvm-project.git e2e86f4e77ec2fd79743f4d0e94689e9668600ad)" # Null-terminated compiler version string
114 .p2align 2
115 .Ltmp7:
116 .Ltmp5:
117 .p2align 2
118 .long 246 # Inlinee lines subsection
119 .long .Ltmp9-.Ltmp8 # Subsection size
120 .Ltmp8:
121 .long 0 # Inlinee lines signature
123 # Inlined function f1 starts at t.cpp:1
124 .long 4098 # Type index of inlined function
125 .cv_filechecksumoffset 1 # Offset into filechecksum table
126 .long 1 # Starting line number
127 .Ltmp9:
128 .p2align 2
129 .long 241 # Symbol subsection for f1
130 .long .Ltmp11-.Ltmp10 # Subsection size
131 .Ltmp10:
132 .short .Ltmp13-.Ltmp12 # Record length
133 .Ltmp12:
134 .short 4423 # Record kind: S_GPROC32_ID
135 .long 0 # PtrParent
136 .long 0 # PtrEnd
137 .long 0 # PtrNext
138 .long .Lfunc_end0-"?f1@@YAHH@Z" # Code size
139 .long 0 # Offset after prologue
140 .long 0 # Offset before epilogue
141 .long 4098 # Function type index
142 .secrel32 "?f1@@YAHH@Z" # Function section relative address
143 .secidx "?f1@@YAHH@Z" # Function section index
144 .byte 0 # Flags
145 .asciz "f1" # Function name
146 .p2align 2
147 .Ltmp13:
148 .short .Ltmp15-.Ltmp14 # Record length
149 .Ltmp14:
150 .short 4114 # Record kind: S_FRAMEPROC
151 .long 0 # FrameSize
152 .long 0 # Padding
153 .long 0 # Offset of padding
154 .long 0 # Bytes of callee saved registers
155 .long 0 # Exception handler offset
156 .short 0 # Exception handler section
157 .long 1048576 # Flags (defines frame register)
158 .p2align 2
159 .Ltmp15:
160 .short 2 # Record length
161 .short 4431 # Record kind: S_PROC_ID_END
162 .Ltmp11:
163 .p2align 2
164 .cv_linetable 0, "?f1@@YAHH@Z", .Lfunc_end0
165 .long 241 # Symbol subsection for f2
166 .long .Ltmp17-.Ltmp16 # Subsection size
167 .Ltmp16:
168 .short .Ltmp19-.Ltmp18 # Record length
169 .Ltmp18:
170 .short 4423 # Record kind: S_GPROC32_ID
171 .long 0 # PtrParent
172 .long 0 # PtrEnd
173 .long 0 # PtrNext
174 .long .Lfunc_end1-"?f2@@YAHH@Z" # Code size
175 .long 0 # Offset after prologue
176 .long 0 # Offset before epilogue
177 .long 4099 # Function type index
178 .secrel32 "?f2@@YAHH@Z" # Function section relative address
179 .secidx "?f2@@YAHH@Z" # Function section index
180 .byte 0 # Flags
181 .asciz "f2" # Function name
182 .p2align 2
183 .Ltmp19:
184 .short .Ltmp21-.Ltmp20 # Record length
185 .Ltmp20:
186 .short 4114 # Record kind: S_FRAMEPROC
187 .long 0 # FrameSize
188 .long 0 # Padding
189 .long 0 # Offset of padding
190 .long 0 # Bytes of callee saved registers
191 .long 0 # Exception handler offset
192 .short 0 # Exception handler section
193 .long 1048576 # Flags (defines frame register)
194 .p2align 2
195 .Ltmp21:
196 .short .Ltmp23-.Ltmp22 # Record length
197 .Ltmp22:
198 .short 4429 # Record kind: S_INLINESITE
199 .long 0 # PtrParent
200 .long 0 # PtrEnd
201 .long 4098 # Inlinee type index
202 .cv_inline_linetable 2 1 1 .Lfunc_begin1 .Lfunc_end1
203 .p2align 2
204 .Ltmp23:
205 .short 2 # Record length
206 .short 4430 # Record kind: S_INLINESITE_END
207 .short 2 # Record length
208 .short 4431 # Record kind: S_PROC_ID_END
209 .Ltmp17:
210 .p2align 2
211 .cv_linetable 1, "?f2@@YAHH@Z", .Lfunc_end1
212 .long 241 # Symbol subsection for main
213 .long .Ltmp25-.Ltmp24 # Subsection size
214 .Ltmp24:
215 .short .Ltmp27-.Ltmp26 # Record length
216 .Ltmp26:
217 .short 4423 # Record kind: S_GPROC32_ID
218 .long 0 # PtrParent
219 .long 0 # PtrEnd
220 .long 0 # PtrNext
221 .long .Lfunc_end2-main # Code size
222 .long 0 # Offset after prologue
223 .long 0 # Offset before epilogue
224 .long 4100 # Function type index
225 .secrel32 main # Function section relative address
226 .secidx main # Function section index
227 .byte 0 # Flags
228 .asciz "main" # Function name
229 .p2align 2
230 .Ltmp27:
231 .short .Ltmp29-.Ltmp28 # Record length
232 .Ltmp28:
233 .short 4114 # Record kind: S_FRAMEPROC
234 .long 0 # FrameSize
235 .long 0 # Padding
236 .long 0 # Offset of padding
237 .long 0 # Bytes of callee saved registers
238 .long 0 # Exception handler offset
239 .short 0 # Exception handler section
240 .long 1048576 # Flags (defines frame register)
241 .p2align 2
242 .Ltmp29:
243 .short 2 # Record length
244 .short 4431 # Record kind: S_PROC_ID_END
245 .Ltmp25:
246 .p2align 2
247 .cv_linetable 3, main, .Lfunc_end2
248 .cv_filechecksums # File index to string table offset subsection
249 .cv_stringtable # String table
250 .long 241
251 .long .Ltmp31-.Ltmp30 # Subsection size
252 .Ltmp30:
253 .short .Ltmp33-.Ltmp32 # Record length
254 .Ltmp32:
255 .short 4428 # Record kind: S_BUILDINFO
256 .long 4103 # LF_BUILDINFO index
257 .p2align 2
258 .Ltmp33:
259 .Ltmp31:
260 .p2align 2
261 .section .debug$T,"dr"
262 .p2align 2
263 .long 4 # Debug section magic
264 # ArgList (0x1000)
265 .short 0x6 # Record length
266 .short 0x1201 # Record kind: LF_ARGLIST
267 .long 0x0 # NumArgs
268 # Procedure (0x1001)
269 .short 0xe # Record length
270 .short 0x1008 # Record kind: LF_PROCEDURE
271 .long 0x3 # ReturnType: void
272 .byte 0x0 # CallingConvention: NearC
273 .byte 0x0 # FunctionOptions
274 .short 0x0 # NumParameters
275 .long 0x1000 # ArgListType: ()
276 # FuncId (0x1002)
277 .short 0xe # Record length
278 .short 0x1601 # Record kind: LF_FUNC_ID
279 .long 0x0 # ParentScope
280 .long 0x1001 # FunctionType: void ()
281 .asciz "f1" # Name
282 .byte 241
283 # FuncId (0x1003)
284 .short 0xe # Record length
285 .short 0x1601 # Record kind: LF_FUNC_ID
286 .long 0x0 # ParentScope
287 .long 0x1001 # FunctionType: void ()
288 .asciz "f2" # Name
289 .byte 241
290 # FuncId (0x1004)
291 .short 0x12 # Record length
292 .short 0x1601 # Record kind: LF_FUNC_ID
293 .long 0x0 # ParentScope
294 .long 0x1001 # FunctionType: void ()
295 .asciz "main" # Name
296 .byte 243
297 .byte 242
298 .byte 241
299 # StringId (0x1005)
300 .short 0x16 # Record length
301 .short 0x1605 # Record kind: LF_STRING_ID
302 .long 0x0 # Id
303 .asciz "C:\\src\\tests" # StringData
304 .byte 243
305 .byte 242
306 .byte 241
307 # StringId (0x1006)
308 .short 0xe # Record length
309 .short 0x1605 # Record kind: LF_STRING_ID
310 .long 0x0 # Id
311 .asciz "<stdin>" # StringData
312 # BuildInfo (0x1007)
313 .short 0x1a # Record length
314 .short 0x1603 # Record kind: LF_BUILDINFO
315 .short 0x5 # NumArgs
316 .long 0x1005 # Argument: C:\src\tests
317 .long 0x0 # Argument
318 .long 0x1006 # Argument: <stdin>
319 .long 0x0 # Argument
320 .long 0x0 # Argument
321 .byte 242
322 .byte 241