File: local-variables-registers.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (723 lines) | stat: -rw-r--r-- 32,631 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
# clang-format off
# REQUIRES: lld, x86

# RUN: llvm-mc -triple=x86_64-windows-msvc --filetype=obj %s > %t.obj
# RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe /base:0x140000000
# RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
# RUN:     %p/Inputs/local-variables-registers.lldbinit 2>&1 | FileCheck %s

# This file is compiled from following source file:
# clang-cl /Z7 /O1 /Falocal-variables-registers.s a.cpp
# struct S {
#   int x;
#   char y;
# };
#
# __attribute__((noinline)) S CreateS(int p1, char p2) {
#   S s;
#   s.x = p1 + 1;
#   s.y = p2 + 2;
#   ++s.x;
#   ++s.y;
#   return s;
# }
#
# int main(int argc, char** argv) {
#   int local = argc * 2;
#   S s = CreateS(local, 'a');
#   return s.x + s.y;
# }

# FIXME: The following variable location have wrong register numbers due to
# https://github.com/llvm/llvm-project/issues/53575. Fix them after resolving
# the issue.

# CHECK:      (lldb) image lookup -a 0x140001000 -v
# CHECK:          LineEntry: [0x0000000140001000-0x0000000140001003): C:\src\test\a.cpp:10
# CHECK-NEXT:      Variable: id = {{.*}}, name = "p1", type = "int", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001003) -> DW_OP_reg26 XMM9
# CHECK-NEXT:      Variable: id = {{.*}}, name = "p2", type = "char", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001006) -> DW_OP_regx 0x3f
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001003 -v
# CHECK:          LineEntry: [0x0000000140001003-0x0000000140001006): C:\src\test\a.cpp:11
# CHECK-NEXT:      Variable: id = {{.*}}, name = "p2", type = "char", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001006) -> DW_OP_regx 0x3f
# 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
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001006 -v
# CHECK:          LineEntry: [0x0000000140001006-0x0000000140001011): C:\src\test\a.cpp:12
# 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
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001011 -v
# CHECK:          LineEntry: [0x0000000140001011-0x0000000140001015): C:\src\test\a.cpp:15
# CHECK-NEXT:      Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = <block>, location = [0x0000000140001011, 0x0000000140001017) -> DW_OP_reg26 XMM9
# CHECK-NEXT:      Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001011, 0x0000000140001019) -> DW_OP_reg3 RBX
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001017 -v
# CHECK:          LineEntry: [0x0000000140001017-0x000000014000101e): C:\src\test\a.cpp:17
# CHECK-NEXT:      Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001011, 0x0000000140001019) -> DW_OP_reg3 RBX
# CHECK-NEXT:      Variable: id = {{.*}}, name = "local", type = "int", valid ranges = <block>, location = [0x0000000140001017, 0x000000014000101e) -> DW_OP_reg26 XMM9
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001019 -v
# CHECK:          LineEntry: [0x0000000140001017-0x000000014000101e): C:\src\test\a.cpp:17
# CHECK-NEXT:      Variable: id = {{.*}}, name = "local", type = "int", valid ranges = <block>, location = [0x0000000140001017, 0x000000014000101e) -> DW_OP_reg26 XMM9
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x14000101e -v
# CHECK:          LineEntry: [0x000000014000101e-0x0000000140001031): C:\src\test\a.cpp:18
# 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
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x14000102c -v
# CHECK:          LineEntry: [0x000000014000101e-0x0000000140001031): C:\src\test\a.cpp:18

	.text
	.def	 @feat.00;
	.scl	3;
	.type	0;
	.endef
	.globl	@feat.00
.set @feat.00, 0
	.intel_syntax noprefix
	.file	"a.cpp"
	.def	 "?CreateS@@YA?AUS@@HD@Z";
	.scl	2;
	.type	32;
	.endef
	.section	.text,"xr",one_only,"?CreateS@@YA?AUS@@HD@Z"
	.globl	"?CreateS@@YA?AUS@@HD@Z"        # -- Begin function ?CreateS@@YA?AUS@@HD@Z
"?CreateS@@YA?AUS@@HD@Z":               # @"?CreateS@@YA?AUS@@HD@Z"
.Lfunc_begin0:
	.cv_func_id 0
