views:

365

answers:

2

In an application, I have a class with a few member variables and methods. Calling the method with bad parameters produces a AssertionError. I've setup the debugger to halt on uncaught exceptions.

Problem is, when switching over to the debug perspective, I can only see the class instance (on which the function was called) and the two parameters. I cannot expand the class instance to see the values of its member variables. There is a space to the left of the instance so I would assume that there should be an arrow there so one is able to expand it in a similar way as in the Outline.

Is there a configuration or something I must enable for this? Or have I misunderstood the variables window?

If it matters, this is Eclipse 3.2.2 in Ubuntu Linux.


[Update] I downloaded a new release from http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/R/eclipse-java-galileo-linux-gtk.tar.gz

"About Eclipse" now reports "Build id: 20090619-0625".

Testcase:

class Foo {
    private int bar;

    Foo() {
     bar = 1;
    }

    public void set(int newbar) {
     assert (newbar<0);
     bar = newbar;
    }
}

class Test {

     public static void main (String[] args){
         Foo f = new Foo();
         f.set(5);
     }
}

Obviously, this code produces the assertion exception. But the only change is the icon for "this" which changed from a green circle to a blue triangle in the new version. Still cant find a way to expand it. Here, I can see "this" for the Foo instance, as well as "newbar" and its value, to clarify, what I want to do is expand "this" and see its current value for "bar".

+1  A: 

No, you haven't. Normally the first line in the debug view should be an entry "this", which represents the instance you are currently running in. It should have a "+", which you click to expand the list of instance variables.

If this doesn't work, maybe you are in the wrong stack frame (you can select it in the stack trace listing), or Eclipse cannot resolve your source code location, or something else is wrong.

Try creating a small testcase where this is reproducible, and posting that. Then we'll see...

BTW: Eclise 3.2.2 is rather old. Consider upgrading to 3.5 to see if the problem persists. You can install several Eclipse versions side by side (just unzip to a directory), so no need to clobber your existing installation.

sleske
I see "this", but there is no "+" next to it allowing it to be expanded. I installed eclipse through ubuntus package repository, Ill start by updating to the latest version and test again there.
mizipzor
It is a bad idea to install from the Ubuntu repository. Seriously outdated. Get the latest package from the Eclipse.org site. No need to "install" just unzip and run. http://www.eclipse.org/downloads/
zvikico
Eclipse updated and testcase added.
mizipzor
+2  A: 

After some discussion in #eclipse, we found that the VM was the problem. I was running:

/usr/lib/jvm/java-1.5.0-gcj-4.3-1.5.0.0/bin/java

Changing it to:

/usr/lib/jvm/java-6-openjdk/bin/java

and suppling a -ea flag as argument to the VM let me expand the class instance inspecting the value of bar. Problem solved.

mizipzor
Ah, yes, Ubuntu will by default use the GNU JVM, which is not (yet) quite as complete as the Sun JVM. Still, surprising that Eclipse runs at all with it.
sleske