Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between "toggle line breakpoint" and "toggle breakpoint" in Eclipse?

I just cannot understand the two options under the Run button of the menu in Eclipse. Doesn't the usually breakpoint refer to a line? I realize that there could be this case:

if (x >= 0 && x < 4 && y >= 0 
    && y < 4)
source ^= 1 << (x * 4 + y);

However when toggle line breakpoint of the 2nd line to set a breakpoint, it can also be unset by toggle breakpoint.So what's their difference on earth and how to distinguish them with the symbols?

like image 247
Hongxu Chen Avatar asked Mar 10 '12 09:03

Hongxu Chen


1 Answers

In eclipse you can have 5 types of break points:

  • the one you are used to: the ordinary line breakpoint
  • a conditional breakpoint in which you stop on a line, but only when a certain condition is met
  • method breakpoint that is triggered when you enter in a method
  • an exception breakpoint, that stops on any line that throws a certain exception.
  • (as per the comments I have forgotten about those) watchpoints: using them you will break whenever a certain field is accessed or modified. They can be configured from the outline view.

The second option is also put on a certain line, but as long as it needs to be configured it might be considered as something more special. The symbols of the first two breakpoints are different. The third has special symbol too. The fourth one has no symbol (it does not belong to any specific place).

This comes as explanation fighting off your words Doesn't the usually breakpoint refer to a line.

Also you can see the difference between the two if you have such code:

void func() {
    int a = 16;
}

Try doing toggle breakpoint and toggle line breakpoint on the line void func(). Do you see the difference? Toggle breakpoint actually chooses the suitable option between toggle line breakpoint and toggle method breakpoint.

like image 164
Boris Strandjev Avatar answered Sep 20 '22 07:09

Boris Strandjev