Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
Feature or enhancement
Proposal:
I propose to add acommands argument topdb.set_trace andpdb.Pdb.set_trace. Thecommands fed should be a list of pdb commands that will be executed the first time the debugger is brought up - it's very similar to.pdbrc.
importpdbdeff():x=1# should print 1 and continuepdb.set_trace(commands=['p x','c'])f()
There are many use cases
- Some users use
.pdbrcas debugging scripts, and sometimes it's not the best way because that would be the same for the whole directory. Being able to feed pdb commands can save user a lot of time re-typing all the commands after they try some fix. - It would be much easier to serve a repro regarding pdb on a silver platter. When user reports bugs about pdb, they had to give both the source code, and the commands they use to trigger the bug. With this command, the user can provide a simple one-piece script for the minimal repro.
- For cases where
stdinis not available, or not super convenient, this could help. For example, in testing. Also, I talked withpyodidemaintainer about supportingpdbon webbrowser, and one of the issue was the lack ofstdin. They successfully made it work with some workaround, but this could help the case. - It's useful for remote help. It's not uncommon that a more senior developer needs to help a newbee remotely. They could send a fully ready piece of code that contains the command and ask the person to simply put it in and get the result.
This feature is also trivial to implement and easy to maintain - all the pieces are already there.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response