Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a breakpoint on a Class NOT a Line in Eclipse?

I simply would like to start debugging once any function is invoked in a specific set of classes.

Is it possible to achieve this in Eclipse ? or do I have to set a breakpoint on each function in each class I want to debug?

UPDATE:

I didn't ask how to set a breakpoint in eclipse. I would like to debug a class without knowing which function is going to be called.

UPDATE 2:

(I am going to make my problem more clear)

I was requested to fix a bug in an application (Which I didn't implement). I managed to narrow down the related classes to this bug. The problem each class has over 30 functions. And I don't know exactly which functions are invoked. So I was thinking if its possible to set a breakpoint somehow on the class itself in order to start debugging once a function within this class is invoked.

I would appreciate any help,

Tefa

like image 900
TeFa Avatar asked Mar 03 '14 13:03

TeFa


People also ask

How do you set a break point in class?

You can set a method breakpoint using the outline view of the class in question. Then the debugger breaks at the first line of the method. For some reason the right-click menu for the method does not contain "Toggle Method Breakpoint" on a fresh workspace, but shows up after another breakpoint was set.

How do I set breakpoint conditions in Eclipse?

First, set a breakpoint at a given location. Then, use the context menu on the breakpoint in the left editor margin or in the Breakpoints view in the Debug perspective, and select the breakpoint’s properties. In the dialog box, check Enable Condition, and enter an arbitrary Java condition, such as list.

How do you set a breakpoint in line?

Right-click the marker bar (the vertical bar to the left of the main text area) directly to the left of the line where you want to add the breakpoint and select Toggle Breakpoints from the pop-up menu. Double-click the marker bar directly to the left of the line where you want to add the breakpoint.

How to set a breakpoint in Visual Studio Code?

Set Breakpoints: To set a breakpoint, select one line of code first, then move mouse to the left most area of that line (as shown in below picture), either double click or right click then select "Toggle Breakpoint" in the popup list, a small blue ball will appear, that means a breakpoint has been set successfully.

How do I create a conditional breakpoint in Eclipse?

How to create a conditional breakpoint To create a conditional breakpoint, first set a breakpoint on a line (Ctrl+Shift+B), right-click on the breakpoint and select Breakpoint Properties. Then configure a condition that returns a boolean. Eclipse only stops if the conditions returns true.

How do I stop a breakpoint in Eclipse?

But Eclipse does provide other conditions to cater for the other situations. If you want to stop a breakpoint only after the line has been executed a certain number of times, select Hit Count and enter a number. This is handy for running through loops where you’re only interested in, say, the 2nd iteration.

How do I set breakpoints in PHP?

These procedures demonstrate how to set line and conditional PHP breakpoints. Double-click the vertical ruler to the left of the line where you want to set the breakpoint -or- select the line and go to Run | Toggle Breakpoint or press Ctrl+Shift+B.HERE A blue ball will appear, indicating that a breakpoint has been set.


2 Answers

I don't think you can select a class for debugging but you could go to the Outline view in eclipse, select all the methods in the class, right click and select Toggle Method Breakpoint

enter image description here

like image 68
Sionnach733 Avatar answered Sep 21 '22 13:09

Sionnach733


In recent eclipse versions, the feature you were searching for is now available.

In the Outline you may right-click on the class and choose "Toggle Class Load Breakpoint" from the context-menu.

like image 40
gsus Avatar answered Sep 21 '22 13:09

gsus