# %bb.0:
	#DEBUG_VALUE: CreateS:p2 <- $dl
	#DEBUG_VALUE: CreateS:p1 <- $ecx
	#DEBUG_VALUE: CreateS:s <- [DW_OP_plus_uconst 1, DW_OP_stack_value, DW_OP_LLVM_fragment 0 32] $ecx
	#DEBUG_VALUE: CreateS:s <- [DW_OP_plus_uconst 2, DW_OP_stack_value, DW_OP_LLVM_fragment 32 8] $dl
	.cv_file	1 "C:\\src\\test\\a.cpp" "446925B46C8C870B01708834F4813A31" 1
	.cv_loc	0 1 10 0                        # a.cpp:10:0
                                        # kill: def $ecx killed $ecx def $rcx
	#DEBUG_VALUE: CreateS:s <- [DW_OP_plus_uconst 1, DW_OP_stack_value, DW_OP_LLVM_fragment 0 32] $ecx
	add	ecx, 2
.Ltmp0:
	#DEBUG_VALUE: CreateS:p1 <- [DW_OP_LLVM_entry_value 1] $ecx
	#DEBUG_VALUE: CreateS:s <- [DW_OP_LLVM_fragment 0 32] $ecx
	.cv_loc	0 1 11 0                        # a.cpp:11:0
	add	dl, 3
.Ltmp1:
	#DEBUG_VALUE: CreateS:p2 <- [DW_OP_LLVM_entry_value 1] $dl
	#DEBUG_VALUE: CreateS:s <- [DW_OP_LLVM_fragment 32 8] $dl
	.cv_loc	0 1 12 0                        # a.cpp:12:0
	movzx	eax, dl
	shl	rax, 32
	or	rax, rcx
	ret
.Ltmp2:
.Lfunc_end0:
                                        # -- End function
	.def	 main;
	.scl	2;
	.type	32;
	.endef
	.section	.text,"xr",one_only,main
	.globl	main                            # -- Begin function main
main:                                   # @main
.Lfunc_begin1:
	.cv_func_id 1
	.cv_loc	1 1 15 0                        # a.cpp:15:0
.seh_proc main
# %bb.0:
	#DEBUG_VALUE: main:argv <- $rdx
	#DEBUG_VALUE: main:argc <- $ecx
	sub	rsp, 40
	.seh_stackalloc 40
	.seh_endprologue
.Ltmp3:
	.cv_loc	1 1 16 0                        # a.cpp:16:0
	add	ecx, ecx
.Ltmp4:
	#DEBUG_VALUE: main:argc <- [DW_OP_LLVM_entry_value 1] $ecx
	#DEBUG_VALUE: main:local <- $ecx
	.cv_loc	1 1 17 0                        # a.cpp:17:0
	mov	dl, 97
.Ltmp5:
	#DEBUG_VALUE: main:argv <- [DW_OP_LLVM_entry_value 1] $rdx
	call	"?CreateS@@YA?AUS@@HD@Z"
.Ltmp6:
	#DEBUG_VALUE: main:s <- [DW_OP_LLVM_fragment 0 32] $eax
	#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
	#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
	.cv_loc	1 1 18 0                        # a.cpp:18:0
	mov	rcx, rax
	shr	rcx, 8
	sar	ecx, 24
	add	ecx, eax
	mov	eax, ecx
.Ltmp7:
	add	rsp, 40
	ret
# Manually created for testing purpose.
.L31:
	.cv_loc	1 1 1000 0                        # a.cpp:1000:0
	ret
.L32:
	ret
.L33:
	ret
.L34:
	.cv_loc	1 1 1001 0                        # a.cpp:1001:0
	ret
.L35:
	ret
.L36:
	ret
.L37:
	ret
.L38:
	ret
.L39:
	ret
.L3a:
	ret
.L3b:
	.cv_loc	1 1 1002 0                        # a.cpp:1002:0
	ret
.L3c:
	ret
.L3d:
	ret
.L3e:
	ret
.L3f:
	ret
.L40:
	ret
.L41:
	ret
.L42:
	ret
.L43:
	ret
.L44:
	ret
.L45:
	.cv_loc	1 1 1003 0                        # a.cpp:1003:0
	ret
.L46:
	ret
.L47:
	ret
.L48:
	ret
.L49:
	ret
.L4a:
	ret
.L4b:
	ret
.L4c:
	ret
