1

I use import ipdb;ipdb.set_trace()

Sometimes, while debugging with set_trace I want verify some method out of frame/source (invoke it with my parameters, and see how it works inside). Method is not used yet in code, so jump is impossible.

sth like:

def do_a(): ...
def do_b(): ...
def do_c(): ...

def do_d():
  do_a()
  import ipdb;ipdb.set_trace()

# here: wanna check do_c before do_b, but not just get result from do_c (it's easy), rather trace throught entire do_c and keep position in current frame.

  do_b()

there is debug command, but do not work with functions, I expect interactive shell.

Workaround is time-consuming: stop debugger, modify code (add do_c() in example) and restart debugger)

Sławomir Lenart
  • 7,543
  • 4
  • 45
  • 61

1 Answers1

1

Not sure this works as this is quite rare use case.

Set breakpoint with breakpoint settings command like tbreak:

http://georgejhunt.com/olpc/pydebug/pydebug/ipdb.html

  tbreak do_b   # Might or might not work

Then just execute do_b and it should hit the breakpoint

  do_b()
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
  • nope, doesnt work - it's just breakpoint for code loaded in frame; I guess that I need use separate new frame for this (?), but this is not my level. however I found pudb - nice alternative. – Sławomir Lenart Sep 04 '13 at 21:23