Set a new breakpoint for filename:lineno. If lineno doesn't exist for the filename, return an error message. The filename should be in canonical form.
(self, filename, lineno, temporary=False, cond=None,
funcname=None)
| 660 | bp_linenos.append(lineno) |
| 661 | |
| 662 | def set_break(self, filename, lineno, temporary=False, cond=None, |
| 663 | funcname=None): |
| 664 | """Set a new breakpoint for filename:lineno. |
| 665 | |
| 666 | If lineno doesn't exist for the filename, return an error message. |
| 667 | The filename should be in canonical form. |
| 668 | """ |
| 669 | filename = self.canonic(filename) |
| 670 | import linecache # Import as late as possible |
| 671 | line = linecache.getline(filename, lineno) |
| 672 | if not line: |
| 673 | return 'Line %s:%d does not exist' % (filename, lineno) |
| 674 | self._add_to_breaks(filename, lineno) |
| 675 | bp = Breakpoint(filename, lineno, temporary, cond, funcname) |
| 676 | # After we set a new breakpoint, we need to search through all frames |
| 677 | # and set f_trace to trace_dispatch if there could be a breakpoint in |
| 678 | # that frame. |
| 679 | frame = self.enterframe |
| 680 | while frame: |
| 681 | if self.break_anywhere(frame): |
| 682 | frame.f_trace = self.trace_dispatch |
| 683 | frame = frame.f_back |
| 684 | return None |
| 685 | |
| 686 | def _load_breaks(self): |
| 687 | """Apply all breakpoints (set in other instances) to this one. |
no test coverage detected