.L4d:
	ret
.L4e:
	.cv_loc	1 1 1004 0                        # a.cpp:1004:0
	ret
.L4f:
	ret
.L50:
.Ltmp8:
.Lfunc_end1:
	.seh_endproc
                                        # -- End function
	.section	.drectve,"yn"
	.ascii	" /DEFAULTLIB:libcmt.lib"
	.ascii	" /DEFAULTLIB:oldnames.lib"
	.section	.debug$S,"dr"
	.p2align	2
	.long	4                               # Debug section magic
	.long	241
	.long	.Ltmp10-.Ltmp9                  # Subsection size
.Ltmp9:
	.short	.Ltmp12-.Ltmp11                 # Record length
.Ltmp11:
	.short	4412                            # Record kind: S_COMPILE3
	.long	1                               # Flags and language
	.short	208                             # CPUType
	.short	13                              # Frontend version
	.short	0
	.short	0
	.short	0
	.short	13000                           # Backend version
	.short	0
	.short	0
	.short	0
	.asciz	"clang version 13.0.0"          # Null-terminated compiler version string
	.p2align	2
.Ltmp12:
.Ltmp10:
	.p2align	2
	.section	.debug$S,"dr",associative,"?CreateS@@YA?AUS@@HD@Z"
	.p2align	2
	.long	4                               # Debug section magic
	.long	241                             # Symbol subsection for CreateS
	.long	.Ltmp14-.Ltmp13                 # Subsection size
.Ltmp13:
	.short	.Ltmp16-.Ltmp15                 # Record length
.Ltmp15:
	.short	4423                            # Record kind: S_GPROC32_ID
	.long	0                               # PtrParent
	.long	0                               # PtrEnd
	.long	0                               # PtrNext
	.long	.Lfunc_end0-"?CreateS@@YA?AUS@@HD@Z" # Code size
	.long	0                               # Offset after prologue
	.long	0                               # Offset before epilogue
	.long	4103                            # Function type index
	.secrel32	"?CreateS@@YA?AUS@@HD@Z" # Function section relative address
	.secidx	"?CreateS@@YA?AUS@@HD@Z"        # Function section index
	.byte	0                               # Flags
	.asciz	"CreateS"                       # Function name
	.p2align	2
.Ltmp16:
	.short	.Ltmp18-.Ltmp17                 # Record length
.Ltmp17:
	.short	4114                            # Record kind: S_FRAMEPROC
	.long	0                               # FrameSize
	.long	0                               # Padding
	.long	0                               # Offset of padding
	.long	0                               # Bytes of callee saved registers
	.long	0                               # Exception handler offset
	.short	0                               # Exception handler section
	.long	0                               # Flags (defines frame register)
	.p2align	2
.Ltmp18:
	.short	.Ltmp20-.Ltmp19                 # Record length
.Ltmp19:
	.short	4414                            # Record kind: S_LOCAL
	.long	116                             # TypeIndex
	.short	1                               # Flags
	.asciz	"p1"
	.p2align	2
.Ltmp20:
	.cv_def_range	 .Lfunc_begin0 .Ltmp0, reg, 18
	.short	.Ltmp22-.Ltmp21                 # Record length
.Ltmp21:
	.short	4414                            # Record kind: S_LOCAL
	.long	112                             # TypeIndex
	.short	1                               # Flags
	.asciz	"p2"
	.p2align	2
.Ltmp22:
	.cv_def_range	 .Lfunc_begin0 .Ltmp1, reg, 3
	.short	.Ltmp24-.Ltmp23                 # Record length
.Ltmp23:
	.short	4414                            # Record kind: S_LOCAL
	.long	4100                            # TypeIndex
	.short	0                               # Flags
	.asciz	"s"
	.p2align	2
.Ltmp24:
	# The following .cv_def_range order is inverted on purpose for testing.
	.cv_def_range	 .Ltmp0 .Lfunc_end0, subfield_reg, 3, 4
	.cv_def_range	 .Ltmp1 .Lfunc_end0, subfield_reg,18, 0
	.short	2                               # Record length
	.short	4431                            # Record kind: S_PROC_ID_END
