FAQ
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.

Search Discussions

  • Colin J. Williams at Dec 10, 2004 at 2:10 pm

    Christopher J. Bottaro wrote:
    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.
  • Christopher J. Bottaro at Dec 10, 2004 at 5:45 pm

    Colin J. Williams wrote:

    Christopher J. Bottaro wrote:
    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.
    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.
  • Dieter Maurer at Dec 18, 2004 at 7:31 pm

    "Christopher J. Bottaro" <cjbottaro at alumni.cs.utexas.edu> writes on Fri, 10 Dec 2004 11:45:19 -0600:
    ...
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedDec 9, '04 at 10:56p
activeDec 18, '04 at 7:31p
posts4
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase