commands [bpnumber] (com) ... (com) end (Pdb) Specify a list of commands for breakpoint number bpnumber. The commands themselves are entered on the following lines. Type a line containing just 'end' to terminate the commands. The comma
(self, arg)
| 578 | # Return true to exit from the command loop |
| 579 | |
| 580 | def do_commands(self, arg): |
| 581 | """commands [bpnumber] |
| 582 | (com) ... |
| 583 | (com) end |
| 584 | (Pdb) |
| 585 | |
| 586 | Specify a list of commands for breakpoint number bpnumber. |
| 587 | The commands themselves are entered on the following lines. |
| 588 | Type a line containing just 'end' to terminate the commands. |
| 589 | The commands are executed when the breakpoint is hit. |
| 590 | |
| 591 | To remove all commands from a breakpoint, type commands and |
| 592 | follow it immediately with end; that is, give no commands. |
| 593 | |
| 594 | With no bpnumber argument, commands refers to the last |
| 595 | breakpoint set. |
| 596 | |
| 597 | You can use breakpoint commands to start your program up |
| 598 | again. Simply use the continue command, or step, or any other |
| 599 | command that resumes execution. |
| 600 | |
| 601 | Specifying any command resuming execution (currently continue, |
| 602 | step, next, return, jump, quit and their abbreviations) |
| 603 | terminates the command list (as if that command was |
| 604 | immediately followed by end). This is because any time you |
| 605 | resume execution (even with a simple next or step), you may |
| 606 | encounter another breakpoint -- which could have its own |
| 607 | command list, leading to ambiguities about which list to |
| 608 | execute. |
| 609 | |
| 610 | If you use the 'silent' command in the command list, the usual |
| 611 | message about stopping at a breakpoint is not printed. This |
| 612 | may be desirable for breakpoints that are to print a specific |
| 613 | message and then continue. If none of the other commands |
| 614 | print anything, you will see no sign that the breakpoint was |
| 615 | reached. |
| 616 | """ |
| 617 | if not arg: |
| 618 | bnum = len(bdb.Breakpoint.bpbynumber) - 1 |
| 619 | else: |
| 620 | try: |
| 621 | bnum = int(arg) |
| 622 | except: |
| 623 | self.error("Usage: commands [bnum]\n ...\n end") |
| 624 | return |
| 625 | try: |
| 626 | self.get_bpbynumber(bnum) |
| 627 | except ValueError as err: |
| 628 | self.error('cannot set commands: %s' % err) |
| 629 | return |
| 630 | |
| 631 | self.commands_bnum = bnum |
| 632 | # Save old definitions for the case of a keyboard interrupt. |
| 633 | if bnum in self.commands: |
| 634 | old_command_defs = (self.commands[bnum], |
| 635 | self.commands_doprompt[bnum], |
| 636 | self.commands_silent[bnum]) |
| 637 | else: |
nothing calls this directly
no test coverage detected