@@ -215,9 +215,6 @@ def _set_leading_bps(self):
215215 self ._leading_bp_handles [id ] = bpr
216216 elif bpr .function is not None :
217217 id = self .debugger .add_function_breakpoint (bpr .function )
218- self .context .logger .warning (
219- f"Set leading breakpoint { id } at { bpr .function } "
220- )
221218 self ._leading_bp_handles [id ] = bpr
222219 else :
223220 # Add an unconditional breakpoint.
@@ -272,23 +269,23 @@ def _run_debugger_custom(self, cmdline):
272269 backtrace = None
273270 if step_info .current_frame :
274271 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 ]
276273
277- log_step = False
274+ record_step = False
278275 debugger_continue = False
279276 bp_to_delete = []
280277 for bp_id in self .debugger .get_triggered_breakpoint_ids ():
281278 try :
282279 # See if this is one of our leading breakpoints.
283280 bpr = self ._leading_bp_handles [bp_id ]
284- log_step = True
281+ record_step = True
285282 except KeyError :
286283 # This is a trailing bp. Mark it for removal.
287284 bp_to_delete .append (bp_id )
288285 if bp_id in self .instr_bp_ids :
289286 self .instr_bp_ids .remove (bp_id )
290287 else :
291- log_step = True
288+ record_step = True
292289 continue
293290
294291 bpr .add_hit ()
@@ -303,7 +300,7 @@ def _run_debugger_custom(self, cmdline):
303300 # Add this backtrace to the stack. While the current
304301 # backtrace matches the top of the stack we'll step,
305302 # 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.
307304 if (
308305 len (step_function_backtraces ) == 0
309306 or backtrace != step_function_backtraces [- 1 ]
@@ -320,7 +317,8 @@ def _run_debugger_custom(self, cmdline):
320317
321318 elif bpr .is_continue :
322319 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 )
324322
325323 else :
326324 # Add a range of trailing breakpoints covering the lines
@@ -342,22 +340,25 @@ def _run_debugger_custom(self, cmdline):
342340 while len (step_function_backtraces ) > 0 :
343341 match_subtrace = False # Backtrace contains a target trace.
344342 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
349355 )
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
355356
356357 if match_trace :
357358 # We want to step through this function; do so and
358359 # log the steps in the step trace.
359360 debugger_next = True
360- log_step = True
361+ record_step = True
361362 break
362363 elif match_subtrace :
363364 # There's a function we care about buried in the
@@ -370,7 +371,7 @@ def _run_debugger_custom(self, cmdline):
370371 # there are no longer reachable.
371372 step_function_backtraces .pop ()
372373
373- if log_step and step_info .current_frame :
374+ if record_step and step_info .current_frame :
374375 # Record the step.
375376 update_step_watches (
376377 step_info , self ._watches , self .step_collection .commands
0 commit comments