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