.Ltmp14:
	.p2align	2
	.cv_linetable	0, "?CreateS@@YA?AUS@@HD@Z", .Lfunc_end0
	.section	.debug$S,"dr",associative,main
	.p2align	2
	.long	4                               # Debug section magic
	.long	241                             # Symbol subsection for main
	.long	.Ltmp26-.Ltmp25                 # Subsection size
.Ltmp25:
	.short	.Ltmp28-.Ltmp27                 # Record length
.Ltmp27:
	.short	4423                            # Record kind: S_GPROC32_ID
	.long	0                               # PtrParent
	.long	0                               # PtrEnd
	.long	0                               # PtrNext
	.long	.Lfunc_end1-main                # Code size
	.long	0                               # Offset after prologue
	.long	0                               # Offset before epilogue
	.long	4107                            # Function type index
	.secrel32	main                    # Function section relative address
	.secidx	main                            # Function section index
	.byte	0                               # Flags
	.asciz	"main"                          # Function name
	.p2align	2
.Ltmp28:
	.short	.Ltmp30-.Ltmp29                 # Record length
.Ltmp29:
	.short	4114                            # Record kind: S_FRAMEPROC
	.long	40                              # FrameSize
	.long	0                               # Padding
	.long	0                               # Offset of padding
	.long	0                               # Bytes of callee saved registers
	.long	0                               # Exception handler offset
	.short	0                               # Exception handler section
	.long	81920                           # Flags (defines frame register)
	.p2align	2
.Ltmp30:
	.short	.Ltmp32-.Ltmp31                 # Record length
.Ltmp31:
	.short	4414                            # Record kind: S_LOCAL
	.long	116                             # TypeIndex
	.short	1                               # Flags
	.asciz	"argc"
	.p2align	2
.Ltmp32:
	.cv_def_range	 .Lfunc_begin1 .Ltmp4, reg, 18
	.short	.Ltmp34-.Ltmp33                 # Record length
.Ltmp33:
	.short	4414                            # Record kind: S_LOCAL
	.long	4104                            # TypeIndex
	.short	1                               # Flags
	.asciz	"argv"
	.p2align	2
.Ltmp34:
	.cv_def_range	 .Lfunc_begin1 .Ltmp5, reg, 331
	.short	.Ltmp36-.Ltmp35                 # Record length
.Ltmp35:
	.short	4414                            # Record kind: S_LOCAL
	.long	116                             # TypeIndex
	.short	0                               # Flags
	.asciz	"local"
	.p2align	2
.Ltmp36:
	.cv_def_range	 .Ltmp4 .Ltmp6, reg, 18
	.short	.Ltmp38-.Ltmp37                 # Record length
.Ltmp37:
	.short	4414                            # Record kind: S_LOCAL
	.long	4100                            # TypeIndex
	.short	0                               # Flags
	.asciz	"s"
	.p2align	2
.Ltmp38:
	.cv_def_range	 .Ltmp6 .Ltmp7, subfield_reg, 17, 0
 	.short	.Ltmp101-.Ltmp100
# Manually created debug info for testing purpose.
# 1. Test non-overlapped ranges.
.Ltmp100:
	.short	4414                            # Record kind: S_LOCAL
	.long	4109                            # TypeIndex
	.short	0                               # Flags
	.asciz	"non_overlapped_ranges"
	.p2align	2
.Ltmp101:
	.cv_def_range	.L31 .L32, reg, 331
	.cv_def_range	.L32 .L33, reg, 330
	.cv_def_range	.L33 .L34, reg, 336
	.short	.Ltmp103-.Ltmp102
# CHECK:      (lldb) image lookup -a 0x140001031 -v
# CHECK:          LineEntry: [0x0000000140001031-0x0000000140001034): C:\src\test\a.cpp:1000
# CHECK-NEXT:      Variable: id = {{.*}}, name = "non_overlapped_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001031, 0x0000000140001032) -> DW_OP_reg3 RBX
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001032 -v
# CHECK:          LineEntry: [0x0000000140001031-0x0000000140001034): C:\src\test\a.cpp:1000
# CHECK-NEXT:      Variable: id = {{.*}}, name = "non_overlapped_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001032, 0x0000000140001033) -> DW_OP_reg2 RCX
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001033 -v
# CHECK:          LineEntry: [0x0000000140001031-0x0000000140001034): C:\src\test\a.cpp:1000
# CHECK-NEXT:      Variable: id = {{.*}}, name = "non_overlapped_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001033, 0x0000000140001034) -> DW_OP_reg8 R8
# CHECK-EMPTY:

