(Pdb) 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 command
(self, arg)
| 1287 | # Return true to exit from the command loop |
| 1288 | |
| 1289 | def do_commands(self, arg): |
| 1290 | """(Pdb) commands [bpnumber] |
| 1291 | (com) ... |
| 1292 | (com) end |
| 1293 | (Pdb) |
| 1294 | |
| 1295 | Specify a list of commands for breakpoint number bpnumber. |
| 1296 | The commands themselves are entered on the following lines. |
| 1297 | Type a line containing just 'end' to terminate the commands. |
| 1298 | The commands are executed when the breakpoint is hit. |
| 1299 | |
| 1300 | To remove all commands from a breakpoint, type commands and |
| 1301 | follow it immediately with end; that is, give no commands. |
| 1302 | |
| 1303 | With no bpnumber argument, commands refers to the last |
| 1304 | breakpoint set. |
| 1305 | |
| 1306 | You can use breakpoint commands to start your program up |
| 1307 | again. Simply use the continue command, or step, or any other |
| 1308 | command that resumes execution. |
| 1309 | |
| 1310 | Specifying any command resuming execution (currently continue, |
| 1311 | step, next, return, jump, quit and their abbreviations) |
| 1312 | terminates the command list (as if that command was |
| 1313 | immediately followed by end). This is because any time you |
| 1314 | resume execution (even with a simple next or step), you may |
| 1315 | encounter another breakpoint -- which could have its own |
| 1316 | command list, leading to ambiguities about which list to |
| 1317 | execute. |
| 1318 | |
| 1319 | If you use the 'silent' command in the command list, the usual |
| 1320 | message about stopping at a breakpoint is not printed. This |
| 1321 | may be desirable for breakpoints that are to print a specific |
| 1322 | message and then continue. If none of the other commands |
| 1323 | print anything, you will see no sign that the breakpoint was |
| 1324 | reached. |
| 1325 | """ |
| 1326 | if not arg: |
| 1327 | for bp in reversed(bdb.Breakpoint.bpbynumber): |
| 1328 | if bp is None: |
| 1329 | continue |
| 1330 | bnum = bp.number |
| 1331 | break |
| 1332 | else: |
| 1333 | self.error('cannot set commands: no existing breakpoint') |
| 1334 | return |
| 1335 | else: |
| 1336 | try: |
| 1337 | bnum = int(arg) |
| 1338 | except: |
| 1339 | self._print_invalid_arg(arg) |
| 1340 | return |
| 1341 | try: |
| 1342 | self.get_bpbynumber(bnum) |
| 1343 | except ValueError as err: |
| 1344 | self.error('cannot set commands: %s' % err) |
| 1345 | return |
| 1346 |
nothing calls this directly
no test coverage detected