MCPcopy Index your code
hub / github.com/python/cpython / set_break

Method set_break

Lib/bdb.py:662–684  ·  view source on GitHub ↗

Set a new breakpoint for filename:lineno. If lineno doesn't exist for the filename, return an error message. The filename should be in canonical form.

(self, filename, lineno, temporary=False, cond=None,
                  funcname=None)

Source from the content-addressed store, hash-verified

660 bp_linenos.append(lineno)
661
662 def set_break(self, filename, lineno, temporary=False, cond=None,
663 funcname=None):
664 """Set a new breakpoint for filename:lineno.
665
666 If lineno doesn't exist for the filename, return an error message.
667 The filename should be in canonical form.
668 """
669 filename = self.canonic(filename)
670 import linecache # Import as late as possible
671 line = linecache.getline(filename, lineno)
672 if not line:
673 return 'Line %s:%d does not exist' % (filename, lineno)
674 self._add_to_breaks(filename, lineno)
675 bp = Breakpoint(filename, lineno, temporary, cond, funcname)
676 # After we set a new breakpoint, we need to search through all frames
677 # and set f_trace to trace_dispatch if there could be a breakpoint in
678 # that frame.
679 frame = self.enterframe
680 while frame:
681 if self.break_anywhere(frame):
682 frame.f_trace = self.trace_dispatch
683 frame = frame.f_back
684 return None
685
686 def _load_breaks(self):
687 """Apply all breakpoints (set in other instances) to this one.

Callers 1

do_breakMethod · 0.45

Calls 5

canonicMethod · 0.95
_add_to_breaksMethod · 0.95
break_anywhereMethod · 0.95
BreakpointClass · 0.85
getlineMethod · 0.45

Tested by

no test coverage detected