Question

I want to be able to be able to save or insert programmatically pdb commands, here is a example:

(Pdb) b doc/filename.py:365   
Breakpoint 1 at doc/filename.py:365

(Pdb) commands  # command to be applied to all breaks
(com) silent  # makes it not print the break message
(com) print "Here is my breakpoint!"
(com) c  # continues without stopping on break

So here I am creating a command that will happen on my breakpoint where I will print the text "Here is my breakpoint!" and then continue.

Now my problem is that I have to write all that manually every time I want to have those prints (or any kind of command I want to add). I would like to have a more automated way of adding this commands, maybe saving them in some kind of .pdbrc file or been able to add them with the pdb.set_trace() command as code so I can just paste it instead.

Was it helpful?

Solution

You can add a .pdbrc file in your home or the current directory for that. Here is an example http://code.activestate.com/recipes/498182-sane-tab-completion-in-pdb/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top