MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / Breakpoint

Class Breakpoint

tools/python-3.11.9-amd64/Lib/bdb.py:657–774  ·  view source on GitHub ↗

Breakpoint class. Implements temporary breakpoints, ignore counts, disabling and (re)-enabling, and conditionals. Breakpoints are indexed by number through bpbynumber and by the (file, line) tuple using bplist. The former points to a single instance of class Breakpoint.

Source from the content-addressed store, hash-verified

655
656
657class Breakpoint:
658 """Breakpoint class.
659
660 Implements temporary breakpoints, ignore counts, disabling and
661 (re)-enabling, and conditionals.
662
663 Breakpoints are indexed by number through bpbynumber and by
664 the (file, line) tuple using bplist. The former points to a
665 single instance of class Breakpoint. The latter points to a
666 list of such instances since there may be more than one
667 breakpoint per line.
668
669 When creating a breakpoint, its associated filename should be
670 in canonical form. If funcname is defined, a breakpoint hit will be
671 counted when the first line of that function is executed. A
672 conditional breakpoint always counts a hit.
673 """
674
675 # XXX Keeping state in the class is a mistake -- this means
676 # you cannot have more than one active Bdb instance.
677
678 next = 1 # Next bp to be assigned
679 bplist = {} # indexed by (file, lineno) tuple
680 bpbynumber = [None] # Each entry is None or an instance of Bpt
681 # index 0 is unused, except for marking an
682 # effective break .... see effective()
683
684 def __init__(self, file, line, temporary=False, cond=None, funcname=None):
685 self.funcname = funcname
686 # Needed if funcname is not None.
687 self.func_first_executable_line = None
688 self.file = file # This better be in canonical form!
689 self.line = line
690 self.temporary = temporary
691 self.cond = cond
692 self.enabled = True
693 self.ignore = 0
694 self.hits = 0
695 self.number = Breakpoint.next
696 Breakpoint.next += 1
697 # Build the two lists
698 self.bpbynumber.append(self)
699 if (file, line) in self.bplist:
700 self.bplist[file, line].append(self)
701 else:
702 self.bplist[file, line] = [self]
703
704 @staticmethod
705 def clearBreakpoints():
706 Breakpoint.next = 1
707 Breakpoint.bplist = {}
708 Breakpoint.bpbynumber = [None]
709
710 def deleteMe(self):
711 """Delete the breakpoint from the list associated to a file:line.
712
713 If it is the last breakpoint in that position, it also deletes
714 the entry for the file:line.

Callers 1

set_breakMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected