well actually
well actually

Reputation: 12370

Variables not showing while debugging in Eclipse

I am running Eclipse Galileo for developers.

When I run in debug mode, the current variables and their values are not coming up in the Variables window. The window remains empty when I step through my code after a breakpoint.

Last night it was working, so I'm perplexed. Any reason why this might be happening and any tip on troubleshooting?

Upvotes: 119

Views: 192842

Answers (30)

M2014
M2014

Reputation: 1164

There could be different reasons.
For my cases, variable value showing had been working for long time. Then one day, it just stopped working in same line of code. I found out the culprit was that aborted but still hanging JUnit test threads holding on Windows file resources.
After closing all Windows applications(including Eclipse), I found there were a couple of directories (under JUnit test resource directory) which I can't delete because some files there were locked for unknown reason.
So I tried a Windows reboot which fixed the Eclipse debug issue.

Upvotes: 0

theRiley
theRiley

Reputation: 1167

Nothing above worked for me. What did work was this (from menu) :

Window -> Perspective -> Close Perspective

then

Window -> Perspective -> Open Perspective -> Debug

Upvotes: 1

LearnerForLife
LearnerForLife

Reputation: 157

Go to Eclipse Menu --> Window ==> Show View ==> Variables

This should bring back your variables window in eclipse

Upvotes: 2

Rohit Gaikwad
Rohit Gaikwad

Reputation: 3914

Most often you would have imported multiple eclipse projects and you have switched between Git Branch. And then, you build and import incorrect project where debugger is not expected to come!

If reset eclipse Perspective doesn't worked. Then do following things :

  1. Delete eclipse project from disk.

  2. Clean and Build the eclipse project (In my case I used ANT tool).
    Note: Verify whether your are building the project in which the debugger is expected to come. The correct project name to be built can be found by hovering over a file where debug point is set.

  3. Import that eclipse project again.

  4. Also, Verify whether correct JDK is being selected at Preferences -> Installed JREs

Upvotes: 0

FindingMyWay
FindingMyWay

Reputation: 1

Assuming you have your debug view just how you like it and don't want to have to reset it everytime this bug appears, try this. This assumes your "Debug View" has both "Expressions" and "Variables" views open.

Double-Click the Expressions tab (the actual tab with the text, not the 'window bar'). This will maximise it. Repeat to restore it to previous size/location. That should reset everything except Expressions. Repeat for the variables tab and it will reset expressions.

This worked for me on Windows 10 with Eclipse:
Version: 2018-09 (4.9.0)
Build id: 20180917-1800
Java: jdk1.8.0_171

Upvotes: 0

romsky
romsky

Reputation: 884

Like with every bad software the treatment for this wrong behaivier does not exist. What is good for one does not work for others.

I let the debuger to stop on a brakepoint once, then again second time and on the third time the beast has shown the Variable View with all data in it.

Upvotes: 0

Luke Hutchison
Luke Hutchison

Reputation: 9210

It's possible your Java compiler is configured not to preserve variable information. Right-click on the project in Project Explorer, then select Properties > Java Compiler > Add variable attributes to generated class files (used by the debugger). Without this option set, you will only see fields in the Variables view, not local variables.

Upvotes: 1

K.Andy Wang
K.Andy Wang

Reputation: 421

In my case,I think the potential cause is Variables View did't initial properly. Variables View init blank Alternative is enter another breakpoint before right code need to change variables.After entering the second breakpoint(above menthioned) added,eclipse will refresh the view and all things should be normal again.

Upvotes: 0

cool_display_name
cool_display_name

Reputation: 11

Did not find a solution after trying the above answers - Maybe this is very specific to my case - Solution was to ensure that the option "Skip All Breakpoints" is not enabled in Eclipse Run - > Skip All Breakpoints (ctl-alt-B) (toggle)

Upvotes: 1

Jonnathan moreno
Jonnathan moreno

Reputation: 11

If you are looking for a "live view of the object your are working with " when you hover over and all you see is the name make sure you place a break point on the method you are testing on. Otherwise when you hover over you will only get the method name.

Anyways I hope this helps someone. I tried all the above steps which are great! but I still could not view the object I was working with live. It may just be rookie mistake.

Best of luck!

Upvotes: -1

Vic Seedoubleyew
Vic Seedoubleyew

Reputation: 10526

Also: your process needs to be suspended for Eclipse to show variables. If it is running, Eclipse won't show any variable.

To suspend a thread, select a thread in the "debug" view, and hit "Suspend"

Upvotes: 1

Dom
Dom

Reputation: 1457

Resetting the view and re opening Eclipse did not help me, but this worked for me:

click on the arrow down button in the Variables window -> Layout -> Select Columns -> Check whichever columns you want.

Even though I already had both 'name' and 'value' checked, i unselected and selected them again, clicked 'OK' and the column appeared.

Upvotes: 0

