Soni Ali
Soni Ali

Reputation: 19010

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

Upvotes: 10

Views: 15820

Answers (5)

afwerwerw
afwerwerw

Reputation: 51

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

Upvotes: 5

VonC
VonC

Reputation: 1328712

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.

Upvotes: 4

virgo47
virgo47

Reputation: 2333

About breakpoint visibility:

Right-click on the right outline of the editor, you'll see some Preferences, and there in Annotations you can select Breakpoints. I personally added Text as Highlighted and some pinky colour. Shame that the highlighting is really buggy, sticks here and there, breaks between lines, etc. But it somehow works for most cases.

(Another shame is that breakpoint bullet is often hidden behind some suggestion icon or what - why they can't make the gutter wider like Idea does, I don't know.)

Upvotes: 2

tommy le
tommy le

Reputation: 11

I got similar but a little different problem with the thread-starter. Sometimes during debugging, I mouse over a variable, I see it current value. Sometimes it's just the definition, like in coding mode. So what caused the first case, what the second?

PS: Of course I can always choose to view Variables (Alt+Shift+Q,V) but it's faster if you have mouse over value instantly. Thanks

Upvotes: 1

Wayne Beaton
Wayne Beaton

Reputation: 306

If you hit the breakpoint while you are debugging, you do see the value of the variable when you mouse over. You can also select an expression, and inspect the value of it's evaluation using the "Inspect" menu option. You can also use the "Variables" view to see the current value of all in-scope variables.

Upvotes: 3

Related Questions