ChatGPT解决这个技术问题 Extra ChatGPT

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?

Just close that Variable window. And open it again.
It happened to me and I just restarted Eclipse and it worked again.

u
uvsmtid

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

Window => Perspective => Reset Perspective...

Thanks for the comments.


I keep running into this same issue, and resetting the perspective has been working for me. thanks for posting this.
Actually, either this or the additional step from @tonyeva did it, but it didn't work immediately (ie., in the current stack), so thought the problem didn't go away. However, when the debugger stopped at a different place, the variables started showing up.
Sometimes you need to click the thread again to get the Variables pane to update. In the Debug pane, find the thread with (Suspended) beside it, expand it, and click the top stack frame.
Thank you! It helped to resolve my problem with vars values! I use Eclipse NEON
Worked on Neon , great answer !
j
jaciefan

Window --> Show View --> Variables


Window --> Show View --> Debug --> Variables
l
lfvv

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!


thakns, it helped me too with eclipse Mars. Down arrow is at upper right corner of Variables Tab bar.
This also helped me in Eclipse Mars, even though restarting and removing the view didn't helped at all.
t
tonyeva

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.


M
Michal Krasny

I restarted Eclipse and it worked again.


Me too. Closing and reopening the "Variables" window did not work, but exiting Eclipse and restarting did.
I had to close the project, restart eclipse, re-open the project, and then the Variables window began to work again. Super strange.
M
Moumit

Windows -- > showView --> variable

or you can reset the perspective

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


F
Fender

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


this works for me (in Neon) and is easier and less disruptive than resetting the perspective
I work with this only. "ctr + shift + I" is the shortcut or mouse over to the variable and its value shows up. Unfortunately, this is not working for me.
C
Community

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


This was the simplest answer: hit the drop down arrow on the far right of the "variables, breakpoints, Expressions window -> Java -> Show static variables.
佚名

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?).


L
LearnerForLife

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

This should bring back your variables window in eclipse


R
Reda

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


F
Francesco

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


V
Vic Seedoubleyew

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"


c
cool_display_name

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)


L
Luke Hutchison

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.


J
Joshua Richardson

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.


W
Wuschelbeutel Kartoffelhuhn

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


c
capacitor24

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.


This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post.
The original question was: Any reason why this might be happening? The other answers, including the accepted answer, do not provide an answer to the question either, but do explain how to fix the issue. My answer does the same: here is what works on my system. But I'm sure you're just trying to help me along. Thanks!
Thanks for the ban, Lai. You're one classy act.
a
anatp2015

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.


O
Occasional

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.


S
Shadi Serhan

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


D
Dom

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.


K
K.Andy Wang

https://i.stack.imgur.com/aI93A.png


r
romsky

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.


F
FindingMyWay

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


R
Rohit Gaikwad

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 :

Delete eclipse project from disk. 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. Import that eclipse project again. Also, Verify whether correct JDK is being selected at Preferences -> Installed JREs


t
theRiley

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

Window -> Perspective -> Close Perspective

then

Window -> Perspective -> Open Perspective -> Debug


M
Ming D.

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.


G
GBV

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


That has nothing to deal with Eclipse and java. Are you sure you are answering the question you wished to answer?
J
Jonnathan moreno

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!