break when var = value

mike dee
  • mike dee

    mike dee - 2008-06-03

    trying to figure out how to set a conditional breakpoint that stops execution when a variable in the script hits a certain value

    I set the breakpoint on the line I want to break on, then nav over to the breakpoints tab, click breakpoint to highlight and then rightclick to edit breakpoint.  then things fall apart for me, can't figure out how to toggle the breakpoint to achieve what I'm after.

    any help appreciated, wrist sore form the 110 clicks of the 'run to break' button it requires to get to my debugging point...

    • Damjan Cvetko

      Damjan Cvetko - 2008-06-03

      Hi Mike.

      Sorry to say, current Xdebug release does not yet support conditional breakpoints. And so does the plugin not give an interface to set them. I did a quick jump into the CVS code of Xdebug and support is already in. Just a matter of time, until it's released. I'll update the plugin so it will be possible to set this kind of breakpoint (example: right click add breakpoint..., select type Conditional, enter statement etc...).

      I did think of something that could help you until then, if you know where in the code you are looking for this variable change:

      if ($pesky_variable == "nasty condition") xdebug_break();

      Let me know if it works out for you.
      Best regards.


      • mike dee

        mike dee - 2008-06-03

        good idea on the xdebug_break(), didn't think of that.

        figured out the 'hit' breakpoint condition as the # of times that the breakpoint has been hit, that helped too.

        obligitory feature request:  menu option in right click context menu for breakpoints for "clear all breakpoints",  helps when you've made code changes and the indicated (red ball) breakpoint shows on the supposed correct line when its really not.  easiest just to clear them all and then add one to the line you want.

        and/or, maybe have the breakpoint track to the new line when you do a source code change with a breakpoint set?

        5 lines of code
        breakpoint on line 4
        breaks on line 4
        kill active debugging session (breakpoint still on line 4) with new kill button (very nice btw)
        add 2 lines at line 2, 2nd line is blank
        red breakpoint indicator shows on line 6 now, but breakpoint is really on line 4 which is now blank <- this is the prob
        run debug, breakpoint won't catch due to setting it on blank line 4

        let me know if that doesn't make sense and I'll try to make it clearer

        thanks for the quick response

        • Damjan Cvetko

          Damjan Cvetko - 2008-06-04

          Hi Mike.

          Great idea with the clear all.
          I checked scintilla docs, and I see there is a way to track markers as they move. I'll probably fix things, so whenever a connect happens, the breakpoint positions are updated. Or something. I'll see.
          I'll work on it as soon as I can, busy busy...

          Best regards.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks