I'm used to GDB, where b does that.
But in pdb, b just list breakpoints.
I can do b 123, but lazy to type 123.
Maybe a magic argument like b .?
I know PyCharm and __import__('pdb').set_trace(), just checking if there is an usable CLI alternative for those quick debugs.
if you accept adding a new pdb command, it is trivial:
def do_breakcurrent(self, arg):
cur_lineno = str(self.curframe.f_lineno)
return self.do_break(cur_lineno)
import pdb
pdb.Pdb.do_breakcurrent = pdb.Pdb.do_bc = do_breakcurrent
use breakcurrent or bc:
(Pdb) bc
Breakpoint 1 at /Users/georgexsh/workspace/so/52110534.py:11
if you want to put those code into .pdbrc to make it available automatically, need little tweak:
import pdb
pdb.Pdb.do_bc = lambda self,arg: self.do_break(str(self.curframe.f_lineno))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With