1# RUN: llvm-mc -triple=x86_64-pc-win32 -filetype=obj < %s | llvm-readobj --codeview - | FileCheck %s
2
3# This tries to test defrange gap edge cases.
4
5# CHECK:         LocalSym {
6# CHECK:           Type: int (0x74)
7# CHECK:           VarName: p
8# CHECK:         }
9# CHECK-NOT:     LocalSym {
10# CHECK:         DefRangeRegisterSym {
11# CHECK-NEXT:      Kind: S_DEFRANGE_REGISTER (0x1141)
12# CHECK-NEXT:      Register: ESI (0x17)
13# CHECK-NEXT:      MayHaveNoName: 0
14# CHECK-NEXT:      LocalVariableAddrRange {
15# CHECK-NEXT:        OffsetStart: .text+0x5
16# CHECK-NEXT:        ISectStart: 0x0
17# CHECK-NEXT:        Range: 0x5
18# CHECK-NEXT:      }
19# CHECK-NEXT:      LocalVariableAddrGap [
20# CHECK-NEXT:        GapStartOffset: 0x3
21# CHECK-NEXT:        Range: 0x1
22# CHECK-NEXT:      ]
23# CHECK-NEXT:    }
24# CHECK-NEXT:    DefRangeRegisterSym {
25# CHECK-NEXT:      Kind: S_DEFRANGE_REGISTER (0x1141)
26# CHECK-NEXT:      Register: ESI (0x17)
27# CHECK-NEXT:      MayHaveNoName: 0
28# CHECK-NEXT:      LocalVariableAddrRange {
29# CHECK-NEXT:        OffsetStart: .text+0x10015
30# CHECK-NEXT:        ISectStart: 0x0
31# CHECK-NEXT:        Range: 0x6
32# CHECK-NEXT:      }
33# CHECK-NEXT:    }
34# CHECK-NEXT:    DefRangeRegisterSym {
35# CHECK-NEXT:      Kind: S_DEFRANGE_REGISTER (0x1141)
36# CHECK-NEXT:      Register: ESI (0x17)
37# CHECK-NEXT:      MayHaveNoName: 0
38# CHECK-NEXT:      LocalVariableAddrRange {
39# CHECK-NEXT:        OffsetStart: .text+0x2001B
40# CHECK-NEXT:        ISectStart: 0x0
41# CHECK-NEXT:        Range: 0x1
42# CHECK-NEXT:      }
43# CHECK-NEXT:    }
44# CHECK-NEXT:    DefRangeRegisterSym {
45# CHECK-NEXT:      Kind: S_DEFRANGE_REGISTER (0x1141)
46# CHECK-NEXT:      Register: ESI (0x17)
47# CHECK-NEXT:      MayHaveNoName: 0
48# CHECK-NEXT:      LocalVariableAddrRange {
49# CHECK-NEXT:        OffsetStart: .text+0x2001C
50# CHECK-NEXT:        ISectStart: 0x0
51# CHECK-NEXT:        Range: 0xF000
52# CHECK-NEXT:      }
53# CHECK-NEXT:      LocalVariableAddrGap [
54# CHECK-NEXT:        GapStartOffset: 0x1
55# CHECK-NEXT:        Range: 0xEFFE
56# CHECK-NEXT:      ]
57# CHECK-NEXT:    }
58
59	.text
60f:                                      # @f
61	mov $42, %esi
62.Lbegin0:
63	nop
64	jmp .Lbegin1
65.Lend0:
66	nop
67.Lbegin1:
68	nop
69.Lend1:
70	.p2align	4
71	.fill 0x10000, 1, 0x90
72
73	mov $42, %esi
74.Lbegin2:
75	nop
76	jmp .Lbegin3
77.Lend2:
78	.fill 0x10000, 1, 0x90
79.Lbegin3:
80	nop
81.Lend3:
82
83	# Create a range that is exactly 0xF000 bytes long with a gap in the
84	# middle.
85.Lbegin4:
86	nop
87.Lend4:
88	.fill 0xeffe, 1, 0x90
89.Lbegin5:
90	nop
91.Lend5:
92	ret
93.Lfunc_end0:
94
95	.section	.debug$S,"dr"
96	.p2align	2
97	.long	4                       # Debug section magic
98	.long	241                     # Symbol subsection for f
99	.long	.Ltmp15-.Ltmp14         # Subsection size
100.Ltmp14:
101	.short	.Ltmp17-.Ltmp16         # Record length
102.Ltmp16:
103	.short	4423                    # Record kind: S_GPROC32_ID
104	.long	0                       # PtrParent
105	.long	0                       # PtrEnd
106	.long	0                       # PtrNext
107	.long	.Lfunc_end0-f           # Code size
108	.long	0                       # Offset after prologue
109	.long	0                       # Offset before epilogue
110	.long	4098                    # Function type index
111	.secrel32	f               # Function section relative address
112	.secidx	f                       # Function section index
113	.byte	0                       # Flags
114	.asciz	"f"                     # Function name
115.Ltmp17:
116	.short	.Ltmp19-.Ltmp18         # Record length
117.Ltmp18:
118	.short	4414                    # Record kind: S_LOCAL
119	.long	116                     # TypeIndex
120	.short	0                       # Flags
121	.asciz	"p"
122.Ltmp19:
123	.cv_def_range	 .Lbegin0 .Lend0 .Lbegin1 .Lend1 .Lbegin2 .Lend2 .Lbegin3 .Lend3, reg, 23
124	.cv_def_range	 .Lbegin4 .Lend4 .Lbegin5 .Lend5, reg, 23
125	.short	2                       # Record length
126	.short	4431                    # Record kind: S_PROC_ID_END
127.Ltmp15:
128        .cv_filechecksums               # File index to string table offset subsection
129        .cv_stringtable                 # String table
130