@@ -71,324 +71,301 @@ def get_var(self, name):
71
71
return frame .FindVariable (name )
72
72
73
73
def do_check_copyable_value_test (self ):
74
- # We haven't defined varK yet.
75
- varK = self .get_var ('k' )
76
-
77
- self .assertIsNone (varK .value , "varK initialized too early?!" )
74
+ # We haven't defined k yet.
75
+ self .assertIsNone (self .get_var ('k' ).value , "k initialized too early?!" )
78
76
79
77
# Go to break point 2. k should be valid.
80
78
self .process .Continue ()
81
- self .assertGreater (varK . unsigned , 0 , "varK not initialized?!" )
79
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k not initialized?!" )
82
80
83
81
# Go to breakpoint 3. k should no longer be valid.
84
82
self .process .Continue ()
85
- self .assertIsNone (varK .value , "K is live but was consumed?!" )
83
+ self .assertIsNone (self . get_var ( 'k' ) .value , "K is live but was consumed?!" )
86
84
87
85
# Run so we hit the next breakpoint to jump to the next test's
88
86
# breakpoint.
89
87
self .process .Continue ()
90
88
91
89
def do_check_copyable_var_test (self ):
92
- # We haven't defined varK yet.
93
- varK = self .get_var ('k' )
94
- self .assertIsNone (varK .value , "varK initialized too early?!" )
90
+ # We haven't defined k yet.
91
+ self .assertIsNone (self .get_var ('k' ).value , "k initialized too early?!" )
95
92
96
93
# Go to break point 2. k should be valid.
97
94
self .process .Continue ()
98
- self .assertGreater (varK . unsigned , 0 , "varK not initialized?!" )
95
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k not initialized?!" )
99
96
100
97
# Go to breakpoint 3. We invalidated k
101
98
self .process .Continue ()
102
- self .assertIsNone (varK .value , "K is live but was consumed?!" )
99
+ self .assertIsNone (self . get_var ( 'k' ) .value , "K is live but was consumed?!" )
103
100
104
101
# Go to the last breakpoint and make sure that k is reinitialized
105
102
# properly.
106
103
self .process .Continue ()
107
- self .assertGreater (varK . unsigned , 0 , "varK not initialized" )
104
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k not initialized" )
108
105
109
106
# Run so we hit the next breakpoint to go to the next test.
110
107
self .process .Continue ()
111
108
112
109
def do_check_addressonly_value_test (self ):
113
- # We haven't defined varK yet.
114
- varK = self .get_var ('k' )
115
-
110
+ # We haven't defined k yet.
116
111
# Go to break point 2. k should be valid and m should not be. Since M is
117
112
# a dbg.declare it is hard to test robustly that it is not initialized
118
113
# so we don't do so. We have an additional llvm.dbg.addr test where we
119
114
# move the other variable and show the correct behavior with
120
115
# llvm.dbg.declare.
121
116
self .process .Continue ()
122
- self .assertGreater (varK .unsigned , 0 , "var not initialized?!" )
117
+ self .assertGreater (self . get_var ( 'k' ) .unsigned , 0 , "var not initialized?!" )
123
118
124
119
# Go to breakpoint 3.
125
120
self .process .Continue ()
126
- self .assertEqual (varK .unsigned , 0 ,
127
- "dbg thinks varK is live despite move?!" )
121
+ self .assertEqual (self . get_var ( 'k' ) .unsigned , 0 ,
122
+ "dbg thinks k is live despite move?!" )
128
123
129
124
# Run so we hit the next breakpoint as part of the next test.
130
125
self .process .Continue ()
131
126
132
127
def do_check_addressonly_var_test (self ):
133
- varK = self .get_var ('k' )
134
-
135
128
# Go to break point 2. k should be valid.
136
129
self .process .Continue ()
137
- self .assertGreater (varK . unsigned , 0 , "varK not initialized?!" )
130
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k not initialized?!" )
138
131
139
132
# Go to breakpoint 3. K was invalidated.
140
133
self .process .Continue ()
141
- self .assertIsNone (varK .value , "K is live but was consumed?!" )
134
+ self .assertIsNone (self . get_var ( 'k' ) .value , "K is live but was consumed?!" )
142
135
143
136
# Go to the last breakpoint and make sure that k is reinitialized
144
137
# properly.
145
138
self .process .Continue ()
146
- self .assertGreater (varK . unsigned , 0 , "varK not initialized" )
139
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k not initialized" )
147
140
148
141
# Run so we hit the next breakpoint as part of the next test.
149
142
self .process .Continue ()
150
143
151
144
def do_check_copyable_value_arg_test (self ):
152
145
# k is defined by the argument so it is valid.
153
- varK = self .get_var ('k' )
154
- self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
146
+ self .assertGreater (self .get_var ('k' ).unsigned , 0 , "k not initialized?!" )
155
147
156
148
# Go to break point 2. k should be valid.
157
149
self .process .Continue ()
158
- self .assertGreater (varK . unsigned , 0 , "varK not initialized?!" )
150
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k not initialized?!" )
159
151
160
152
# Go to breakpoint 3. k should no longer be valid.
161
153
self .process .Continue ()
162
- #self.assertIsNone(varK .value, "K is live but was consumed?!")
154
+ #self.assertIsNone(self.get_var('k') .value, "K is live but was consumed?!")
163
155
164
156
# Run so we hit the next breakpoint to jump to the next test's
165
157
# breakpoint.
166
158
self .process .Continue ()
167
159
168
160
def do_check_copyable_var_arg_test (self ):
169
161
# k is already defined and is an argument.
170
- varK = self .get_var ('k' )
171
- self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
162
+ self .assertGreater (self .get_var ('k' ).unsigned , 0 , "k not initialized?!" )
172
163
173
164
# Go to break point 2. k should be valid.
174
165
self .process .Continue ()
175
- self .assertGreater (varK . unsigned , 0 , "varK not initialized?!" )
166
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k not initialized?!" )
176
167
177
168
# Go to breakpoint 3. We invalidated k
178
169
self .process .Continue ()
179
- self .assertIsNone (varK .value , "K is live but was consumed?!" )
170
+ self .assertIsNone (self . get_var ( 'k' ) .value , "K is live but was consumed?!" )
180
171
181
172
# Go to the last breakpoint and make sure that k is reinitialized
182
173
# properly.
183
174
self .process .Continue ()
184
- self .assertGreater (varK . unsigned , 0 , "varK not initialized" )
175
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k not initialized" )
185
176
186
177
# Run so we hit the next breakpoint to go to the next test.
187
178
self .process .Continue ()
188
179
189
180
def do_check_addressonly_value_arg_test (self ):
190
181
# k is defined since it is an argument.
191
- varK = self .get_var ('k' )
192
- self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
182
+ self .assertGreater (self .get_var ('k' ).unsigned , 0 , "k not initialized?!" )
193
183
194
184
# Go to break point 2. k should be valid and m should not be. Since M is
195
185
# a dbg.declare it is hard to test robustly that it is not initialized
196
186
# so we don't do so. We have an additional llvm.dbg.addr test where we
197
187
# move the other variable and show the correct behavior with
198
188
# llvm.dbg.declare.
199
189
self .process .Continue ()
200
- self .assertGreater (varK .unsigned , 0 , "var not initialized?!" )
190
+ self .assertGreater (self . get_var ( 'k' ) .unsigned , 0 , "var not initialized?!" )
201
191
202
192
# Go to breakpoint 3.
203
193
self .process .Continue ()
204
- self .assertEqual (varK .unsigned , 0 ,
205
- "dbg thinks varK is live despite move?!" )
194
+ self .assertEqual (self . get_var ( 'k' ) .unsigned , 0 ,
195
+ "dbg thinks k is live despite move?!" )
206
196
207
197
# Run so we hit the next breakpoint as part of the next test.
208
198
self .process .Continue ()
209
199
210
200
def do_check_addressonly_var_arg_test (self ):
211
- varK = self .get_var ('k' )
212
- self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
201
+ self .assertGreater (self .get_var ('k' ).unsigned , 0 , "k not initialized?!" )
213
202
214
203
# Go to break point 2. k should be valid.
215
204
self .process .Continue ()
216
- self .assertGreater (varK . unsigned , 0 , "varK not initialized?!" )
205
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k not initialized?!" )
217
206
218
207
# Go to breakpoint 3. K was invalidated.
219
208
self .process .Continue ()
220
- self .assertIsNone (varK .value , "K is live but was consumed?!" )
209
+ self .assertIsNone (self . get_var ( 'k' ) .value , "K is live but was consumed?!" )
221
210
222
211
# Go to the last breakpoint and make sure that k is reinitialized
223
212
# properly.
224
213
self .process .Continue ()
225
214
# There is some sort of bug here. We should have the value here. For now
226
215
# leave the next line commented out and validate we are not seeing the
227
216
# value so we can detect change in behavior.
228
- self .assertGreater (varK . unsigned , 0 , "varK not initialized" )
217
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k not initialized" )
229
218
230
219
# Run so we hit the next breakpoint as part of the next test.
231
220
self .process .Continue ()
232
221
233
222
def do_check_copyable_value_ccf_true (self ):
234
- varK = self .get_var ('k' )
235
-
236
- # Check at our start point that we do not have any state for varK and
223
+ # Check at our start point that we do not have any state for k and
237
224
# then continue to our next breakpoint.
238
- self .assertIsNone (varK . value , "varK should not have a value?!" )
225
+ self .assertIsNone (self . get_var ( 'k' ). value , "k should not have a value?!" )
239
226
self .process .Continue ()
240
227
241
228
# At this breakpoint, k should be defined since we are going to do
242
229
# something with it.
243
- self .assertIsNotNone (varK . value , "varK should have a value?!" )
230
+ self .assertIsNotNone (self . get_var ( 'k' ). value , "k should have a value?!" )
244
231
self .process .Continue ()
245
232
246
233
# At this breakpoint, we are now in the conditional control flow part of
247
234
# the loop. Make sure that we can see k still.
248
- self .assertIsNotNone (varK . value , "varK should have a value?!" )
235
+ self .assertIsNotNone (self . get_var ( 'k' ). value , "k should have a value?!" )
249
236
self .process .Continue ()
250
237
251
238
# Ok, we just performed the move. k should not be no longer initialized.
252
- self .assertIsNone (varK . value , "varK should not have a value?!" )
239
+ self .assertIsNone (self . get_var ( 'k' ). value , "k should not have a value?!" )
253
240
self .process .Continue ()
254
241
255
242
# Finally we left the conditional control flow part of the function. k
256
243
# should still be None.
257
- self .assertIsNone (varK . value , "varK should not have a value!" )
244
+ self .assertIsNone (self . get_var ( 'k' ). value , "k should not have a value!" )
258
245
259
246
# Run again so we go and run to the next test.
260
247
self .process .Continue ()
261
248
262
249
def do_check_copyable_value_ccf_false (self ):
263
- varK = self .get_var ('k' )
264
-
265
- # Check at our start point that we do not have any state for varK and
250
+ # Check at our start point that we do not have any state for k and
266
251
# then continue to our next breakpoint.
267
- self .assertIsNone (varK . value , "varK should not have a value?!" )
252
+ self .assertIsNone (self . get_var ( 'k' ). value , "k should not have a value?!" )
268
253
self .process .Continue ()
269
254
270
255
# At this breakpoint, k should be defined since we are going to do
271
256
# something with it.
272
- self .assertIsNotNone (varK . value , "varK should have a value?!" )
257
+ self .assertIsNotNone (self . get_var ( 'k' ). value , "k should have a value?!" )
273
258
self .process .Continue ()
274
259
275
260
# At this breakpoint, we are now past the end of the conditional
276
261
# statement. We know due to the move checking that k can not have any
277
262
# uses that are reachable from the move. So it is safe to always not
278
263
# provide the value here.
279
- self .assertIsNone (varK . value , "varK should have a value?!" )
264
+ self .assertIsNone (self . get_var ( 'k' ). value , "k should have a value?!" )
280
265
281
266
# Run again so we go and run to the next test.
282
267
self .process .Continue ()
283
268
284
269
def do_check_copyable_var_ccf_true_reinit_out_block (self ):
285
- varK = self .get_var ('k' )
286
-
287
270
# At first we should not have a value for k.
288
- self .assertEqual (varK . unsigned , 0 , "varK should be nullptr!" )
271
+ self .assertEqual (self . get_var ( 'k' ). unsigned , 0 , "k should be nullptr!" )
289
272
self .process .Continue ()
290
273
291
274
# Now we are in the conditional true block. K should be defined since we
292
275
# are on the move itself.
293
- self .assertGreater (varK . unsigned , 0 , "varK should not be nullptr!" )
276
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k should not be nullptr!" )
294
277
self .process .Continue ()
295
278
296
279
# Now we have executed the move and we are about to run code using
297
280
# m. Make sure that K is not available!
298
- self .assertEqual (varK .unsigned , 0 ,
299
- "varK was already consumed! Should be nullptr" )
281
+ self .assertEqual (self . get_var ( 'k' ) .unsigned , 0 ,
282
+ "k was already consumed! Should be nullptr" )
300
283
self .process .Continue ()
301
284
302
285
# We are now out of the conditional lexical block on the line of code
303
286
# that redefines k. k should still be not available.
304
- self .assertEqual (varK .unsigned , 0 ,
305
- "varK was already consumed! Should be nullptr" )
287
+ self .assertEqual (self . get_var ( 'k' ) .unsigned , 0 ,
288
+ "k was already consumed! Should be nullptr" )
306
289
self .process .Continue ()
307
290
308
291
# Ok, we have now reinit k and are about to call a method on it. We
309
292
# should be valid now.
310
- self .assertGreater (varK .unsigned , 0 ,
311
- "varK should have be reinitialized?!" )
293
+ self .assertGreater (self . get_var ( 'k' ) .unsigned , 0 ,
294
+ "k should have be reinitialized?!" )
312
295
313
296
# Run again so we go and run to the next test.
314
297
self .process .Continue ()
315
298
316
299
def do_check_copyable_var_ccf_true_reinit_in_block (self ):
317
- varK = self .get_var ('k' )
318
-
319
300
# At first we should not have a value for k.
320
- self .assertEqual (varK . unsigned , 0 , "varK should be nullptr!" )
301
+ self .assertEqual (self . get_var ( 'k' ). unsigned , 0 , "k should be nullptr!" )
321
302
self .process .Continue ()
322
303
323
304
# Now we are in the conditional true block. K should be defined since we
324
305
# are on the move itself.
325
- self .assertGreater (varK . unsigned , 0 , "varK should not be nullptr!" )
306
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k should not be nullptr!" )
326
307
self .process .Continue ()
327
308
328
309
# Now we have executed the move and we are about to reinit k but have
329
310
# not yet. Make sure we are not available!
330
- self .assertEqual (varK .unsigned , 0 ,
331
- "varK was already consumed! Should be nullptr" )
311
+ self .assertEqual (self . get_var ( 'k' ) .unsigned , 0 ,
312
+ "k was already consumed! Should be nullptr" )
332
313
self .process .Continue ()
333
314
334
315
# We are now still inside the conditional part of the code, but have
335
- # reinitialized varK .
336
- self .assertGreater (varK .unsigned , 0 ,
337
- "varK was reinit! Should be valid value!" )
316
+ # reinitialized k .
317
+ self .assertGreater (self . get_var ( 'k' ) .unsigned , 0 ,
318
+ "k was reinit! Should be valid value!" )
338
319
self .process .Continue ()
339
320
340
321
# We now have left the conditional part of the function. k should still
341
322
# be available.
342
- self .assertGreater (varK .unsigned , 0 ,
343
- "varK should have be reinitialized?!" )
323
+ self .assertGreater (self . get_var ( 'k' ) .unsigned , 0 ,
324
+ "k should have be reinitialized?!" )
344
325
345
326
# Run again so we go and run to the next test.
346
327
self .process .Continue ()
347
328
348
329
def do_check_copyable_var_ccf_false_reinit_out_block (self ):
349
- varK = self .get_var ('k' )
350
-
351
330
# At first we should not have a value for k.
352
- self .assertEqual (varK . unsigned , 0 , "varK should be nullptr!" )
331
+ self .assertEqual (self . get_var ( 'k' ). unsigned , 0 , "k should be nullptr!" )
353
332
self .process .Continue ()
354
333
355
- # Now we are right above the beginning of the false check. varK should
334
+ # Now we are right above the beginning of the false check. k should
356
335
# still be valid.
357
- self .assertGreater (varK . unsigned , 0 , "varK should not be nullptr!" )
336
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k should not be nullptr!" )
358
337
self .process .Continue ()
359
338
360
339
# Now we are after the conditional part of the code on the reinit
361
340
# line. Since this is reachable from the move and we haven't reinit yet,
362
341
# k should not be available.
363
- self .assertEqual (varK .unsigned , 0 ,
364
- "varK was already consumed! Should be nullptr" )
342
+ self .assertEqual (self . get_var ( 'k' ) .unsigned , 0 ,
343
+ "k was already consumed! Should be nullptr" )
365
344
self .process .Continue ()
366
345
367
346
# Ok, we have now reinit k and are about to call a method on it. We
368
347
# should be valid now.
369
- self .assertGreater (varK .unsigned , 0 ,
370
- "varK should have be reinitialized?!" )
348
+ self .assertGreater (self . get_var ( 'k' ) .unsigned , 0 ,
349
+ "k should have be reinitialized?!" )
371
350
372
351
# Run again so we go and run to the next test.
373
352
self .process .Continue ()
374
353
375
354
def do_check_copyable_var_ccf_false_reinit_in_block (self ):
376
- varK = self .get_var ('k' )
377
-
378
355
# At first we should not have a value for k.
379
- self .assertEqual (varK . unsigned , 0 , "varK should be nullptr!" )
356
+ self .assertEqual (self . get_var ( 'k' ). unsigned , 0 , "k should be nullptr!" )
380
357
self .process .Continue ()
381
358
382
- # Now we are on the doSomething above the false check. So varK should be
359
+ # Now we are on the doSomething above the false check. So k should be
383
360
# valid.
384
- self .assertGreater (varK . unsigned , 0 , "varK should not be nullptr!" )
361
+ self .assertGreater (self . get_var ( 'k' ). unsigned , 0 , "k should not be nullptr!" )
385
362
self .process .Continue ()
386
363
387
364
# Now we are after the conditional scope. Since k was reinitialized in
388
- # the conditional scope, along all paths we are valid so varK should
365
+ # the conditional scope, along all paths we are valid so k should
389
366
# still be available.
390
- self .assertGreater (varK .unsigned , 0 ,
391
- "varK should not be nullptr?!" )
367
+ self .assertGreater (self . get_var ( 'k' ) .unsigned , 0 ,
368
+ "k should not be nullptr?!" )
392
369
393
370
# Run again so we go and run to the next test.
394
371
self .process .Continue ()
0 commit comments