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

Method do_clear

tools/python-3.11.9-amd64/Lib/pdb.py:933–978  ·  view source on GitHub ↗

cl(ear) filename:lineno\ncl(ear) [bpnumber [bpnumber...]] With a space separated list of breakpoint numbers, clear those breakpoints. Without argument, clear all breaks (but first ask confirmation). With a filename:lineno argument, clear all breaks at that line

(self, arg)

Source from the content-addressed store, hash-verified

931 complete_ignore = _complete_bpnumber
932
933 def do_clear(self, arg):
934 """cl(ear) filename:lineno\ncl(ear) [bpnumber [bpnumber...]]
935 With a space separated list of breakpoint numbers, clear
936 those breakpoints. Without argument, clear all breaks (but
937 first ask confirmation). With a filename:lineno argument,
938 clear all breaks at that line in that file.
939 """
940 if not arg:
941 try:
942 reply = input('Clear all breaks? ')
943 except EOFError:
944 reply = 'no'
945 reply = reply.strip().lower()
946 if reply in ('y', 'yes'):
947 bplist = [bp for bp in bdb.Breakpoint.bpbynumber if bp]
948 self.clear_all_breaks()
949 for bp in bplist:
950 self.message('Deleted %s' % bp)
951 return
952 if ':' in arg:
953 # Make sure it works for "clear C:\foo\bar.py:12"
954 i = arg.rfind(':')
955 filename = arg[:i]
956 arg = arg[i+1:]
957 try:
958 lineno = int(arg)
959 except ValueError:
960 err = "Invalid line number (%s)" % arg
961 else:
962 bplist = self.get_breaks(filename, lineno)[:]
963 err = self.clear_break(filename, lineno)
964 if err:
965 self.error(err)
966 else:
967 for bp in bplist:
968 self.message('Deleted %s' % bp)
969 return
970 numberlist = arg.split()
971 for i in numberlist:
972 try:
973 bp = self.get_bpbynumber(i)
974 except ValueError as err:
975 self.error(err)
976 else:
977 self.clear_bpbynumber(i)
978 self.message('Deleted %s' % bp)
979 do_cl = do_clear # 'c' is already an abbreviation for 'continue'
980
981 complete_clear = _complete_location

Callers

nothing calls this directly

Calls 12

messageMethod · 0.95
errorMethod · 0.95
inputFunction · 0.85
stripMethod · 0.80
clear_all_breaksMethod · 0.80
rfindMethod · 0.80
get_breaksMethod · 0.80
get_bpbynumberMethod · 0.80
clear_bpbynumberMethod · 0.80
lowerMethod · 0.45
clear_breakMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected