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

Method do_break

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

b(reak) [ ([filename:]lineno | function) [, condition] ] Without argument, list all breaks. With a line number argument, set a break at this line in the current file. With a function name, set a break at the first executable line of that function. If a second

(self, arg, temporary = 0)

Source from the content-addressed store, hash-verified

663 complete_commands = _complete_bpnumber
664
665 def do_break(self, arg, temporary = 0):
666 """b(reak) [ ([filename:]lineno | function) [, condition] ]
667 Without argument, list all breaks.
668
669 With a line number argument, set a break at this line in the
670 current file. With a function name, set a break at the first
671 executable line of that function. If a second argument is
672 present, it is a string specifying an expression which must
673 evaluate to true before the breakpoint is honored.
674
675 The line number may be prefixed with a filename and a colon,
676 to specify a breakpoint in another file (probably one that
677 hasn't been loaded yet). The file is searched for on
678 sys.path; the .py suffix may be omitted.
679 """
680 if not arg:
681 if self.breaks: # There's at least one
682 self.message("Num Type Disp Enb Where")
683 for bp in bdb.Breakpoint.bpbynumber:
684 if bp:
685 self.message(bp.bpformat())
686 return
687 # parse arguments; comma has lowest precedence
688 # and cannot occur in filename
689 filename = None
690 lineno = None
691 cond = None
692 comma = arg.find(',')
693 if comma > 0:
694 # parse stuff after comma: "condition"
695 cond = arg[comma+1:].lstrip()
696 arg = arg[:comma].rstrip()
697 # parse stuff before comma: [filename:]lineno | function
698 colon = arg.rfind(':')
699 funcname = None
700 if colon >= 0:
701 filename = arg[:colon].rstrip()
702 f = self.lookupmodule(filename)
703 if not f:
704 self.error('%r not found from sys.path' % filename)
705 return
706 else:
707 filename = f
708 arg = arg[colon+1:].lstrip()
709 try:
710 lineno = int(arg)
711 except ValueError:
712 self.error('Bad lineno: %s' % arg)
713 return
714 else:
715 # no colon; can be lineno or function
716 try:
717 lineno = int(arg)
718 except ValueError:
719 try:
720 func = eval(arg,
721 self.curframe.f_globals,
722 self.curframe_locals)

Callers 1

do_tbreakMethod · 0.95

Calls 13

messageMethod · 0.95
lookupmoduleMethod · 0.95
errorMethod · 0.95
lineinfoMethod · 0.95
defaultFileMethod · 0.95
checklineMethod · 0.95
bpformatMethod · 0.80
lstripMethod · 0.80
rfindMethod · 0.80
get_breaksMethod · 0.80
findMethod · 0.45
rstripMethod · 0.45

Tested by

no test coverage detected