How to set condition breakpoints?

  • Thread starter Christopher J. Bottaro
  • Start date
C

Christopher J. Bottaro

I have a script with a class in it:
class Class:
def f(x, y):
# do something

I start up the debugger like this:
python /usr/lib/python2.3/pdb.py myscript.py

I want to set a conditional breakpoint:
b Class.f, x == 1 and y == 2

....but that doesn't work. How can I do what I want?

Thank you.
 
C

Colin J. Williams

Christopher said:
I have a script with a class in it:
class Class:
def f(x, y):
# do something

I start up the debugger like this:
python /usr/lib/python2.3/pdb.py myscript.py

I want to set a conditional breakpoint:
b Class.f, x == 1 and y == 2

....but that doesn't work. How can I do what I want?

Thank you.
You might consider boa-constructor, implemented for Windows and Linux.

I believe that it provides this functionality. Of course it provides a
lot more.

Colin W.
 
C

Christopher J. Bottaro

Colin said:
You might consider boa-constructor, implemented for Windows and Linux.

I believe that it provides this functionality. Of course it provides a
lot more.

Hmm, thanks for the suggestions. One more quick question. Is it even
possible to set a breakpoint in a class method in pdb.py? I can't even say
"break Class.f" without the condition. I don't think the documentation for
pdb is very good...=(

Thanks.
 
D

Dieter Maurer

Christopher J. Bottaro said:
...
Hmm, thanks for the suggestions. One more quick question. Is it even
possible to set a breakpoint in a class method in pdb.py? I can't even say
"break Class.f" without the condition. I don't think the documentation for
pdb is very good...=(

What happens? I can do it...

However, I had to fix "pdb" to prevent it to set the breakpoint
inside the docstring (where it is not effective).

I hope the fix found its way into the most recent Python versions
(2.3.4 and 2.4).

Dieter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top