Commands for Breakpoints in the .pdbrc File

I would like to save the commands for the breakpoint at .pdbrc, something like:

b 81 
commands 1 
pp foo.attr1 
pp foo.attr2 
end 
b 108 
commands 2 
pp bar.attr1 
pp bar.attr2 
end 

This automates the setup of the environment for the debugging session. However, this does not work with python -m pdb script.py, because the commands 1pdb prompt is launched on the line and requests commands for the first breakpoint, ignoring what I wrote in .pdbrc; In addition, it calls NameErrorafter entering the type endat the pdb prompt because foo.attr1, foo.attr2and even end. The same thing happens with the rest of the breakpoints, so I end up with their settings, but not their commands.

What will be the correct way? Is it possible?

+3
source share
2

, , , pdb . , :

alias setup_myproj b 81;; commands 1;; pp foo.attr1;; pp foo.attr2;; end

setup_myproj, .

+1

, :

commands 1;; pp foo.attr1;; pp foo.attr2;; end;;

, , , :

Usage : commands [bnum]
        ...
        end

.pdbrc

pdb.py, , pdbrc. , , pdbrc, , .

0

Source: https://habr.com/ru/post/1727492/


All Articles