This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pdb: Add step / next count arguments
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: barry, louielu, rhettinger, vstinner, xdegaye
Priority: normal Keywords:

Created on 2017-06-26 10:10 by louielu, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 2399 open louielu, 2017-06-26 10:12
Messages (4)
msg296869 - (view) Author: Louie Lu (louielu) * Date: 2017-06-26 10:10
This propose to add *count* times on step and next instruction in pdb.

    step [count]
    next [count]

User can use `next [count]` to run next *count* times, or `step [count]` to run step *count* times, until it countdown, or occure a breakpoint.

Similar function has been implemented in gdb[1] before.

[1]: https://sourceware.org/gdb/onlinedocs/gdb/Continuing-and-Stepping.html
msg296871 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-26 10:14
@Xavier: Would you mind to review this enhancement? Thanks.
msg296906 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-06-26 15:20
Thanks for this PR Louie, adding count to the pdb commands is useful.

With gdb a very common use case is to set a breakpoint where the code runs very frequently and when only interested in the N(th) execution of this code, to enter the breakpoint command list:

(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>silent
>continue <N - 1>
>end
(gdb)

PR 2399 does not handle this case for pdb:
* The 'count' option for the 'continue' command is not implemented.
* The implementation of the 'count' option for 'next' and 'step' does not handle breakpoint command lists (I think).
IMO it is difficult to handle this option for breakpoint command lists directly in pdb.py, but it could be done in bdb.py, adding a keyword argument to set_continue() et al.
msg296930 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-06-26 18:42
FWIW, I've never needed this ever.
History
Date User Action Args
2022-04-11 14:58:48adminsetgithub: 74946
2017-08-26 19:29:59barrysetnosy: + barry
2017-06-26 18:42:27rhettingersetnosy: + rhettinger
messages: + msg296930
2017-06-26 15:20:29xdegayesetmessages: + msg296906
2017-06-26 10:14:07vstinnersetnosy: + xdegaye, vstinner
messages: + msg296871
2017-06-26 10:12:00louielusetpull_requests: + pull_request2446
2017-06-26 10:10:13louielucreate