vm.allClasses() question - help!

I am new to this stuff! From a previous question, it was mentioned that the vm.allClasses() returns ReferenceTypes and NOT objects, what does this mean? Can I use the vm.allClasses to list only the types for each class loaded in the VM, or will it allow me to get a list of all object types? I am building a visual debugger and right now using the method above only displays loaded classes. How can I change it so that it captures multiple instances of those classes? For example, if there was a class Circle in the debugee program, and two Circles were instantiated, I want to be able to display both objects on my visual debugger rather than just establishing that a class Circle has been instantiated. Any help you can provided will be greatly appreciated!

[767 byte] By [foxman1a] at [2007-9-29 15:26:22]
# 1

Hello

Take a look at com.sun.jdi.Value:

http://java.sun.com/j2se/1.4.2/docs/guide/jpda/jdi/com/sun/jdi/Value.html

Using your example, there will only be one Circle ReferenceType returned by

vm.allClasses(), because that describes the class.

There could be an arbitrary number of instances created, which are represented

as described in the table of the javadoc for Value.

You typically get to ObjectReferences (and subtypes such as ArrayReference,

StringReference, etc...) by starting with a Thread and StackFrame, or by

examining an instance or static field of an ObjectReference you already have

in hand.

debugging_teama at 2007-7-15 13:18:19 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 2
thank you very much, I'll look into it!
foxman1a at 2007-7-15 13:18:19 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 3

JPDI gives you the methods to get at the info but I don't believe there is an all pupose way

to get at all Objects of a given type. This is a large proposition since if you think about it it

would involve inspecting every object and every field in every object and every field in every

field in every object yadda yadda yadda.......

'ie' could be done but if left open ended gets very large very quick.

This is usually best approached on an object by object basis. For a visual debugger

it's best to give an easy way to navigate about exploding objects and displaying it's internals

on demand but that's just a thought.

killroyboya at 2007-7-15 13:18:19 > top of Java-index,Archived Forums,Debugging Tools and Techniques...