@@ -215,9 +215,6 @@ def _set_leading_bps(self):
215
215
self ._leading_bp_handles [id ] = bpr
216
216
elif bpr .function is not None :
217
217
id = self .debugger .add_function_breakpoint (bpr .function )
218
- self .context .logger .warning (
219
- f"Set leading breakpoint { id } at { bpr .function } "
220
- )
221
218
self ._leading_bp_handles [id ] = bpr
222
219
else :
223
220
# Add an unconditional breakpoint.
@@ -272,23 +269,23 @@ def _run_debugger_custom(self, cmdline):
272
269
backtrace = None
273
270
if step_info .current_frame :
274
271
self ._step_index += 1
275
- backtrace = list ( [f .function for f in step_info .frames ])
272
+ backtrace = [f .function for f in step_info .frames ]
276
273
277
- log_step = False
274
+ record_step = False
278
275
debugger_continue = False
279
276
bp_to_delete = []
280
277
for bp_id in self .debugger .get_triggered_breakpoint_ids ():
281
278
try :
282
279
# See if this is one of our leading breakpoints.
283
280
bpr = self ._leading_bp_handles [bp_id ]
284
- log_step = True
281
+ record_step = True
285
282
except KeyError :
286
283
# This is a trailing bp. Mark it for removal.
287
284
bp_to_delete .append (bp_id )
288
285
if bp_id in self .instr_bp_ids :
289
286
self .instr_bp_ids .remove (bp_id )
290
287
else :
291
- log_step = True
288
+ record_step = True
292
289
continue
293
290
294
291
bpr .add_hit ()
@@ -303,7 +300,7 @@ def _run_debugger_custom(self, cmdline):
303
300
# Add this backtrace to the stack. While the current
304
301
# backtrace matches the top of the stack we'll step,
305
302
# and while there's a backtrace in the stack that
306
- # is a subset of the current backtrack we'll step-out.
303
+ # is a subset of the current backtrace we'll step-out.
307
304
if (
308
305
len (step_function_backtraces ) == 0
309
306
or backtrace != step_function_backtraces [- 1 ]
@@ -320,7 +317,8 @@ def _run_debugger_custom(self, cmdline):
320
317
321
318
elif bpr .is_continue :
322
319
debugger_continue = True
323
- self .debugger .add_breakpoint (bpr .path , bpr .range_to )
320
+ if bpr .range_to != None :
321
+ self .debugger .add_breakpoint (bpr .path , bpr .range_to )
324
322
325
323
else :
326
324
# Add a range of trailing breakpoints covering the lines
@@ -342,22 +340,25 @@ def _run_debugger_custom(self, cmdline):
342
340
while len (step_function_backtraces ) > 0 :
343
341
match_subtrace = False # Backtrace contains a target trace.
344
342
match_trace = False # Backtrace matches top of target stack.
345
- if len (backtrace ) >= len (step_function_backtraces [- 1 ]):
346
- match_subtrace = True
347
- match_trace = len (backtrace ) == len (
348
- step_function_backtraces [- 1 ]
343
+
344
+ # The top of the step_function_backtraces stack contains a
345
+ # backtrace that we want to step through. Check if the
346
+ # current backtrace ("backtrace") either matches that trace
347
+ # or otherwise contains it.
348
+ target_backtrace = step_function_backtraces [- 1 ]
349
+ if len (backtrace ) >= len (target_backtrace ):
350
+ match_trace = len (backtrace ) == len (target_backtrace )
351
+ # Check if backtrace contains target_backtrace, matching
352
+ # from the end (bottom of call stack) backwards.
353
+ match_subtrace = (
354
+ backtrace [- len (target_backtrace ) :] == target_backtrace
349
355
)
350
- for i , f in enumerate (reversed (step_function_backtraces [- 1 ])):
351
- if backtrace [- 1 - i ] != f :
352
- match_subtrace = False
353
- match_trace = False
354
- break
355
356
356
357
if match_trace :
357
358
# We want to step through this function; do so and
358
359
# log the steps in the step trace.
359
360
debugger_next = True
360
- log_step = True
361
+ record_step = True
361
362
break
362
363
elif match_subtrace :
363
364
# There's a function we care about buried in the
@@ -370,7 +371,7 @@ def _run_debugger_custom(self, cmdline):
370
371
# there are no longer reachable.
371
372
step_function_backtraces .pop ()
372
373
373
- if log_step and step_info .current_frame :
374
+ if record_step and step_info .current_frame :
374
375
# Record the step.
375
376
update_step_watches (
376
377
step_info , self ._watches , self .step_collection .commands
0 commit comments