Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 126108 - "xxx cannot be resolved" in Debugger
Summary: "xxx cannot be resolved" in Debugger
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 435010 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-02-01 17:42 EST by Kenneth Evans, Jr. CLA
Modified: 2014-05-23 10:12 EDT (History)
1 user (show)

See Also:


Attachments
Screendump of being unable to obtain the value of a variable (67.93 KB, image/gif)
2006-02-01 17:50 EST, Kenneth Evans, Jr. CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Evans, Jr. CLA 2006-02-01 17:42:33 EST
I have a continual problem determining the values of variables when
stopped in the debugger.  There are a number of ways to do this
(hovering over the variable, using Display, using Inspect, etc.).

Often none of these works.  Instead of getting the value, you get
something like "String name -
java.lang.ClassLoader.loadClass(String)," in this case for a String
argument called name in java.lang.ClassLoader.loadClass(String).  In
the Expression view the variable name would have "name cannot be
resolved" instead of a value.  Other places in the same file, you get
the value as desired.

The above is an explicit instance where the value cannot be obtained.
However, this is not a one-time thing.  It happens often.  It has been
a perpetual problem for me with the Eclipse debugger.  I use a number
of debuggers, and in all of them you expect to be able to get the
value of a variable, as long the program is active.  (Otherwise, it is
very difficult to debug what is happening.)

I have been unable to determine what the conditions are for its not
working.  If you are not expected to be able to see a variable's value
under certain conditions, then it should say that in the
documentation.  It would seem that if there is enough information to
display the lines of code and the location of the break, then it
should also know the values of the local variables.

I will try to attach a GIF of a typical situation, a picture being
worth a thousand words...
Comment 1 Kenneth Evans, Jr. CLA 2006-02-01 17:50:03 EST
Created attachment 33973 [details]
Screendump of being unable to obtain the value of a variable

This is a situation with the debugger stopped at a breakpoint, but where hovering over the variable, name, gives its type, not its value.  Display gives a similar result, and Inspect says "name cannot be resolved".  Also note the Expressions view.  (name is in scope, classpathEntries is not.)  This instance is a method that is called often.  It is important to know the value of the argument, name.
Comment 2 Darin Wright CLA 2006-02-02 09:00:36 EST
The issue here is that ClassLoader is from the system libraries and is not compiled with variable name debug attribtues. We cannot resolve a value for "name" because the class file does not provide us with the information we require (the classes in rt.jar/system libs only provide line number and source file name debug attributes). 
Comment 3 Kenneth Evans, Jr. CLA 2006-02-02 11:10:08 EST
Sorry, I am more used to working in C than Java.  If what you say is
true, then what I do not understand is why I can get values for some
of the variables in the class and not others.  In addition, I first
asked this question in the newsgroups and to other Java programmers I
know.  I think it is safe to say that what you say is not common
knowledge.  However, I can research it.  I am learning Java, not an
expert.

I assume there a reason the Eclipse code (some of it anyway) is
compiled without variable name debug attribtues.

Further, if what you say is the case, it would be nice to mention in
the documentation that those features (inspect, etc.) won't work under
those conditions.  It would have saved me (and you) a lot of time.

Than you for your information.
Comment 4 Darin Wright CLA 2006-02-02 11:15:43 EST
>I assume there a reason the Eclipse code (some of it anyway) is
>compiled without variable name debug attribtues.

These classes are not compiled by Eclipse - these are system libraries provided by the JRE you are using (likey Sun's JDK). The system libaries are pre-compiled by the JRE/JDK vendor.
Comment 5 Kenneth Evans, Jr. CLA 2006-02-02 15:12:54 EST
Yes, the example I sent is in JDK, not Eclipse, code.  I believe I
have had the same problem with Eclipse code, but I need to verify
that, now that I understand what is happening.  In any event I see
that it is not a bug in the Debugger, but rather an issue regarding
retaining variable information in the distributed classes.

I repeat that information about Javac debug command-line switches and
the consequences is not widely known.  It is not mentioned in the Java
Tutorial, for example.  I had difficulty in getting relevant Google
hits, as well.  What may be obvious to you as a person strongly
involved with debuggers, is not necessarily so obvious for everyone
else, especially considering "every one else" includes a wide range of
levels of expertise.

Even though this is not a debugger issue, I will repeat that it
wouldn't hurt to put information about when Inspect, etc. will (and
will not) work in the documentation.

Thank you for your time and responses, and I apologize for submitting
a bug report that is not a bug.
Comment 6 Missing name Mising name CLA 2006-08-04 19:53:07 EDT
I had a similar issue with classes that were written and compiled in Eclipse (Callisto).  In this particular case the class was instantiated via reflection (possibly with a Tomcat ClassLoader).  In the constructor and methods called by it variables wouldn't evaluate on hover, inspect etc. and the parameters were shown in the Variables view as arg0, arg1 etc. instead of their code-level names.  Could the parameter names not be taken from the source code, and the evaluations linked back to the table of variables?
Comment 7 Darin Wright CLA 2006-08-08 10:05:00 EDT
The variables view displays arg0, arg1, etc., when variable names are not available as debug attributes... so we can't link them back to the source.
Comment 8 Michael Rennie CLA 2014-05-23 10:12:27 EDT
*** Bug 435010 has been marked as a duplicate of this bug. ***