Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

insert pdb commands programmatically

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.

like image 362
Hassek Avatar asked Nov 11 '22 10:11

Hassek


1 Answers

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/

like image 124
user3564635 Avatar answered Nov 15 '22 08:11

user3564635