0

When I was at a different company using a different debugger we were able to put a breakpoint at a line of code and have it halt conditionally, like the following:

if ( x > 10 ) {
    halt();
} else {
    printf( "x is only %d\n", x );
}

(Something like that, not that exact syntax).

I was wondering whether you could do this with eclipse (Java)? I guess x would be in the code. This other debugger also let us define debugger variables (local to the debugging) that we could use. Not sure if Eclipse does that?

Another thing, when a variable's value or memory location changes(since some variables could be in registers) you could also halt. Can Eclipse do that? Perhaps you could direct me to a web site containing info like that, which I could not find?

maba
  • 47,113
  • 10
  • 108
  • 118
Tony
  • 367
  • 1
  • 7
  • 17
  • For your second question, see also the accepted answer in the duplicate question, in the screenshot with the radio button *Suspend when value changes.* – Andy Thomas May 12 '15 at 13:25

1 Answers1

1

You can create a breakpoint and make it conditional. Go to Debug prespective. Create the breakpoint and in the breakpoints window you have checkbox "Conditional" and there you write the condition.

enter image description here

Veselin Davidov
  • 7,031
  • 1
  • 15
  • 23