Sometimes when I am debugging code in Eclipse it happens that although I can see and inspect class member variables without any difficulty I am unable to inspect the values of variables declared locally within functions. As an aside, any parameters to the current function lose their 'real' names and instead one sees their values listed in the Variables window as arg0, arg1, arg2, etc but at least the values are visible.
This is occurring at present in relation to classes defined within the core JDK. I have verified that the installed and current JRE is a JDK.
Is anybody able to shed some light on this behaviour?
Declaring Local VariablesYou can declare them at the start of the program, within the main method, inside classes, and inside methods or functions. Depending on where they are defined, other parts of your code may or may not be able to access them. A local variable is one that is declared within a method.
Local Variables We declared num in the method body of main(). Variables declared inside a method are called local variables. Local variables can only be used within the method body.
Apparently, the answer is:
the rt.jar that ships with the JDK (where the core Java classes live) is not compiled with full debug information included in the .class files, so the debugger does not have local variable info.
Unfortunately, this is not something that Eclipse can do anything about - all debuggers will have the same problem with JDK core classes.
The release notes of Eclipse 3.4 states:
Missing debug attributes
The debugger requires that class files be compiled with debug attributes if it is to be able to display line numbers and local variables. Quite often, class libraries (for example, "rt.jar") are compiled without complete debug attributes, and thus local variables and method arguments for those classes are not visible in the debugger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With