MCPcopy Index your code
hub / github.com/python/cpython / do_condition

Method do_condition

Lib/pdb.py:1598–1628  ·  view source on GitHub ↗

condition bpnumber [condition] Set a new condition for the breakpoint, an expression which must evaluate to true before the breakpoint is honored. If condition is absent, any existing condition is removed; i.e., the breakpoint is made unconditional.

(self, arg)

Source from the content-addressed store, hash-verified

1596 complete_disable = _complete_bpnumber
1597
1598 def do_condition(self, arg):
1599 """condition bpnumber [condition]
1600
1601 Set a new condition for the breakpoint, an expression which
1602 must evaluate to true before the breakpoint is honored. If
1603 condition is absent, any existing condition is removed; i.e.,
1604 the breakpoint is made unconditional.
1605 """
1606 if not arg:
1607 self._print_invalid_arg(arg)
1608 return
1609 args = arg.split(' ', 1)
1610 try:
1611 cond = args[1]
1612 if err := self._compile_error_message(cond):
1613 self.error('Invalid condition %s: %r' % (cond, err))
1614 return
1615 except IndexError:
1616 cond = None
1617 try:
1618 bp = self.get_bpbynumber(args[0].strip())
1619 except IndexError:
1620 self.error('Breakpoint number expected')
1621 except ValueError as err:
1622 self.error(err)
1623 else:
1624 bp.cond = cond
1625 if not cond:
1626 self.message('Breakpoint %d is now unconditional.' % bp.number)
1627 else:
1628 self.message('New condition set for breakpoint %d.' % bp.number)
1629
1630 complete_condition = _complete_bpnumber
1631

Callers

nothing calls this directly

Calls 7

_print_invalid_argMethod · 0.95
errorMethod · 0.95
messageMethod · 0.95
get_bpbynumberMethod · 0.80
splitMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected