How to find the breakpoint numbers in pdb (ipdb)?

♀尐吖头ヾ 提交于 2021-02-07 05:16:41

问题


Trying to find how to execute ipdb (or pdb) commands such as disable.

Calling the h command on disable says

disable bpnumber [bpnumber ...] Disables the breakpoints given as a space separated list of bp numbers.

So how whould I get those bp numbers? was looking through the list of commands and couldn't get any to display the bp numbers

[EDIT] The break, b and info breakpoints commands don't do anything, although in my module i clearly have 1 breakpoint set like this import pdb; pdb.set_trace( ) - same for ipdb. Moreover info is not defined.

The output of help in pdb:

Documented commands (type help ): ======================================== EOF bt cont enable jump pp run unt a c continue exit l q s until alias cl d h
list quit step up args clear debug help n
r tbreak w b commands disable ignore next restart u whatis break condition down j p
return unalias where

Miscellaneous help topics: ========================== exec pdb

Undocumented commands: ====================== retval rv

And for ipdb:

Documented commands (type help ): ======================================== EOF bt cont enable jump pdef psource run unt a c
continue exit l pdoc q s until alias cl
d h list pfile quit step up args clear debug help n pinfo r tbreak w b
commands disable ignore next pinfo2 restart u whatis break condition down j p pp return unalias where

Miscellaneous help topics: ========================== exec pdb

Undocumented commands: ====================== retval rv

I have saved my module as pb3.py and am executing it within the command line like this

python -m pb3 The execution does indeed stop at the breakpoint, but within di pdb (ipdb) console, the commands indicated don't display anything - or display a NameError

If more info is needed, i will provide it.


回答1:


Use the break command. Don't add any line numbers and it will list all instead of adding them.




回答2:


info breakpoints

or just

info b

lists all breakpoints.



来源:https://stackoverflow.com/questions/21582358/how-to-find-the-breakpoint-numbers-in-pdb-ipdb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!