# 2. Test overlapped subfield ranges at different offsets.
.Ltmp102:
 	.short	4414                            # Record kind: S_LOCAL
 	.long	4109                            # TypeIndex
 	.short	0                               # Flags
 	.asciz	"overlapped_subfield_ranges"
 	.p2align	2
.Ltmp103:
 	.cv_def_range	 .L34 .L36, subfield_reg, 3, 0
 	.cv_def_range	 .L35 .L37, subfield_reg, 17, 4
 	.cv_def_range	 .L37 .L39, subfield_reg, 18, 4
 	.short	.Ltmp105-.Ltmp104
# CHECK:      (lldb) image lookup -a 0x140001034 -v
# CHECK:          LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001
# 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
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001035 -v
# CHECK:          LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001
# 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
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001036 -v
# CHECK:          LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001
# 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
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001037 -v
# CHECK:          LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001
# 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
# CHECK-EMPTY:

# 3. Test overlapped ranges for the whole value.
.Ltmp104:
	.short	4414                            # Record kind: S_LOCAL
	.long	4109                            # TypeIndex
	.short	0                               # Flags
	.asciz	"overlapped_ranges_2"
	.p2align	2
.Ltmp105:
	.cv_def_range	.L3b .L3d, reg, 331
	.cv_def_range	.L3c .L3e, reg, 330
	.cv_def_range	.L3f .L44, reg, 339
	.cv_def_range   .L41 .L43, reg, 328
	.short	.Ltmp107-.Ltmp106
# CHECK:      (lldb) image lookup -a 0x14000103b -v
# CHECK:          LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002
# CHECK-NEXT:      Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x000000014000103b, 0x000000014000103c) -> DW_OP_reg3 RBX
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x14000103d -v
# CHECK:          LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002
# CHECK-NEXT:      Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x000000014000103c, 0x000000014000103e) -> DW_OP_reg2 RCX
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x14000103f -v
# CHECK:          LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002
# CHECK-NEXT:      Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x000000014000103f, 0x0000000140001041) -> DW_OP_reg11 R11
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001041 -v
# CHECK:          LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002
# CHECK-NEXT:      Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x0000000140001041, 0x0000000140001043) -> DW_OP_reg0 RAX
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001043 -v
# CHECK:          LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002
# CHECK-NEXT:      Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x0000000140001043, 0x0000000140001044) -> DW_OP_reg11 R11
# CHECK-EMPTY:

# 4. Test overlapped ranges for both subfield and whole value.
.Ltmp106:
	.short	4414                            # Record kind: S_LOCAL
	.long	4109                            # TypeIndex
	.short	0                               # Flags
	.asciz	"overlapped_ranges_3"
	.p2align	2
.Ltmp107:
	# The following two lines result:
	# [.L45, .L46) -> value at offset 0 is at reg 3.
	# [.L46, .L49) -> value at offset 0 is at reg 3 and value at offset 4 is at reg 17.
	# [.L49, .L4a) -> value at offset 4 is at reg 17.
	.cv_def_range	.L46 .L4a, subfield_reg, 17, 4
	.cv_def_range	.L45 .L49, subfield_reg, 3, 0
	# The following overwrites range [.L47, .L48) and [.L49 .L4a) because whole
	# value location is preferred over composited value locations.
	.cv_def_range	.L47 .L48, reg, 331
	.cv_def_range	.L49 .L4a, reg, 328
	# For the same reason, reg 330 wins in following example.
	.cv_def_range   .L4b .L4e, reg, 330
	.cv_def_range	.L4b .L4d, subfield_reg, 17, 4
	.cv_def_range	.L4c .L4e, subfield_reg, 3, 0
 	.short .Ltmp109-.Ltmp108
# CHECK:      (lldb) image lookup -a 0x140001045 -v
# CHECK:          LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
# 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
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001046 -v
# CHECK:          LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
# 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
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001047 -v
# CHECK:          LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
# CHECK-NEXT:      Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001047, 0x0000000140001048) -> DW_OP_reg3 RBX
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001048 -v
# CHECK:          LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
# 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
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x140001049 -v
# CHECK:          LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
# CHECK-NEXT:      Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001049, 0x000000014000104a) -> DW_OP_reg0 RAX
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x14000104a -v
# CHECK:          LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x14000104b -v
# CHECK:          LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
# CHECK-NEXT:      Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x000000014000104b, 0x000000014000104e) -> DW_OP_reg2 RCX
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x14000104c -v
# CHECK:          LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003
# CHECK-NEXT:      Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x000000014000104b, 0x000000014000104e) -> DW_OP_reg2 RCX
# CHECK-EMPTY:

