MCPcopy Index your code
hub / github.com/RustPython/RustPython / Breakpoint

Class Breakpoint

Lib/bdb.py:970–1087  ·  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. The l

Source from the content-addressed store, hash-verified

968
969
970class Breakpoint:
971 """Breakpoint class.
972
973 Implements temporary breakpoints, ignore counts, disabling and
974 (re)-enabling, and conditionals.
975
976 Breakpoints are indexed by number through bpbynumber and by
977 the (file, line) tuple using bplist. The former points to a
978 single instance of class Breakpoint. The latter points to a
979 list of such instances since there may be more than one
980 breakpoint per line.
981
982 When creating a breakpoint, its associated filename should be
983 in canonical form. If funcname is defined, a breakpoint hit will be
984 counted when the first line of that function is executed. A
985 conditional breakpoint always counts a hit.
986 """
987
988 # XXX Keeping state in the class is a mistake -- this means
989 # you cannot have more than one active Bdb instance.
990
991 next = 1 # Next bp to be assigned
992 bplist = {} # indexed by (file, lineno) tuple
993 bpbynumber = [None] # Each entry is None or an instance of Bpt
994 # index 0 is unused, except for marking an
995 # effective break .... see effective()
996
997 def __init__(self, file, line, temporary=False, cond=None, funcname=None):
998 self.funcname = funcname
999 # Needed if funcname is not None.
1000 self.func_first_executable_line = None
1001 self.file = file # This better be in canonical form!
1002 self.line = line
1003 self.temporary = temporary
1004 self.cond = cond
1005 self.enabled = True
1006 self.ignore = 0
1007 self.hits = 0
1008 self.number = Breakpoint.next
1009 Breakpoint.next += 1
1010 # Build the two lists
1011 self.bpbynumber.append(self)
1012 if (file, line) in self.bplist:
1013 self.bplist[file, line].append(self)
1014 else:
1015 self.bplist[file, line] = [self]
1016
1017 @staticmethod
1018 def clearBreakpoints():
1019 Breakpoint.next = 1
1020 Breakpoint.bplist = {}
1021 Breakpoint.bpbynumber = [None]
1022
1023 def deleteMe(self):
1024 """Delete the breakpoint from the list associated to a file:line.
1025
1026 If it is the last breakpoint in that position, it also deletes
1027 the entry for the file:line.

Callers 1

set_breakMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected