Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse: Improve debugging and display variable values on mouseOver

Is it possible to view variable values in Eclipse when debugging? Right now when I "mouse over" a variable all I get is the definition. e.g. for [int mLastView] I get [com.company.samples.MyClass.mLastView] instead of 1. The value that was assigned to it.

Also, is there anyway to improve debugging in Eclipse?

For starter: making the breakpoints visible as in VS (see below)?

Eclipse Break Point

Eclipse Break Point

Visual Studio Break Point

Visual Studio Break Point

like image 260
Soni Ali Avatar asked Sep 01 '09 17:09

Soni Ali


People also ask

How can you see variable references while debugging in Eclipse?

While debugging you can use the "Display" window where you can write pieces of code and "execute" them with inspect (highlight the code -> right click -> inspect). In that window you have access to all variables of the breakpoint's context.

How do I change the variable value in eclipse while debugging?

Changing a Variable's Value To set a variable go to the Variables view and select the variable you want to change. Right click on the variable and select Change Value... Once you have change the value click ok. The variable now has a new value.

Why Hover is not working in Eclipse?

Go to Window - Preferences - Java - Editor - Hovers. Is "Combined Hover" selected? Uncheck it; apply; close the window; restart debugging session; go back; check it again; apply. If the above doesn't help, you can check "Variable Values" option and specify a modifier key for it.


2 Answers

I posted this over at Stack Overflow and one of the suggestions was to go into Window -> Preferences -> Java -> Editor -> Hovers and select the Variable Values option and assign a modifier.

When I was first trying to resolve this issue, this was one of the options I looked at, but oddly enough, there was no Variable Values preference available, it was missing. Once my “fix” above was applied, it magically appeared:

Click to see the pictureBroken Link

like image 90
afwerwerw Avatar answered Oct 30 '22 13:10

afwerwerw


Actually, since eclipse3.4, not only do you see the value of a variable when you pass the mouse over it, you can actually inspect it:

enter image description here

When debugging, hovers for variables have been enhanced to display an object inspector. The inspector will display logical structures according to the toggle setting in the visible Variables or Expressions view.

like image 28
VonC Avatar answered Oct 30 '22 12:10

VonC