# 5. Simple type with subfield.
.Ltmp108:
	.short	4414                            # Record kind: S_LOCAL
	.long	19                              # TypeIndex
	.short	0                               # Flags
	.asciz	"simple_type1"
	.p2align	2
.Ltmp109:
	.cv_def_range	 .L4e .L4f, subfield_reg, 17, 4
	.cv_def_range	 .L4e .L50, subfield_reg, 18, 0
	.short 2
	.short	4431                            # Record kind: S_PROC_ID_END
# CHECK:      (lldb) image lookup -a 0x14000104e -v
# CHECK:          LineEntry: [0x000000014000104e-0x0000000140001050): C:\src\test\a.cpp:1004
# 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
# CHECK-EMPTY:
# CHECK:      (lldb) image lookup -a 0x14000104f -v
# CHECK:          LineEntry: [0x000000014000104e-0x0000000140001050): C:\src\test\a.cpp:1004
# 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
# CHECK-EMPTY:

.Ltmp26:
	.p2align	2
	.cv_linetable	1, main, .Lfunc_end1
	.section	.debug$S,"dr"
	.long	241
	.long	.Ltmp40-.Ltmp39                 # Subsection size
.Ltmp39:
	.short	.Ltmp42-.Ltmp41                 # Record length
.Ltmp41:
	.short	4360                            # Record kind: S_UDT
	.long	4100                            # Type
	.asciz	"S"
	.p2align	2
.Ltmp42:
.Ltmp40:
	.p2align	2
	.cv_filechecksums                       # File index to string table offset subsection
	.cv_stringtable                         # String table
	.long	241
	.long	.Ltmp44-.Ltmp43                 # Subsection size
.Ltmp43:
	.short	.Ltmp46-.Ltmp45                 # Record length
.Ltmp45:
	.short	4428                            # Record kind: S_BUILDINFO
	.long	4110                            # LF_BUILDINFO index
	.p2align	2
