mirror representing the
composite state of the target VM.
All other mirrors are associated with an instance of this
interface. Access to all other mirrors is achieved
directly or indirectly through an instance of this
interface.
Access to global VM properties and control of VM execution
are supported directly by this interface.
Instances of this interface are created by instances of
Connector. For example,
an AttachingConnector
attaches to a target VM and returns its virtual machine mirror.
A Connector will typically create a VirtualMachine by invoking
the VirtualMachineManager's VirtualMachineManager#createVirtualMachine(Connection)
createVirtualMachine(Connection) method.
Note that a target VM launched by a launching connector is not
guaranteed to be stable until after the VMStartEvent has been
received.
Any method on VirtualMachine which
takes VirtualMachine as an parameter may throw
VMDisconnectedException if the target VM is
disconnected and the VMDisconnectEvent has been or is
available to be read from the EventQueue.
Any method on VirtualMachine which
takes VirtualMachine as an parameter may throw
VMOutOfMemoryException if the target VM has run out of memory.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | TRACE_ALL
All tracing is enabled. |
| public static final int | TRACE_EVENTS
Tracing enabled for internal event handling. |
| public static final int | TRACE_NONE
All tracing is disabled. |
| public static final int | TRACE_OBJREFS
Tracing enabled for internal management of object references. |
| public static final int | TRACE_RECEIVES
Tracing enabled for JDWP packets received from target VM. |
| public static final int | TRACE_REFTYPES
Tracing enabled for internal management of reference types. |
| public static final int | TRACE_SENDS
Tracing enabled for JDWP packets sent to target VM. |
| Modifier and Type | Method and Description |
|---|---|
| public List | Returns: a list ofReferenceType objects, each mirroring
a loaded type in the target VM.Returns all loaded types in the target VM. |
| public default List | Returns: a list ofModuleReference objects, each mirroring
a module in the target VM.Returns all modules. |
| public List | Returns: a list ofThreadReference objects for the threads in the target VMReturns a list of the live threads in the target VM. |
| public boolean | Returns: true if the feature is supported,
false otherwise.
Deprecated
since 15. A JVM TI based JDWP back-end will never set this capability to true.
Determines if the target VM supports the addition of methods when performing class redefinition. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM is a read-only VM. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports the forcing of a method to return early. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports the retrieval of a method's bytecodes. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports reading class file major and minor versions. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports getting constant pool information of a class. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports the retrieval of the monitor for which a thread is currently waiting. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports the accessing of class instances, instance counts, and referring objects. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports the inclusion of return values
in
|
| public default boolean | Returns: true if the feature is supported, false otherwiseDetermines if the target VM supports getting information about modules. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports getting which frame has acquired a monitor. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports the retrieval of the monitor information for an object. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports the retrieval of the monitors owned by a thread. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports getting the source debug extension. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports the query of the synthetic attribute of a method or field. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports popping frames of a threads stack. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports any level of class redefinition. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports the creation of
|
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports the creation of
|
| public boolean | Returns: true if the feature is supported,
false otherwise.
Deprecated
since 15. A JVM TI based JDWP back-end will never set this capability to true.
Determines if the target VM supports
changes when performing class redefinition that are
otherwise restricted by |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports filtering events by specific instance object. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports the filtering of class prepare events by source name. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports watchpoints for field access. |
| public boolean | Returns: true if the feature is supported,
false otherwise.Determines if the target VM supports watchpoints for field modification. |
| public List | Returns: a list ofReferenceType objects, each
mirroring a type in the target VM with the given name.the class/interface name to search for className)Returns the loaded reference types that match a given name. |
| public String | Returns: the description.Returns text information on the target VM and the debugger support that mirrors it. |
| public void | |
| public EventQueue | Returns: theEventQueue for this virtual machine.Returns the event queue for this virtual machine. |
| public EventRequestManager | Returns: theEventRequestManager for this virtual machine.Returns the event request manager for this virtual machine. |
| public void | exit(int
the exit code for the target VM. On some platforms,
the exit code might be truncated, for example, to the lower order 8 bits. exitCode)Causes the mirrored VM to terminate with the given error code. |
| public String | Returns: null (meaning that the per-class
default - ReferenceType#defaultStratum() -
should be used) unless the default stratum has been
set with
setDefaultStratum(String).Return this VM's default stratum. |
| public long[] | Returns: an array oflong containing one element for each
element in the 'refTypes' list. Element i of the array contains
the number of instances in the target VM of the ReferenceType at
position i in the 'refTypes' list.
If the 'refTypes' list is empty, a zero-length array is returned.
If a ReferenceType in refTypes has been garbage collected, zero
is returned for its instance count.the list of refTypes)ReferenceType objects for which counts
are to be obtained.Returns the number of instances of each ReferenceType in the 'refTypes' list. |
| public BooleanValue | Returns: theBooleanValue for the given boolean.a boolean for which to create the value value)Creates a |
| public ByteValue | |
| public CharValue | |
| public ShortValue | Returns: theShortValue for the given short.a short for which to create the value value)Creates a |
| public IntegerValue | Returns: theIntegerValue for the given int.an int for which to create the value value)Creates an |
| public LongValue | |
| public FloatValue | Returns: theFloatValue for the given float.a float for which to create the value value)Creates a |
| public DoubleValue | Returns: theDoubleValue for the given double.a double for which to create the value value)Creates a |
| public StringReference | Returns: aStringReference that mirrors the newly created
string in the target VM.the string to be created value)Creates a string in this virtual machine. |
| public VoidValue | |
| public String | Returns: the target VM name.Returns the name of the target VM as reported by the
property |
| public Process | Returns: thejava. object for this virtual
machine, or null if it was not launched by a LaunchingConnector.Returns the |
| public void | redefineClasses(Map<? extends ReferenceType, byte[]>
A map from classToBytes)ReferenceType
to array of byte.
The bytes represent the new class definition and
are in Java Virtual Machine class file format.All classes given are redefined according to the definitions supplied. |
| public void | |
| public void | setDebugTraceMode(int
identifies which kinds of tracing to enable. traceFlags)Traces the activities performed by the com.sun.jdi implementation. |
| public void | setDefaultStratum(String
the stratum to set as VM default,
or null to use per-class defaults. stratum)Set this VM's default stratum (see |
| public void | |
| public List | Returns: a list ofThreadGroupReference objects, one for each
top level thread group.Returns each thread group which does not have a parent. |
| public String | Returns: the target VM version.Returns the version of the Java Runtime Environment in the target
VM as reported by the property |
| TRACE_ALL | back to summary |
|---|---|
| public static final int TRACE_ALL All tracing is enabled. | |
| TRACE_EVENTS | back to summary |
|---|---|
| public static final int TRACE_EVENTS Tracing enabled for internal event handling. | |
| TRACE_NONE | back to summary |
|---|---|
| public static final int TRACE_NONE All tracing is disabled. | |
| TRACE_OBJREFS | back to summary |
|---|---|
| public static final int TRACE_OBJREFS Tracing enabled for internal management of object references. | |
| TRACE_RECEIVES | back to summary |
|---|---|
| public static final int TRACE_RECEIVES Tracing enabled for JDWP packets received from target VM. | |
| TRACE_REFTYPES | back to summary |
|---|---|
| public static final int TRACE_REFTYPES Tracing enabled for internal management of reference types. | |
| TRACE_SENDS | back to summary |
|---|---|
| public static final int TRACE_SENDS Tracing enabled for JDWP packets sent to target VM. | |
| allClasses | back to summary |
|---|---|
| public List Returns all loaded types in the target VM.
The returned list includes all reference types, including
| |
| allModules | back to summary |
|---|---|
| public default List Returns all modules. For each module in the target
VM a
Not all target virtual machines support this operation.
Use Implementation Specification The default implementation throws
| |
| allThreads | back to summary |
|---|---|
| public List Returns a list of the live threads in the target VM. Threads that have not yet started or threads that have terminated are not included in the list. The returned list contains a It is implementation dependent if the list contains elements for live
virtual threads
in the target VM. The target VM may not return any references to virtual threads,
or it may be configured to return a reference to some or all virtual threads.
Tools that want to track all virtual threads may enable
| |
| canAddMethod | back to summary |
|---|---|
| public boolean canAddMethod()
Deprecated since 15. A JVM TI based JDWP back-end will never set this capability to true. Determines if the target VM supports the addition of methods when performing class redefinition.
| |
| canBeModified | back to summary |
|---|---|
| public boolean canBeModified() Determines if the target VM is a read-only VM. If a method which
would modify the state of the VM is called on a read-only VM,
then
| |
| canForceEarlyReturn | back to summary |
|---|---|
| public boolean canForceEarlyReturn() Determines if the target VM supports the forcing of a method to return early.
| |
| canGetBytecodes | back to summary |
|---|---|
| public boolean canGetBytecodes() Determines if the target VM supports the retrieval of a method's bytecodes.
| |
| canGetClassFileVersion | back to summary |
|---|---|
| public boolean canGetClassFileVersion() Determines if the target VM supports reading class file major and minor versions.
| |
| canGetConstantPool | back to summary |
|---|---|
| public boolean canGetConstantPool() Determines if the target VM supports getting constant pool information of a class.
| |
| canGetCurrentContendedMonitor | back to summary |
|---|---|
| public boolean canGetCurrentContendedMonitor() Determines if the target VM supports the retrieval of the monitor for which a thread is currently waiting.
| |
| canGetInstanceInfo | back to summary |
|---|---|
| public boolean canGetInstanceInfo() Determines if the target VM supports the accessing of class instances, instance counts, and referring objects.
| |
| canGetMethodReturnValues | back to summary |
|---|---|
| public boolean canGetMethodReturnValues() Determines if the target VM supports the inclusion of return values
in
| |
| canGetModuleInfo | back to summary |
|---|---|
| public default boolean canGetModuleInfo() Determines if the target VM supports getting information about modules. Implementation Specification The default implementation returns
| |
| canGetMonitorFrameInfo | back to summary |
|---|---|
| public boolean canGetMonitorFrameInfo() Determines if the target VM supports getting which frame has acquired a monitor.
| |
| canGetMonitorInfo | back to summary |
|---|---|
| public boolean canGetMonitorInfo() Determines if the target VM supports the retrieval of the monitor information for an object.
| |
| canGetOwnedMonitorInfo | back to summary |
|---|---|
| public boolean canGetOwnedMonitorInfo() Determines if the target VM supports the retrieval of the monitors owned by a thread.
| |
| canGetSourceDebugExtension | back to summary |
|---|---|
| public boolean canGetSourceDebugExtension() Determines if the target VM supports getting the source debug extension.
| |
| canGetSyntheticAttribute | back to summary |
|---|---|
| public boolean canGetSyntheticAttribute() Determines if the target VM supports the query of the synthetic attribute of a method or field.
| |
| canPopFrames | back to summary |
|---|---|
| public boolean canPopFrames() Determines if the target VM supports popping frames of a threads stack.
| |
| canRedefineClasses | back to summary |
|---|---|
| public boolean canRedefineClasses() Determines if the target VM supports any level of class redefinition.
| |
| canRequestMonitorEvents | back to summary |
|---|---|
| public boolean canRequestMonitorEvents() Determines if the target VM supports the creation of
| |
| canRequestVMDeathEvent | back to summary |
|---|---|
| public boolean canRequestVMDeathEvent() Determines if the target VM supports the creation of
| |
| canUnrestrictedlyRedefineClasses | back to summary |
|---|---|
| public boolean canUnrestrictedlyRedefineClasses()
Deprecated since 15. A JVM TI based JDWP back-end will never set this capability to true. Determines if the target VM supports
changes when performing class redefinition that are
otherwise restricted by
| |
| canUseInstanceFilters | back to summary |
|---|---|
| public boolean canUseInstanceFilters() Determines if the target VM supports filtering
events by specific instance object. For example,
see
| |
| canUseSourceNameFilters | back to summary |
|---|---|
| public boolean canUseSourceNameFilters() Determines if the target VM supports the filtering of class prepare events by source name.
| |
| canWatchFieldAccess | back to summary |
|---|---|
| public boolean canWatchFieldAccess() Determines if the target VM supports watchpoints for field access.
| |
| canWatchFieldModification | back to summary |
|---|---|
| public boolean canWatchFieldModification() Determines if the target VM supports watchpoints for field modification.
| |
| classesByName | back to summary |
|---|---|
| public List Returns the loaded reference types that
match a given name. The name must be fully qualified
(for example, java.lang.String). The returned list
will contain a The returned list will include reference types loaded at least to the point of preparation and types (like array) for which preparation is not defined.
| |
| description | back to summary |
|---|---|
| public String description() Returns text information on the target VM and the
debugger support that mirrors it. No specific format
for this information is guaranteed.
Typically, this string contains version information for the
target VM and debugger interfaces.
More precise information
on VM and JDI versions is available through
| |
| dispose | back to summary |
|---|---|
| public void dispose() Invalidates this virtual machine mirror. The communication channel to the target VM is closed, and the target VM prepares to accept another subsequent connection from this debugger or another debugger, including the following tasks:
Resources originating in this VirtualMachine (ObjectReferences, ReferenceTypes, etc.) will become invalid. | |
| eventQueue | back to summary |
|---|---|
| public EventQueue eventQueue() Returns the event queue for this virtual machine.
A virtual machine has only one
| |
| eventRequestManager | back to summary |
|---|---|
| public EventRequestManager eventRequestManager() Returns the event request manager for this virtual machine.
The
| |
| exit | back to summary |
|---|---|
| public void exit(int exitCode) Causes the mirrored VM to terminate with the given error code. All resources associated with this VirtualMachine are freed. If the mirrored VM is remote, the communication channel to it will be closed. Resources originating in this VirtualMachine (ObjectReferences, ReferenceTypes, etc.) will become invalid. Threads running in the mirrored VM are abruptly terminated. A thread death exception is not thrown and finally blocks are not run.
| |
| getDefaultStratum | back to summary |
|---|---|
| public String getDefaultStratum() Return this VM's default stratum.
| |
| instanceCounts | back to summary |
|---|---|
| public long[] instanceCounts(List<? extends ReferenceType> refTypes) Returns the number of instances of each ReferenceType in the 'refTypes' list. Only instances that are reachable for the purposes of garbage collection are counted.
Not all target virtual machines support this operation.
Use
| |
| mirrorOf | back to summary |
|---|---|
| public BooleanValue mirrorOf(boolean value) Creates a
| |
| mirrorOf | back to summary |
|---|---|
| public ByteValue mirrorOf(byte value) Creates a | |
| mirrorOf | back to summary |
|---|---|
| public CharValue mirrorOf(char value) Creates a | |
| mirrorOf | back to summary |
|---|---|
| public ShortValue mirrorOf(short value) Creates a
| |
| mirrorOf | back to summary |
|---|---|
| public IntegerValue mirrorOf(int value) Creates an
| |
| mirrorOf | back to summary |
|---|---|
| public LongValue mirrorOf(long value) Creates a | |
| mirrorOf | back to summary |
|---|---|
| public FloatValue mirrorOf(float value) Creates a
| |
| mirrorOf | back to summary |
|---|---|
| public DoubleValue mirrorOf(double value) Creates a
| |
| mirrorOf | back to summary |
|---|---|
| public StringReference mirrorOf(String value) Creates a string in this virtual machine. The created string can be used for setting and comparing against a string value retrieved from a variable or field in this virtual machine.
| |
| mirrorOfVoid | back to summary |
|---|---|
| public VoidValue mirrorOfVoid() Creates a | |
| name | back to summary |
|---|---|
| public String name() Returns the name of the target VM as reported by the
property
| |
| process | back to summary |
|---|---|
| public Process process() Returns the
| |
| redefineClasses | back to summary |
|---|---|
| public void redefineClasses(Map<? extends ReferenceType, byte[]> classToBytes) All classes given are redefined according to the definitions supplied. A method in a redefined class is called 'equivalent' (to the old version of the method) if
Method.
will return true when called on one of these methods.
If resetting such a frame is desired, use
ThreadReference.
to pop the old obsolete method execution from the stack.
New invocations of redefined methods will always invoke the new versions.
This function does not cause any initialization except that which would occur under the customary JVM semantics. In other words, redefining a class does not cause its initializers to be run. The values of preexisting static variables will remain as they were prior to the call. However, completely uninitialized (new) static variables will be assigned their default value. If a redefined class has instances then all those instances will have the fields defined by the redefined class at the completion of the call. Preexisting fields will retain their previous values. Any new fields will have their default values; no instance initializers or constructors are run. Threads need not be suspended. No events are generated by this function. All breakpoints in the redefined classes are deleted.
Not all target virtual machines support this operation.
Use
| |
| resume | back to summary |
|---|---|
| public void resume() Continues the execution of the application running in this
virtual machine. All threads are resumed as documented in
| |
| setDebugTraceMode | back to summary |
|---|---|
| public void setDebugTraceMode(int traceFlags) Traces the activities performed by the com.sun.jdi implementation. All trace information is output to System.err. The given trace flags are used to limit the output to only the information desired. The given flags are in effect and the corresponding trace will continue until the next call to this method. Output is implementation dependent and trace mode may be ignored.
| |
| setDefaultStratum | back to summary |
|---|---|
| public void setDefaultStratum(String stratum) Set this VM's default stratum (see
Affects location queries (such as,
| |
| suspend | back to summary |
|---|---|
| public void suspend() Suspends the execution of the application running in this virtual machine. All threads currently running will be suspended.
Suspends of both the virtual machine and individual threads are
counted. Before a thread will run again, it must be resumed
(through
| |
| topLevelThreadGroups | back to summary |
|---|---|
| public List Returns each thread group which does not have a parent. For each
top level thread group a This command may be used as the first step in building a tree (or trees) of the existing thread groups.
| |
| version | back to summary |
|---|---|
| public String version() Returns the version of the Java Runtime Environment in the target
VM as reported by the property
| |