How to set condition breakpoints?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christopher J. Bottaro

    #1

    How to set condition breakpoints?

    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.

  • Colin J. Williams

    #2
    Re: How to set condition breakpoints?

    Christopher J. Bottaro wrote:[color=blue]
    > 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.
    >[/color]
    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.

    Comment

    • Christopher J. Bottaro

      #3
      Re: How to set condition breakpoints?

      Colin J. Williams wrote:
      [color=blue]
      > Christopher J. Bottaro wrote:[color=green]
      >> 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.
      >>[/color]
      > You might consider boa-constructor, implemented for Windows and Linux.
      >
      > I believe that it provides this functionality. Of course it provides a
      > lot more.[/color]

      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.

      Comment

      • Dieter Maurer

        #4
        Re: How to set condition breakpoints?

        "Christophe r J. Bottaro" <cjbottaro@alum ni.cs.utexas.ed u> writes on Fri, 10 Dec 2004 11:45:19 -0600:[color=blue]
        > ...
        > 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...=([/color]

        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

        Comment

        Working...