.Ltmp46:
.Ltmp44:
	.p2align	2
	.section	.debug$T,"dr"
	.p2align	2
	.long	4                               # Debug section magic
	# Struct (0x1000)
	.short	0x1e                            # Record length
	.short	0x1505                          # Record kind: LF_STRUCTURE
	.short	0x0                             # MemberCount
	.short	0x280                           # Properties ( ForwardReference (0x80) | HasUniqueName (0x200) )
	.long	0x0                             # FieldList
	.long	0x0                             # DerivedFrom
	.long	0x0                             # VShape
	.short	0x0                             # SizeOf
	.asciz	"S"                             # Name
	.asciz	".?AUS@@"                       # LinkageName
	# ArgList (0x1001)
	.short	0xe                             # Record length
	.short	0x1201                          # Record kind: LF_ARGLIST
	.long	0x2                             # NumArgs
	.long	0x74                            # Argument: int
	.long	0x70                            # Argument: char
	# Procedure (0x1002)
	.short	0xe                             # Record length
	.short	0x1008                          # Record kind: LF_PROCEDURE
	.long	0x1000                          # ReturnType: S
	.byte	0x0                             # CallingConvention: NearC
	.byte	0x0                             # FunctionOptions
	.short	0x2                             # NumParameters
	.long	0x1001                          # ArgListType: (int, char)
	# FieldList (0x1003)
	.short	0x1a                            # Record length
	.short	0x1203                          # Record kind: LF_FIELDLIST
	.short	0x150d                          # Member kind: DataMember ( LF_MEMBER )
	.short	0x3                             # Attrs: Public
	.long	0x74                            # Type: int
	.short	0x0                             # FieldOffset
	.asciz	"x"                             # Name
	.short	0x150d                          # Member kind: DataMember ( LF_MEMBER )
	.short	0x3                             # Attrs: Public
	.long	0x70                            # Type: char
	.short	0x4                             # FieldOffset
	.asciz	"y"                             # Name
	# Struct (0x1004)
	.short	0x1e                            # Record length
	.short	0x1505                          # Record kind: LF_STRUCTURE
	.short	0x2                             # MemberCount
	.short	0x200                           # Properties ( HasUniqueName (0x200) )
	.long	0x1003                          # FieldList: <field list>
	.long	0x0                             # DerivedFrom
	.long	0x0                             # VShape
	.short	0x8                             # SizeOf
	.asciz	"S"                             # Name
	.asciz	".?AUS@@"                       # LinkageName
	# StringId (0x1005)
	.short	0x1a                            # Record length
	.short	0x1605                          # Record kind: LF_STRING_ID
	.long	0x0                             # Id
	.asciz	"C:\\src\\test\\a.cpp"          # StringData
	.byte	242
	.byte	241
	# UdtSourceLine (0x1006)
	.short	0xe                             # Record length
	.short	0x1606                          # Record kind: LF_UDT_SRC_LINE
	.long	0x1004                          # UDT: S
	.long	0x1005                          # SourceFile: C:\src\test\a.cpp
	.long	0x1                             # LineNumber
	# FuncId (0x1007)
	.short	0x12                            # Record length
	.short	0x1601                          # Record kind: LF_FUNC_ID
	.long	0x0                             # ParentScope
	.long	0x1002                          # FunctionType: S (int, char)
	.asciz	"CreateS"                       # Name
	# Pointer (0x1008)
	.short	0xa                             # Record length
	.short	0x1002                          # Record kind: LF_POINTER
	.long	0x670                           # PointeeType: char*
	.long	0x1000c                         # Attrs: [ Type: Near64, Mode: Pointer, SizeOf: 8 ]
	# ArgList (0x1009)
	.short	0xe                             # Record length
	.short	0x1201                          # Record kind: LF_ARGLIST
	.long	0x2                             # NumArgs
	.long	0x74                            # Argument: int
	.long	0x1008                          # Argument: char**
	# Procedure (0x100A)
	.short	0xe                             # Record length
	.short	0x1008                          # Record kind: LF_PROCEDURE
	.long	0x74                            # ReturnType: int
	.byte	0x0                             # CallingConvention: NearC
	.byte	0x0                             # FunctionOptions
	.short	0x2                             # NumParameters
	.long	0x1009                          # ArgListType: (int, char**)
	# FuncId (0x100B)
	.short	0x12                            # Record length
	.short	0x1601                          # Record kind: LF_FUNC_ID
	.long	0x0                             # ParentScope
	.long	0x100a                          # FunctionType: int (int, char**)
	.asciz	"main"                          # Name
	.byte	243
	.byte	242
	.byte	241
	# Manually created debug info for testing purpose, FieldList (0x100C) and Struct (0x100D)
	# FieldList (0x100C)
	.short	0x1a                            # Record length
	.short	0x1203                          # Record kind: LF_FIELDLIST
	.short	0x150d                          # Member kind: DataMember ( LF_MEMBER )
	.short	0x3                             # Attrs: Public
	.long	0x70                            # Type: char
	.short	0x0                             # FieldOffset
	.asciz	"c"                             # Name
	.short	0x150d                          # Member kind: DataMember ( LF_MEMBER )
	.short	0x3                             # Attrs: Public
	.long	0x74                            # Type: int
	.short	0x4                             # FieldOffset
	.asciz	"i"                             # Name
	# Struct (0x100D)
	.short	0x20                            # Record length
	.short	0x1505                          # Record kind: LF_STRUCTURE
	.short	0x2                             # MemberCount
	.short	0x200                           # Properties ( HasUniqueName (0x200) )
	.long	0x100c                          # FieldList: <field list>
	.long	0x0                             # DerivedFrom
	.long	0x0                             # VShape
	.short	0x8                             # SizeOf
	.asciz	"S1"                            # Name
	.asciz	".?AUS1@@"                      # LinkageName
	# BuildInfo (0x100E)
	.short	0x1a                            # Record length
	.short	0x1603                          # Record kind: LF_BUILDINFO
	.short	0x1                             # NumArgs
	.long	0x0                             # Argument
	.long	0x0                             # Argument
	.long	0x0                             # Argument
	.long	0x0                             # Argument
	.long	0x0                             # Argument
	.byte	242
	.byte	241
	.addrsig