Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / Shell / SymbolFile / NativePDB / local-variables-registers.s
blobad2d0704cdf41a9b588668088ea972320cbb0a70
1 # clang-format off
2 # REQUIRES: lld, x86
4 # RUN: llvm-mc -triple=x86_64-windows-msvc --filetype=obj %s > %t.obj
5 # RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe /base:0x140000000
6 # RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
7 # RUN: %p/Inputs/local-variables-registers.lldbinit 2>&1 | FileCheck %s
9 # This file is compiled from following source file:
10 # clang-cl /Z7 /O1 /Falocal-variables-registers.s a.cpp
11 # struct S {
12 # int x;
13 # char y;
14 # };
16 # __attribute__((noinline)) S CreateS(int p1, char p2) {
17 # S s;
18 # s.x = p1 + 1;
19 # s.y = p2 + 2;
20 # ++s.x;
21 # ++s.y;
22 # return s;
23 # }
25 # int main(int argc, char** argv) {
26 # int local = argc * 2;
27 # S s = CreateS(local, 'a');
28 # return s.x + s.y;
29 # }
31 # FIXME: The following variable location have wrong register numbers due to
32 # https://github.com/llvm/llvm-project/issues/53575. Fix them after resolving
33 # the issue.
35 # CHECK: (lldb) image lookup -a 0x140001000 -v
36 # CHECK: LineEntry: [0x0000000140001000-0x0000000140001003): C:\src\test\a.cpp:10
37 # CHECK-NEXT: Variable: id = {{.*}}, name = "p1", type = "int", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001003) -> DW_OP_reg26 XMM9
38 # CHECK-NEXT: Variable: id = {{.*}}, name = "p2", type = "char", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001006) -> DW_OP_regx 0x3f
39 # CHECK-EMPTY:
40 # CHECK: (lldb) image lookup -a 0x140001003 -v
41 # CHECK: LineEntry: [0x0000000140001003-0x0000000140001006): C:\src\test\a.cpp:11
42 # CHECK-NEXT: Variable: id = {{.*}}, name = "p2", type = "char", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001006) -> DW_OP_regx 0x3f
43 # CHECK-NEXT: Variable: id = {{.*}}, name = "s", type = "S", valid ranges = <block>, location = [0x0000000140001003, 0x0000000140001006) -> DW_OP_piece 0x4, DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x3
44 # CHECK-EMPTY:
45 # CHECK: (lldb) image lookup -a 0x140001006 -v
46 # CHECK: LineEntry: [0x0000000140001006-0x0000000140001011): C:\src\test\a.cpp:12
47 # CHECK-NEXT: Variable: id = {{.*}}, name = "s", type = "S", valid ranges = <block>, location = [0x0000000140001006, 0x0000000140001011) -> DW_OP_reg26 XMM9, DW_OP_piece 0x4, DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x3
48 # CHECK-EMPTY:
49 # CHECK: (lldb) image lookup -a 0x140001011 -v
50 # CHECK: LineEntry: [0x0000000140001011-0x0000000140001015): C:\src\test\a.cpp:15
51 # CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = <block>, location = [0x0000000140001011, 0x0000000140001017) -> DW_OP_reg26 XMM9
52 # CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001011, 0x0000000140001019) -> DW_OP_reg3 RBX
53 # CHECK-EMPTY:
54 # CHECK: (lldb) image lookup -a 0x140001017 -v
55 # CHECK: LineEntry: [0x0000000140001017-0x000000014000101e): C:\src\test\a.cpp:17
56 # CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001011, 0x0000000140001019) -> DW_OP_reg3 RBX
57 # CHECK-NEXT: Variable: id = {{.*}}, name = "local", type = "int", valid ranges = <block>, location = [0x0000000140001017, 0x000000014000101e) -> DW_OP_reg26 XMM9
58 # CHECK-EMPTY:
59 # CHECK: (lldb) image lookup -a 0x140001019 -v
60 # CHECK: LineEntry: [0x0000000140001017-0x000000014000101e): C:\src\test\a.cpp:17
61 # CHECK-NEXT: Variable: id = {{.*}}, name = "local", type = "int", valid ranges = <block>, location = [0x0000000140001017, 0x000000014000101e) -> DW_OP_reg26 XMM9
62 # CHECK-EMPTY:
63 # CHECK: (lldb) image lookup -a 0x14000101e -v
64 # CHECK: LineEntry: [0x000000014000101e-0x0000000140001031): C:\src\test\a.cpp:18
65 # CHECK-NEXT: Variable: id = {{.*}}, name = "s", type = "S", valid ranges = <block>, location = [0x000000014000101e, 0x000000014000102c) -> DW_OP_reg24 XMM7, DW_OP_piece 0x4, DW_OP_piece 0x4
66 # CHECK-EMPTY:
67 # CHECK: (lldb) image lookup -a 0x14000102c -v
68 # CHECK: LineEntry: [0x000000014000101e-0x0000000140001031): C:\src\test\a.cpp:18
70 .text
71 .def @feat.00;
72 .scl 3;
73 .type 0;
74 .endef
75 .globl @feat.00
76 .set @feat.00, 0
77 .intel_syntax noprefix
78 .file "a.cpp"
79 .def "?CreateS@@YA?AUS@@HD@Z";
80 .scl 2;
81 .type 32;
82 .endef
83 .section .text,"xr",one_only,"?CreateS@@YA?AUS@@HD@Z"
84 .globl "?CreateS@@YA?AUS@@HD@Z" # -- Begin function ?CreateS@@YA?AUS@@HD@Z
85 "?CreateS@@YA?AUS@@HD@Z": # @"?CreateS@@YA?AUS@@HD@Z"
86 .Lfunc_begin0:
87 .cv_func_id 0
88 # %bb.0:
89 #DEBUG_VALUE: CreateS:p2 <- $dl
90 #DEBUG_VALUE: CreateS:p1 <- $ecx
91 #DEBUG_VALUE: CreateS:s <- [DW_OP_plus_uconst 1, DW_OP_stack_value, DW_OP_LLVM_fragment 0 32] $ecx
92 #DEBUG_VALUE: CreateS:s <- [DW_OP_plus_uconst 2, DW_OP_stack_value, DW_OP_LLVM_fragment 32 8] $dl
93 .cv_file 1 "C:\\src\\test\\a.cpp" "446925B46C8C870B01708834F4813A31" 1
94 .cv_loc 0 1 10 0 # a.cpp:10:0
95 # kill: def $ecx killed $ecx def $rcx
96 #DEBUG_VALUE: CreateS:s <- [DW_OP_plus_uconst 1, DW_OP_stack_value, DW_OP_LLVM_fragment 0 32] $ecx
97 add ecx, 2
98 .Ltmp0:
99 #DEBUG_VALUE: CreateS:p1 <- [DW_OP_LLVM_entry_value 1] $ecx
100 #DEBUG_VALUE: CreateS:s <- [DW_OP_LLVM_fragment 0 32] $ecx
101 .cv_loc 0 1 11 0 # a.cpp:11:0
102 add dl, 3
103 .Ltmp1:
104 #DEBUG_VALUE: CreateS:p2 <- [DW_OP_LLVM_entry_value 1] $dl
105 #DEBUG_VALUE: CreateS:s <- [DW_OP_LLVM_fragment 32 8] $dl
106 .cv_loc 0 1 12 0 # a.cpp:12:0
107 movzx eax, dl
108 shl rax, 32
109 or rax, rcx
111 .Ltmp2:
112 .Lfunc_end0:
113 # -- End function
114 .def main;
115 .scl 2;
116 .type 32;
117 .endef
118 .section .text,"xr",one_only,main
119 .globl main # -- Begin function main
120 main: # @main
121 .Lfunc_begin1:
122 .cv_func_id 1
123 .cv_loc 1 1 15 0 # a.cpp:15:0
124 .seh_proc main
125 # %bb.0:
126 #DEBUG_VALUE: main:argv <- $rdx
127 #DEBUG_VALUE: main:argc <- $ecx
128 sub rsp, 40
129 .seh_stackalloc 40
130 .seh_endprologue
131 .Ltmp3:
132 .cv_loc 1 1 16 0 # a.cpp:16:0
133 add ecx, ecx
134 .Ltmp4:
135 #DEBUG_VALUE: main:argc <- [DW_OP_LLVM_entry_value 1] $ecx
136 #DEBUG_VALUE: main:local <- $ecx
137 .cv_loc 1 1 17 0 # a.cpp:17:0
138 mov dl, 97
139 .Ltmp5:
140 #DEBUG_VALUE: main:argv <- [DW_OP_LLVM_entry_value 1] $rdx
141 call "?CreateS@@YA?AUS@@HD@Z"
142 .Ltmp6:
143 #DEBUG_VALUE: main:s <- [DW_OP_LLVM_fragment 0 32] $eax
144 #DEBUG_VALUE: main:s <- [DW_OP_constu 40, DW_OP_shr, DW_OP_LLVM_convert 64 7, DW_OP_LLVM_convert 24 7, DW_OP_stack_value, DW_OP_LLVM_fragment 40 24] $rax
145 #DEBUG_VALUE: main:s <- [DW_OP_constu 32, DW_OP_shr, DW_OP_LLVM_convert 64 7, DW_OP_LLVM_convert 8 7, DW_OP_stack_value, DW_OP_LLVM_fragment 32 8] $rax
146 .cv_loc 1 1 18 0 # a.cpp:18:0
147 mov rcx, rax
148 shr rcx, 8
149 sar ecx, 24
150 add ecx, eax
151 mov eax, ecx
152 .Ltmp7:
153 add rsp, 40
155 # Manually created for testing purpose.
156 .L31:
157 .cv_loc 1 1 1000 0 # a.cpp:1000:0
159 .L32:
161 .L33:
163 .L34:
164 .cv_loc 1 1 1001 0 # a.cpp:1001:0
166 .L35:
168 .L36:
170 .L37:
172 .L38:
174 .L39:
176 .L3a:
178 .L3b:
179 .cv_loc 1 1 1002 0 # a.cpp:1002:0
181 .L3c:
183 .L3d:
185 .L3e:
187 .L3f:
189 .L40:
191 .L41:
193 .L42:
195 .L43:
197 .L44:
199 .L45:
200 .cv_loc 1 1 1003 0 # a.cpp:1003:0
202 .L46:
204 .L47:
206 .L48:
208 .L49:
210 .L4a:
212 .L4b:
214 .L4c:
216 .L4d:
218 .L4e:
219 .cv_loc 1 1 1004 0 # a.cpp:1004:0
221 .L4f:
223 .L50:
224 .Ltmp8:
225 .Lfunc_end1:
226 .seh_endproc
227 # -- End function
228 .section .drectve,"yn"
229 .ascii " /DEFAULTLIB:libcmt.lib"
230 .ascii " /DEFAULTLIB:oldnames.lib"
231 .section .debug$S,"dr"
232 .p2align 2
233 .long 4 # Debug section magic
234 .long 241
235 .long .Ltmp10-.Ltmp9 # Subsection size
236 .Ltmp9:
237 .short .Ltmp12-.Ltmp11 # Record length
238 .Ltmp11:
239 .short 4412 # Record kind: S_COMPILE3
240 .long 1 # Flags and language
241 .short 208 # CPUType
242 .short 13 # Frontend version
243 .short 0
244 .short 0
245 .short 0
246 .short 13000 # Backend version
247 .short 0
248 .short 0
249 .short 0
250 .asciz "clang version 13.0.0" # Null-terminated compiler version string
251 .p2align 2
252 .Ltmp12:
253 .Ltmp10:
254 .p2align 2
255 .section .debug$S,"dr",associative,"?CreateS@@YA?AUS@@HD@Z"
256 .p2align 2
257 .long 4 # Debug section magic
258 .long 241 # Symbol subsection for CreateS
259 .long .Ltmp14-.Ltmp13 # Subsection size
260 .Ltmp13:
261 .short .Ltmp16-.Ltmp15 # Record length
262 .Ltmp15:
263 .short 4423 # Record kind: S_GPROC32_ID
264 .long 0 # PtrParent
265 .long 0 # PtrEnd
266 .long 0 # PtrNext
267 .long .Lfunc_end0-"?CreateS@@YA?AUS@@HD@Z" # Code size
268 .long 0 # Offset after prologue
269 .long 0 # Offset before epilogue
270 .long 4103 # Function type index
271 .secrel32 "?CreateS@@YA?AUS@@HD@Z" # Function section relative address
272 .secidx "?CreateS@@YA?AUS@@HD@Z" # Function section index
273 .byte 0 # Flags
274 .asciz "CreateS" # Function name
275 .p2align 2
276 .Ltmp16:
277 .short .Ltmp18-.Ltmp17 # Record length
278 .Ltmp17:
279 .short 4114 # Record kind: S_FRAMEPROC
280 .long 0 # FrameSize
281 .long 0 # Padding
282 .long 0 # Offset of padding
283 .long 0 # Bytes of callee saved registers
284 .long 0 # Exception handler offset
285 .short 0 # Exception handler section
286 .long 0 # Flags (defines frame register)
287 .p2align 2
288 .Ltmp18:
289 .short .Ltmp20-.Ltmp19 # Record length
290 .Ltmp19:
291 .short 4414 # Record kind: S_LOCAL
292 .long 116 # TypeIndex
293 .short 1 # Flags
294 .asciz "p1"
295 .p2align 2
296 .Ltmp20:
297 .cv_def_range .Lfunc_begin0 .Ltmp0, reg, 18
298 .short .Ltmp22-.Ltmp21 # Record length
299 .Ltmp21:
300 .short 4414 # Record kind: S_LOCAL
301 .long 112 # TypeIndex
302 .short 1 # Flags
303 .asciz "p2"
304 .p2align 2
305 .Ltmp22:
306 .cv_def_range .Lfunc_begin0 .Ltmp1, reg, 3
307 .short .Ltmp24-.Ltmp23 # Record length
308 .Ltmp23:
309 .short 4414 # Record kind: S_LOCAL
310 .long 4100 # TypeIndex
311 .short 0 # Flags
312 .asciz "s"
313 .p2align 2
314 .Ltmp24:
315 # The following .cv_def_range order is inverted on purpose for testing.
316 .cv_def_range .Ltmp0 .Lfunc_end0, subfield_reg, 3, 4
317 .cv_def_range .Ltmp1 .Lfunc_end0, subfield_reg,18, 0
318 .short 2 # Record length
319 .short 4431 # Record kind: S_PROC_ID_END
320 .Ltmp14:
321 .p2align 2
322 .cv_linetable 0, "?CreateS@@YA?AUS@@HD@Z", .Lfunc_end0
323 .section .debug$S,"dr",associative,main
324 .p2align 2
325 .long 4 # Debug section magic
326 .long 241 # Symbol subsection for main
327 .long .Ltmp26-.Ltmp25 # Subsection size
328 .Ltmp25:
329 .short .Ltmp28-.Ltmp27 # Record length
330 .Ltmp27:
331 .short 4423 # Record kind: S_GPROC32_ID
332 .long 0 # PtrParent
333 .long 0 # PtrEnd
334 .long 0 # PtrNext
335 .long .Lfunc_end1-main # Code size
336 .long 0 # Offset after prologue
337 .long 0 # Offset before epilogue
338 .long 4107 # Function type index
339 .secrel32 main # Function section relative address
340 .secidx main # Function section index
341 .byte 0 # Flags
342 .asciz "main" # Function name
343 .p2align 2
344 .Ltmp28:
345 .short .Ltmp30-.Ltmp29 # Record length
346 .Ltmp29:
347 .short 4114 # Record kind: S_FRAMEPROC
348 .long 40 # FrameSize
349 .long 0 # Padding
350 .long 0 # Offset of padding
351 .long 0 # Bytes of callee saved registers
352 .long 0 # Exception handler offset
353 .short 0 # Exception handler section
354 .long 81920 # Flags (defines frame register)
355 .p2align 2
356 .Ltmp30:
357 .short .Ltmp32-.Ltmp31 # Record length
358 .Ltmp31:
359 .short 4414 # Record kind: S_LOCAL
360 .long 116 # TypeIndex
361 .short 1 # Flags
362 .asciz "argc"
363 .p2align 2
364 .Ltmp32:
365 .cv_def_range .Lfunc_begin1 .Ltmp4, reg, 18
366 .short .Ltmp34-.Ltmp33 # Record length
367 .Ltmp33:
368 .short 4414 # Record kind: S_LOCAL
369 .long 4104 # TypeIndex
370 .short 1 # Flags
371 .asciz "argv"
372 .p2align 2
373 .Ltmp34:
374 .cv_def_range .Lfunc_begin1 .Ltmp5, reg, 331
375 .short .Ltmp36-.Ltmp35 # Record length
376 .Ltmp35:
377 .short 4414 # Record kind: S_LOCAL
378 .long 116 # TypeIndex
379 .short 0 # Flags
380 .asciz "local"
381 .p2align 2
382 .Ltmp36:
383 .cv_def_range .Ltmp4 .Ltmp6, reg, 18
384 .short .Ltmp38-.Ltmp37 # Record length
385 .Ltmp37:
386 .short 4414 # Record kind: S_LOCAL
387 .long 4100 # TypeIndex
388 .short 0 # Flags
389 .asciz "s"
390 .p2align 2
391 .Ltmp38:
392 .cv_def_range .Ltmp6 .Ltmp7, subfield_reg, 17, 0
393 .short .Ltmp101-.Ltmp100
394 # Manually created debug info for testing purpose.
395 # 1. Test non-overlapped ranges.
396 .Ltmp100:
397 .short 4414 # Record kind: S_LOCAL
398 .long 4109 # TypeIndex
399 .short 0 # Flags
400 .asciz "non_overlapped_ranges"
401 .p2align 2
402 .Ltmp101:
403 .cv_def_range .L31 .L32, reg, 331
404 .cv_def_range .L32 .L33, reg, 330
405 .cv_def_range .L33 .L34, reg, 336
406 .short .Ltmp103-.Ltmp102
407 # CHECK: (lldb) image lookup -a 0x140001031 -v
408 # CHECK: LineEntry: [0x0000000140001031-0x0000000140001034): C:\src\test\a.cpp:1000
409 # CHECK-NEXT: Variable: id = {{.*}}, name = "non_overlapped_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001031, 0x0000000140001032) -> DW_OP_reg3 RBX
410 # CHECK-EMPTY:
411 # CHECK: (lldb) image lookup -a 0x140001032 -v
412 # CHECK: LineEntry: [0x0000000140001031-0x0000000140001034): C:\src\test\a.cpp:1000
413 # CHECK-NEXT: Variable: id = {{.*}}, name = "non_overlapped_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001032, 0x0000000140001033) -> DW_OP_reg2 RCX
414 # CHECK-EMPTY:
415 # CHECK: (lldb) image lookup -a 0x140001033 -v
416 # CHECK: LineEntry: [0x0000000140001031-0x0000000140001034): C:\src\test\a.cpp:1000
417 # CHECK-NEXT: Variable: id = {{.*}}, name = "non_overlapped_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001033, 0x0000000140001034) -> DW_OP_reg8 R8
418 # CHECK-EMPTY:
420 # 2. Test overlapped subfield ranges at different offsets.
421 .Ltmp102:
422 .short 4414 # Record kind: S_LOCAL
423 .long 4109 # TypeIndex
424 .short 0 # Flags
425 .asciz "overlapped_subfield_ranges"
426 .p2align 2
427 .Ltmp103:
428 .cv_def_range .L34 .L36, subfield_reg, 3, 0
429 .cv_def_range .L35 .L37, subfield_reg, 17, 4
430 .cv_def_range .L37 .L39, subfield_reg, 18, 4
431 .short .Ltmp105-.Ltmp104
432 # CHECK: (lldb) image lookup -a 0x140001034 -v
433 # CHECK: LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001
434 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_subfield_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001034, 0x0000000140001035) -> DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x7
435 # CHECK-EMPTY:
436 # CHECK: (lldb) image lookup -a 0x140001035 -v
437 # CHECK: LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001
438 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_subfield_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001035, 0x0000000140001036) -> DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x3, DW_OP_reg24 XMM7, DW_OP_piece 0x4
439 # CHECK-EMPTY:
440 # CHECK: (lldb) image lookup -a 0x140001036 -v
441 # CHECK: LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001
442 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_subfield_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001036, 0x0000000140001037) -> DW_OP_piece 0x4, DW_OP_reg24 XMM7, DW_OP_piece 0x4
443 # CHECK-EMPTY:
444 # CHECK: (lldb) image lookup -a 0x140001037 -v
445 # CHECK: LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001
446 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_subfield_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001037, 0x0000000140001039) -> DW_OP_piece 0x4, DW_OP_reg26 XMM9, DW_OP_piece 0x4
447 # CHECK-EMPTY:
449 # 3. Test overlapped ranges for the whole value.
450 .Ltmp104:
451 .short 4414 # Record kind: S_LOCAL
452 .long 4109 # TypeIndex
453 .short 0 # Flags
454 .asciz "overlapped_ranges_2"
455 .p2align 2
456 .Ltmp105:
457 .cv_def_range .L3b .L3d, reg, 331
458 .cv_def_range .L3c .L3e, reg, 330
459 .cv_def_range .L3f .L44, reg, 339
460 .cv_def_range .L41 .L43, reg, 328
461 .short .Ltmp107-.Ltmp106
462 # CHECK: (lldb) image lookup -a 0x14000103b -v
463 # CHECK: LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002
464 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x000000014000103b, 0x000000014000103c) -> DW_OP_reg3 RBX
465 # CHECK-EMPTY:
466 # CHECK: (lldb) image lookup -a 0x14000103d -v
467 # CHECK: LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002
468 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x000000014000103c, 0x000000014000103e) -> DW_OP_reg2 RCX
469 # CHECK-EMPTY:
470 # CHECK: (lldb) image lookup -a 0x14000103f -v
471 # CHECK: LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002
472 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x000000014000103f, 0x0000000140001041) -> DW_OP_reg11 R11
473 # CHECK-EMPTY:
474 # CHECK: (lldb) image lookup -a 0x140001041 -v
475 # CHECK: LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002
476 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x0000000140001041, 0x0000000140001043) -> DW_OP_reg0 RAX
477 # CHECK-EMPTY:
478 # CHECK: (lldb) image lookup -a 0x140001043 -v
479 # CHECK: LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002
480 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x0000000140001043, 0x0000000140001044) -> DW_OP_reg11 R11
481 # CHECK-EMPTY:
483 # 4. Test overlapped ranges for both subfield and whole value.
484 .Ltmp106:
485 .short 4414 # Record kind: S_LOCAL
486 .long 4109 # TypeIndex
487 .short 0 # Flags
488 .asciz "overlapped_ranges_3"
489 .p2align 2
490 .Ltmp107:
491 # The following two lines result:
492 # [.L45, .L46) -> value at offset 0 is at reg 3.
493 # [.L46, .L49) -> value at offset 0 is at reg 3 and value at offset 4 is at reg 17.
494 # [.L49, .L4a) -> value at offset 4 is at reg 17.
495 .cv_def_range .L46 .L4a, subfield_reg, 17, 4
496 .cv_def_range .L45 .L49, subfield_reg, 3, 0
497 # The following overwrites range [.L47, .L48) and [.L49 .L4a) because whole
498 # value location is preferred over composited value locations.
499 .cv_def_range .L47 .L48, reg, 331
500 .cv_def_range .L49 .L4a, reg, 328
501 # For the same reason, reg 330 wins in following example.
502 .cv_def_range .L4b .L4e, reg, 330
503 .cv_def_range .L4b .L4d, subfield_reg, 17, 4
504 .cv_def_range .L4c .L4e, subfield_reg, 3, 0
505 .short .Ltmp109-.Ltmp108
506 # CHECK: (lldb) image lookup -a 0x140001045 -v
507 # CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
508 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001045, 0x0000000140001046) -> DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x7
509 # CHECK-EMPTY:
510 # CHECK: (lldb) image lookup -a 0x140001046 -v
511 # CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
512 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001046, 0x0000000140001047) -> DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x3, DW_OP_reg24 XMM7, DW_OP_piece 0x4
513 # CHECK-EMPTY:
514 # CHECK: (lldb) image lookup -a 0x140001047 -v
515 # CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
516 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001047, 0x0000000140001048) -> DW_OP_reg3 RBX
517 # CHECK-EMPTY:
518 # CHECK: (lldb) image lookup -a 0x140001048 -v
519 # CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
520 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001048, 0x0000000140001049) -> DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x3, DW_OP_reg24 XMM7, DW_OP_piece 0x4
521 # CHECK-EMPTY:
522 # CHECK: (lldb) image lookup -a 0x140001049 -v
523 # CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
524 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001049, 0x000000014000104a) -> DW_OP_reg0 RAX
525 # CHECK-EMPTY:
526 # CHECK: (lldb) image lookup -a 0x14000104a -v
527 # CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
528 # CHECK-EMPTY:
529 # CHECK: (lldb) image lookup -a 0x14000104b -v
530 # CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
531 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x000000014000104b, 0x000000014000104e) -> DW_OP_reg2 RCX
532 # CHECK-EMPTY:
533 # CHECK: (lldb) image lookup -a 0x14000104c -v
534 # CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
535 # CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x000000014000104b, 0x000000014000104e) -> DW_OP_reg2 RCX
536 # CHECK-EMPTY:
538 # 5. Simple type with subfield.
539 .Ltmp108:
540 .short 4414 # Record kind: S_LOCAL
541 .long 19 # TypeIndex
542 .short 0 # Flags
543 .asciz "simple_type1"
544 .p2align 2
545 .Ltmp109:
546 .cv_def_range .L4e .L4f, subfield_reg, 17, 4
547 .cv_def_range .L4e .L50, subfield_reg, 18, 0
548 .short 2
549 .short 4431 # Record kind: S_PROC_ID_END
550 # CHECK: (lldb) image lookup -a 0x14000104e -v
551 # CHECK: LineEntry: [0x000000014000104e-0x0000000140001050): C:\src\test\a.cpp:1004
552 # CHECK-NEXT: Variable: id = {{.*}}, name = "simple_type1", type = "int64_t", valid ranges = <block>, location = [0x000000014000104e, 0x000000014000104f) -> DW_OP_reg26 XMM9, DW_OP_piece 0x4, DW_OP_reg24 XMM7, DW_OP_piece 0x4
553 # CHECK-EMPTY:
554 # CHECK: (lldb) image lookup -a 0x14000104f -v
555 # CHECK: LineEntry: [0x000000014000104e-0x0000000140001050): C:\src\test\a.cpp:1004
556 # CHECK-NEXT: Variable: id = {{.*}}, name = "simple_type1", type = "int64_t", valid ranges = <block>, location = [0x000000014000104f, 0x0000000140001050) -> DW_OP_reg26 XMM9, DW_OP_piece 0x4, DW_OP_piece 0x4
557 # CHECK-EMPTY:
559 .Ltmp26:
560 .p2align 2
561 .cv_linetable 1, main, .Lfunc_end1
562 .section .debug$S,"dr"
563 .long 241
564 .long .Ltmp40-.Ltmp39 # Subsection size
565 .Ltmp39:
566 .short .Ltmp42-.Ltmp41 # Record length
567 .Ltmp41:
568 .short 4360 # Record kind: S_UDT
569 .long 4100 # Type
570 .asciz "S"
571 .p2align 2
572 .Ltmp42:
573 .Ltmp40:
574 .p2align 2
575 .cv_filechecksums # File index to string table offset subsection
576 .cv_stringtable # String table
577 .long 241
578 .long .Ltmp44-.Ltmp43 # Subsection size
579 .Ltmp43:
580 .short .Ltmp46-.Ltmp45 # Record length
581 .Ltmp45:
582 .short 4428 # Record kind: S_BUILDINFO
583 .long 4110 # LF_BUILDINFO index
584 .p2align 2
585 .Ltmp46:
586 .Ltmp44:
587 .p2align 2
588 .section .debug$T,"dr"
589 .p2align 2
590 .long 4 # Debug section magic
591 # Struct (0x1000)
592 .short 0x1e # Record length
593 .short 0x1505 # Record kind: LF_STRUCTURE
594 .short 0x0 # MemberCount
595 .short 0x280 # Properties ( ForwardReference (0x80) | HasUniqueName (0x200) )
596 .long 0x0 # FieldList
597 .long 0x0 # DerivedFrom
598 .long 0x0 # VShape
599 .short 0x0 # SizeOf
600 .asciz "S" # Name
601 .asciz ".?AUS@@" # LinkageName
602 # ArgList (0x1001)
603 .short 0xe # Record length
604 .short 0x1201 # Record kind: LF_ARGLIST
605 .long 0x2 # NumArgs
606 .long 0x74 # Argument: int
607 .long 0x70 # Argument: char
608 # Procedure (0x1002)
609 .short 0xe # Record length
610 .short 0x1008 # Record kind: LF_PROCEDURE
611 .long 0x1000 # ReturnType: S
612 .byte 0x0 # CallingConvention: NearC
613 .byte 0x0 # FunctionOptions
614 .short 0x2 # NumParameters
615 .long 0x1001 # ArgListType: (int, char)
616 # FieldList (0x1003)
617 .short 0x1a # Record length
618 .short 0x1203 # Record kind: LF_FIELDLIST
619 .short 0x150d # Member kind: DataMember ( LF_MEMBER )
620 .short 0x3 # Attrs: Public
621 .long 0x74 # Type: int
622 .short 0x0 # FieldOffset
623 .asciz "x" # Name
624 .short 0x150d # Member kind: DataMember ( LF_MEMBER )
625 .short 0x3 # Attrs: Public
626 .long 0x70 # Type: char
627 .short 0x4 # FieldOffset
628 .asciz "y" # Name
629 # Struct (0x1004)
630 .short 0x1e # Record length
631 .short 0x1505 # Record kind: LF_STRUCTURE
632 .short 0x2 # MemberCount
633 .short 0x200 # Properties ( HasUniqueName (0x200) )
634 .long 0x1003 # FieldList: <field list>
635 .long 0x0 # DerivedFrom
636 .long 0x0 # VShape
637 .short 0x8 # SizeOf
638 .asciz "S" # Name
639 .asciz ".?AUS@@" # LinkageName
640 # StringId (0x1005)
641 .short 0x1a # Record length
642 .short 0x1605 # Record kind: LF_STRING_ID
643 .long 0x0 # Id
644 .asciz "C:\\src\\test\\a.cpp" # StringData
645 .byte 242
646 .byte 241
647 # UdtSourceLine (0x1006)
648 .short 0xe # Record length
649 .short 0x1606 # Record kind: LF_UDT_SRC_LINE
650 .long 0x1004 # UDT: S
651 .long 0x1005 # SourceFile: C:\src\test\a.cpp
652 .long 0x1 # LineNumber
653 # FuncId (0x1007)
654 .short 0x12 # Record length
655 .short 0x1601 # Record kind: LF_FUNC_ID
656 .long 0x0 # ParentScope
657 .long 0x1002 # FunctionType: S (int, char)
658 .asciz "CreateS" # Name
659 # Pointer (0x1008)
660 .short 0xa # Record length
661 .short 0x1002 # Record kind: LF_POINTER
662 .long 0x670 # PointeeType: char*
663 .long 0x1000c # Attrs: [ Type: Near64, Mode: Pointer, SizeOf: 8 ]
664 # ArgList (0x1009)
665 .short 0xe # Record length
666 .short 0x1201 # Record kind: LF_ARGLIST
667 .long 0x2 # NumArgs
668 .long 0x74 # Argument: int
669 .long 0x1008 # Argument: char**
670 # Procedure (0x100A)
671 .short 0xe # Record length
672 .short 0x1008 # Record kind: LF_PROCEDURE
673 .long 0x74 # ReturnType: int
674 .byte 0x0 # CallingConvention: NearC
675 .byte 0x0 # FunctionOptions
676 .short 0x2 # NumParameters
677 .long 0x1009 # ArgListType: (int, char**)
678 # FuncId (0x100B)
679 .short 0x12 # Record length
680 .short 0x1601 # Record kind: LF_FUNC_ID
681 .long 0x0 # ParentScope
682 .long 0x100a # FunctionType: int (int, char**)
683 .asciz "main" # Name
684 .byte 243
685 .byte 242
686 .byte 241
687 # Manually created debug info for testing purpose, FieldList (0x100C) and Struct (0x100D)
688 # FieldList (0x100C)
689 .short 0x1a # Record length
690 .short 0x1203 # Record kind: LF_FIELDLIST
691 .short 0x150d # Member kind: DataMember ( LF_MEMBER )
692 .short 0x3 # Attrs: Public
693 .long 0x70 # Type: char
694 .short 0x0 # FieldOffset
695 .asciz "c" # Name
696 .short 0x150d # Member kind: DataMember ( LF_MEMBER )
697 .short 0x3 # Attrs: Public
698 .long 0x74 # Type: int
699 .short 0x4 # FieldOffset
700 .asciz "i" # Name
701 # Struct (0x100D)
702 .short 0x20 # Record length
703 .short 0x1505 # Record kind: LF_STRUCTURE
704 .short 0x2 # MemberCount
705 .short 0x200 # Properties ( HasUniqueName (0x200) )
706 .long 0x100c # FieldList: <field list>
707 .long 0x0 # DerivedFrom
708 .long 0x0 # VShape
709 .short 0x8 # SizeOf
710 .asciz "S1" # Name
711 .asciz ".?AUS1@@" # LinkageName
712 # BuildInfo (0x100E)
713 .short 0x1a # Record length
714 .short 0x1603 # Record kind: LF_BUILDINFO
715 .short 0x1 # NumArgs
716 .long 0x0 # Argument
717 .long 0x0 # Argument
718 .long 0x0 # Argument
719 .long 0x0 # Argument
720 .long 0x0 # Argument
721 .byte 242
722 .byte 241
723 .addrsig