Currently, Java Debugger Interface (JDI) does not have a way to get java objects from heap.
While one can local variables and follow links from local objects, sometimes we want to get all heap objects of a specific type.
In particular, read-only JDI subset aimed at coredumps could have heap access API.
While debugging java core dumps, we may want to get java objects of a specific type or objects of all types. There can be a capability API that tells whether a given JDI implementation supports heap access or not.
The API proposed are as below:
Heap Walking API introduces facility to walk java walk from core files/process snapshots.
The heap walking API addes only 4 methods to VirtualMachine class
1) canWalkHeap
boolean canWalkHeap();
capability check method. returns true if a jdi implementation can walk heap. else returns false.
2) allObjects
List/*<ObjectReference>*/ allObjects();
Returns list of all heap objects.
3) objectsByType
List/*<ObjectReference>*/ objectsByType(ReferenceType type, boolean includeSubtypes)
Returns list of all objects of given type. If 'includeSubtypes' is true all objects of subtype of given type are included in result. If 'includeSubtypes' is false, only the objects of type exactly equal to given type are included in the result
4) objectsByType
List/*<ObjectReference>*/ objectsByType(ReferenceType type);
Returns list of all objects of given type or subtype of given type. This is equivalent to objectsByType(type, true);
###@###.### 2003-10-03
While one can local variables and follow links from local objects, sometimes we want to get all heap objects of a specific type.
In particular, read-only JDI subset aimed at coredumps could have heap access API.
While debugging java core dumps, we may want to get java objects of a specific type or objects of all types. There can be a capability API that tells whether a given JDI implementation supports heap access or not.
The API proposed are as below:
Heap Walking API introduces facility to walk java walk from core files/process snapshots.
The heap walking API addes only 4 methods to VirtualMachine class
1) canWalkHeap
boolean canWalkHeap();
capability check method. returns true if a jdi implementation can walk heap. else returns false.
2) allObjects
List/*<ObjectReference>*/ allObjects();
Returns list of all heap objects.
3) objectsByType
List/*<ObjectReference>*/ objectsByType(ReferenceType type, boolean includeSubtypes)
Returns list of all objects of given type. If 'includeSubtypes' is true all objects of subtype of given type are included in result. If 'includeSubtypes' is false, only the objects of type exactly equal to given type are included in the result
4) objectsByType
List/*<ObjectReference>*/ objectsByType(ReferenceType type);
Returns list of all objects of given type or subtype of given type. This is equivalent to objectsByType(type, true);
###@###.### 2003-10-03
- duplicates
-
JDK-5024119 Add ReferenceType.getAllInstances () method to JDI.
- Resolved
- relates to
-
JDK-4593163 Tool to generate core files from JVM and analyze them
- Resolved