Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call class instance method while debugging in eclipse

Tags:

java

eclipse

How do I call a class instance method while debugging in eclipse?

For example lets say I have the following code:

...
Canvas canvas = m_SurfaceHolder.lockCanvas();
canvas.drawColor(0xff000000);
...

And I have a breakpoint on the line canvas.drawColor. When I debug, the code stops at that line and I can view the variables inside canvas, but I also want to be able to call the methods inside canvas to see what they return like I can in visual studio, is this possible?

like image 485
NomenNescio Avatar asked Jan 22 '12 18:01

NomenNescio


People also ask

How do I debug a method in Eclipse?

A Java program can be debugged simply by right clicking on the Java editor class file from Package explorer. Select Debug As → Java Application or use the shortcut Alt + Shift + D, J instead.

How do you evaluate while debugging in Eclipse?

On the code, Right-click -> Inspect to see the value. You can select an expression then open Context Menu -> Inspect or press CTRL + Shift + I, during debugging, the result will be displayed.

How do you step through a breakpoint in Eclipse?

Use F5 to trace into, F6 to step over, CTRL-SHIFT-B to set/remove breakpoints.


1 Answers

Open the Display view, type the code you want to execute in it, select it, right-click, and click "Execute", "Display" or "Inspect", depending on what you want to do.

like image 198
JB Nizet Avatar answered Oct 30 '22 02:10

JB Nizet