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 argum
(self, arg, temporary = 0)
| 606 | complete_commands = _complete_bpnumber |
| 607 | |
| 608 | def do_break(self, arg, temporary = 0): |
| 609 | """b(reak) [ ([filename:]lineno | function) [, condition] ] |
| 610 | Without argument, list all breaks. |
| 611 | |
| 612 | With a line number argument, set a break at this line in the |
| 613 | current file. With a function name, set a break at the first |
| 614 | executable line of that function. If a second argument is |
| 615 | present, it is a string specifying an expression which must |
| 616 | evaluate to true before the breakpoint is honored. |
| 617 | |
| 618 | The line number may be prefixed with a filename and a colon, |
| 619 | to specify a breakpoint in another file (probably one that |
| 620 | hasn't been loaded yet). The file is searched for on |
| 621 | sys.path; the .py suffix may be omitted. |
| 622 | """ |
| 623 | if not arg: |
| 624 | if self.breaks: # There's at least one |
| 625 | self.message("Num Type Disp Enb Where") |
| 626 | for bp in bdb.Breakpoint.bpbynumber: |
| 627 | if bp: |
| 628 | self.message(bp.bpformat()) |
| 629 | return |
| 630 | # parse arguments; comma has lowest precedence |
| 631 | # and cannot occur in filename |
| 632 | filename = None |
| 633 | lineno = None |
| 634 | cond = None |
| 635 | comma = arg.find(',') |
| 636 | if comma > 0: |
| 637 | # parse stuff after comma: "condition" |
| 638 | cond = arg[comma+1:].lstrip() |
| 639 | arg = arg[:comma].rstrip() |
| 640 | # parse stuff before comma: [filename:]lineno | function |
| 641 | colon = arg.rfind(':') |
| 642 | funcname = None |
| 643 | if colon >= 0: |
| 644 | filename = arg[:colon].rstrip() |
| 645 | f = self.lookupmodule(filename) |
| 646 | if not f: |
| 647 | self.error('%r not found from sys.path' % filename) |
| 648 | return |
| 649 | else: |
| 650 | filename = f |
| 651 | arg = arg[colon+1:].lstrip() |
| 652 | try: |
| 653 | lineno = int(arg) |
| 654 | except ValueError: |
| 655 | self.error('Bad lineno: %s' % arg) |
| 656 | return |
| 657 | else: |
| 658 | # no colon; can be lineno or function |
| 659 | try: |
| 660 | lineno = int(arg) |
| 661 | except ValueError: |
| 662 | try: |
| 663 | func = eval(arg, |
| 664 | self.curframe.f_globals, |
| 665 | self.curframe_locals) |
no test coverage detected