Shadi Serhan
Shadi Serhan

Reputation: 319

My prbolem was that i used OpenMP, i disabled OpenMP then local variables appeared.

Upvotes: 0

Occasional
Occasional

Reputation: 11

I too have this problem: EclipseNeon + Tomcat8 doesn't show all the variables when in debug mode. I've tried above suggestions without success. Then I have debugged the same web project with NetBeans8 + GlassFish4 and all the variables are listed with values. Then I have debugged the same web project with NetBeans8 + Tomcat8 and not all the variables are listed. Then I've installed GlassFish4 for EclipseNeon and, debugging the same web project, all the variables are listed with values. So, the problem is in Tomcat8. A note: run Eclipse as administrator to install GlassFish4; with NetBeans is easier to install other servers.

Upvotes: 0

GBV
GBV

Reputation: 1

For me the solution of the problem was to configure xdebug properly. I added in the php.ini this lines of code :

zend_extension = "C:\xampp\php\ext\php_xdebug.dll"

xdebug.remote_enable = 1

xdebug.show_local_vars = 1

The important part I was missing : xdebug.remote_enable = 1

Upvotes: -1

Lova Chittumuri
Lova Chittumuri

Reputation: 3303

Windows -- > showView --> variable

or you can reset the perspective

windows -- > preferences -- > perspective --> restore Defaults

Upvotes: 6

Francesco
Francesco

Reputation: 522

If you are able to jump on breakpoints, it is ok to Reset Perspective.

On Eclipse Version: Luna Service Release 2 (4.4.2) Build id: 20150219-0600 I notived that not only the Variable View was empty, but also the buttons to navigate the execution (F5, F6, F8 functionality buttons) were disabled. In this case, go to Debug View, right click to the row with the yellow pause symbol, and choose an option like "Resume". On the next breakpoint, Variable View will be automagically fullfilled and execution navigation buttons will be enabled. Can't explain why

Upvotes: 1

Reda
Reda

Reputation: 1335

In my case, the variable didn't show up because in the settings of the debuger (in my case xdebug) I changed Max children / max data / max array depth to big values ... I reset the config and it worked

Upvotes: 1

well actually
well actually

Reputation: 12370

I ended up trying something easy by resetting the Debug perspective, which seemed to work:

Window => Perspective => Reset Perspective...

Thanks for the comments.

Upvotes: 154

lfvv
lfvv

Reputation: 1629

My problem was that I couldn't see variables names, but just the value. After trying quite a while I got the solution: Click on the down arrow (in degub Variables tab) --> Layout --> show columns

It did the trick!

Upvotes: 20

user4411382
user4411382

Reputation:

What worked for me is the following: I had a blank Variables view for the top stack frame. I selected a lower stack frame, then reselected the top one, and the Variables view refreshed itself somehow. Note: I'm using Eclipse Mars, so this bug appears to have returned in this version (or perhaps it's a different one, with the same symptoms?).

Upvotes: 2

anatp2015
anatp2015

Reputation: 170

None of the solutions worked for me. What solved my problem was under the drop down arrow in the Variable window. On the Layout option, I had to choose "Variables View Only" and then I could see the variable's values again.

This problem also suddenly appear out of nowhere. One moment Debug was working and the next it wasn't.

Upvotes: 0

Michal Krasny
Michal Krasny

Reputation: 5916

I restarted Eclipse and it worked again.

Upvotes: 6

capacitor24
capacitor24

Reputation: 1

I used Fender's style above, but selected to "Watch" a variable. Once in the Expressions tab, I just moved over to the Variables tab and Voila - variables back in business.

Upvotes: 0

user2603432
user2603432

Reputation:

I found I needed to remove static declarations if I wanted to see the variables, but this works better...

Modify/view static variables while debugging in Eclipse

Upvotes: 3

I had the same issue and after I installed MinGW I could see the variables.

Upvotes: 0

Joshua Richardson
Joshua Richardson

Reputation: 2029

I was running into this problem because eclipse thinks that the code that is executing is commented out. There is an #ifndef wrapper, and the condition evaluates to false in part of the project. Unfortunately, CDT wasn't quite smart enough (Helios or Keppler) to realize that it's not always false, and when stepping through that portion of the code, the variables window doesn't work. I can still inspect individual variable values.

Upvotes: 0

jaciefan
jaciefan

Reputation: 451

Window --> Show View --> Variables

Upvotes: 32

tonyeva
tonyeva

Reputation: 361

Resetting the perspective wasn't quite enough for me, I had to first delete the "Variables" tab and then reset the perspective (which reinstated the Variables tab in a working state). One other thing not mentioned above which might help others - when the variables tab is not working, the tab title is in italics (whatever that signifies). When it's working it goes back to normal font.

Upvotes: 15

Fender
Fender

Reputation: 3055

try a right click on the variable and select inspect, then it should come up in a popup window

Upvotes: 3

Related Questions