|
Java Debug Interface | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A virtual machine targeted for debugging.
More precisely, a 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
.
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.
Field Summary | |
static int |
TRACE_ALL
All tracing is enabled. |
static int |
TRACE_EVENTS
Tracing enabled for internal event handling. |
static int |
TRACE_NONE
All tracing is disabled. |
static int |
TRACE_OBJREFS
Tracing enabled for internal management of object references. |
static int |
TRACE_RECEIVES
Tracing enabled for JDWP packets received from target VM. |
static int |
TRACE_REFTYPES
Tracing enabled for internal managment of reference types. |
static int |
TRACE_SENDS
Tracing enabled for JDWP packets sent to target VM. |
Method Summary | |
List |
allClasses()
Returns all loaded types. |
List |
allThreads()
Returns a list of the currently running threads. |
boolean |
canAddMethod()
Determines if the target VM supports the addition of methods when performing class redefinition. |
boolean |
canGetBytecodes()
Determines if the target VM supports the retrieval of a method's bytecodes. |
boolean |
canGetCurrentContendedMonitor()
Determines if the target VM supports the retrieval of the monitor for which a thread is currently waiting. |
boolean |
canGetMonitorInfo()
Determines if the target VM supports the retrieval of the monitor information for an object. |
boolean |
canGetOwnedMonitorInfo()
Determines if the target VM supports the retrieval of the monitors owned by a thread. |
boolean |
canGetSourceDebugExtension()
Determines if the target VM supports getting the source debug extension. |
boolean |
canGetSyntheticAttribute()
Determines if the target VM supports the query of the synthetic attribute of a method or field. |
boolean |
canPopFrames()
Determines if the target VM supports popping frames of a threads stack. |
boolean |
canRedefineClasses()
Determines if the target VM supports any level of class redefinition. |
boolean |
canRequestVMDeathEvent()
Determines if the target VM supports the creation of VMDeathRequest s. |
boolean |
canUnrestrictedlyRedefineClasses()
Determines if the target VM supports unrestricted changes when performing class redefinition. |
boolean |
canUseInstanceFilters()
Determines if the target VM supports filtering events by specific instance object. |
boolean |
canWatchFieldAccess()
Determines if the target VM supports watchpoints for field access. |
boolean |
canWatchFieldModification()
Determines if the target VM supports watchpoints for field modification. |
List |
classesByName(String className)
Returns the loaded reference types that match a given name. |
String |
description()
Returns text information on the target VM and the debugger support that mirrors it. |
void |
dispose()
Invalidates this virtual machine mirror. |
EventQueue |
eventQueue()
Returns the event queue for this virtual machine. |
EventRequestManager |
eventRequestManager()
Returns the event request manager for this virtual machine. |
void |
exit(int exitCode)
Causes the mirrored VM to terminate with the given error code. |
String |
getDefaultStratum()
Return this VM's default stratum. |
BooleanValue |
mirrorOf(boolean value)
Creates a BooleanValue for the given value. |
ByteValue |
mirrorOf(byte value)
Creates a ByteValue for the given value. |
CharValue |
mirrorOf(char value)
Creates a CharValue for the given value. |
DoubleValue |
mirrorOf(double value)
Creates a DoubleValue for the given value. |
FloatValue |
mirrorOf(float value)
Creates a FloatValue for the given value. |
IntegerValue |
mirrorOf(int value)
Creates an IntegerValue for the given value. |
LongValue |
mirrorOf(long value)
Creates a LongValue for the given value. |
ShortValue |
mirrorOf(short value)
Creates a ShortValue for the given value. |
StringReference |
mirrorOf(String value)
Creates a string in this virtual machine. |
String |
name()
Returns the name of the target VM as reported by the property java.vm.name . |
Process |
process()
Returns the Process object for this
virtual machine if launched
by a LaunchingConnector |
void |
redefineClasses(Map classToBytes)
All classes given are redefined according to the definitions supplied. |
void |
resume()
Continues the execution of the application running in this virtual machine. |
void |
setDebugTraceMode(int traceFlags)
Traces the activities performed by the com.sun.jdi implementation. |
void |
setDefaultStratum(String stratum)
Set this VM's default stratum (see Location for a
discussion of strata). |
void |
suspend()
Suspends the execution of the application running in this virtual machine. |
List |
topLevelThreadGroups()
Returns each thread group which does not have a parent. |
String |
version()
Returns the version of the Java Runtime Environment in the target VM as reported by the property java.version . |
Methods inherited from interface com.sun.jdi.Mirror |
toString, virtualMachine |
Field Detail |
public static final int TRACE_NONE
public static final int TRACE_SENDS
public static final int TRACE_RECEIVES
public static final int TRACE_EVENTS
public static final int TRACE_REFTYPES
public static final int TRACE_OBJREFS
public static final int TRACE_ALL
Method Detail |
public List classesByName(String className)
ReferenceType
for each class
or interface found with the given name. The search
is confined to loaded classes only; no attempt is made
to load a class of the given name.
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.
className
- the class/interface name to search for
ReferenceType
objects, each
mirroring a type in the target VM with the given name.public List allClasses()
ReferenceType
will be placed in the returned list.
The list will include ReferenceTypes which mirror classes,
interfaces, and array types.
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.
ReferenceType
objects, each mirroring
a loaded type in the target VM.public void redefineClasses(Map classToBytes)
ThreadReference.popFrames(StackFrame)
with
Method.isObsolete()
.
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.
Not all target virtual machines support this operation.
Use canRedefineClasses()
to determine if the operation is supported.
Use canAddMethod()
to determine if the redefinition can add methods.
Use canUnrestrictedlyRedefineClasses()
to determine if the redefinition can change the schema,
delete methods, change the class hierarchy, etc.
classToBytes
- A map from ReferenceType
to array of byte.
The bytes represent the new class definition and
are in Java Virtual Machine class file format.
UnsupportedOperationException
- if
the target virtual machine does not support this
operation.
canRedefineClasses()
is false any call of this method will throw this exception.
canAddMethod()
is false
attempting to add a method will throw this exception.
canUnrestrictedlyRedefineClasses()
is false, attempting any of the following will throw
this exception
NoClassDefFoundError
- if the bytes
don't correspond to the reference type (the names
don't match).
VerifyError
- if a "verifier" detects
that a class, though well formed, contains an internal
inconsistency or security problem.
ClassFormatError
- if the bytes
do not represent a valid class.
ClassCircularityError
- if a
circularity has been detected while initializing a class.
UnsupportedClassVersionError
- if the
major and minor version numbers in bytes
are not supported by the VM.Method.isObsolete()
,
ThreadReference.popFrames(com.sun.jdi.StackFrame)
,
canRedefineClasses()
,
canAddMethod()
,
canUnrestrictedlyRedefineClasses()
public List allThreads()
ThreadReference
that mirrors it is placed in the list.
The returned list contains threads created through
java.lang.Thread, all native threads attached to
the target VM through JNI, and system threads created
by the target VM. Thread objects that have
not yet been started
(see Thread.start()
)
and thread objects that have
completed their execution are not included in the returned list.
ThreadReference
objects, one for each
running thread in the mirrored VM.public void suspend()
Unlike Thread.suspend()
,
suspends of both the virtual machine and individual threads are
counted. Before a thread will run again, it must be resumed
(through resume()
or ThreadReference.resume()
)
the same number of times it has been suspended.
public void resume()
ThreadReference.resume()
.
suspend()
public List topLevelThreadGroups()
ThreadGroupReference
is placed in the
returned list.
This command may be used as the first step in building a tree (or trees) of the existing thread groups.
ThreadGroupReference
objects, one for each
top level thread group.public EventQueue eventQueue()
EventQueue
object, this
method will return the same instance each time it
is invoked.
EventQueue
for this virtual machine.public EventRequestManager eventRequestManager()
EventRequestManager
controls user settable events
such as breakpoints.
A virtual machine has only one EventRequestManager
object,
this method will return the same instance each time it
is invoked.
EventRequestManager
for this virtual machine.public BooleanValue mirrorOf(boolean value)
BooleanValue
for the given value. This value
can be used for setting and comparing against a value retrieved
from a variable or field in this virtual machine.
value
- a boolean for which to create the value
BooleanValue
for the given boolean.public ByteValue mirrorOf(byte value)
ByteValue
for the given value. This value
can be used for setting and comparing against a value retrieved
from a variable or field in this virtual machine.
value
- a byte for which to create the value
ByteValue
for the given byte.public CharValue mirrorOf(char value)
CharValue
for the given value. This value
can be used for setting and comparing against a value retrieved
from a variable or field in this virtual machine.
value
- a char for which to create the value
CharValue
for the given char.public ShortValue mirrorOf(short value)
ShortValue
for the given value. This value
can be used for setting and comparing against a value retrieved
from a variable or field in this virtual machine.
value
- a short for which to create the value
ShortValue
for the given short.public IntegerValue mirrorOf(int value)
IntegerValue
for the given value. This value
can be used for setting and comparing against a value retrieved
from a variable or field in this virtual machine.
value
- an int for which to create the value
IntegerValue
for the given int.public LongValue mirrorOf(long value)
LongValue
for the given value. This value
can be used for setting and comparing against a value retrieved
from a variable or field in this virtual machine.
value
- a long for which to create the value
LongValue
for the given long.public FloatValue mirrorOf(float value)
FloatValue
for the given value. This value
can be used for setting and comparing against a value retrieved
from a variable or field in this virtual machine.
value
- a float for which to create the value
FloatValue
for the given float.public DoubleValue mirrorOf(double value)
DoubleValue
for the given value. This value
can be used for setting and comparing against a value retrieved
from a variable or field in this virtual machine.
value
- a double for which to create the value
DoubleValue
for the given double.public StringReference mirrorOf(String value)
StringReference
that mirrors the newly created
string in the target VM.public Process process()
Process
object for this
virtual machine if launched
by a LaunchingConnector
Process
object for this virtual
machine, or null if it was not launched by a
LaunchingConnector
.public void dispose()
suspend()
or by
ThreadReference.suspend()
are resumed as many
times as necessary for them to run.
ObjectReference.disableCollection()
.
Resources originating in this VirtualMachine (ObjectReferences, ReferenceTypes, etc.) will become invalid.
public void exit(int exitCode)
Threads running in the mirrored VM are abruptly terminated. A thread death exception is not thrown and finally blocks are not run.
exitCode
- the exit code for the target VM.public boolean canWatchFieldModification()
true
if the feature is supported,
false
otherwise.public boolean canWatchFieldAccess()
true
if the feature is supported,
false
otherwise.public boolean canGetBytecodes()
true
if the feature is supported,
false
otherwise.public boolean canGetSyntheticAttribute()
true
if the feature is supported,
false
otherwise.public boolean canGetOwnedMonitorInfo()
true
if the feature is supported,
false
otherwise.public boolean canGetCurrentContendedMonitor()
true
if the feature is supported,
false
otherwise.public boolean canGetMonitorInfo()
true
if the feature is supported,
false
otherwise.public boolean canUseInstanceFilters()
BreakpointRequest.addInstanceFilter(com.sun.jdi.ObjectReference)
.
true
if the feature is supported,
false
otherwise.public boolean canRedefineClasses()
true
if the feature is supported,
false
otherwise.redefineClasses(java.util.Map)
public boolean canAddMethod()
true
if the feature is supported,
false
otherwise.redefineClasses(java.util.Map)
public boolean canUnrestrictedlyRedefineClasses()
true
if the feature is supported,
false
otherwise.redefineClasses(java.util.Map)
public boolean canPopFrames()
true
if the feature is supported,
false
otherwise.ThreadReference.popFrames(com.sun.jdi.StackFrame)
public boolean canGetSourceDebugExtension()
true
if the feature is supported,
false
otherwise.ReferenceType.sourceDebugExtension()
public boolean canRequestVMDeathEvent()
VMDeathRequest
s.
true
if the feature is supported,
false
otherwise.EventRequestManager.createVMDeathRequest()
public void setDefaultStratum(String stratum)
Location
for a
discussion of strata). Overrides the per-class default set
in the class file.
Affects location queries (such as,
Location.sourceName()
)
and the line boundaries used in
single stepping.
stratum
- the stratum to set as VM default,
or null to use per-class defaults.
UnsupportedOperationException
- if the
target virtual machine does not support this operation.public String getDefaultStratum()
null
(meaning that the per-class
default - ReferenceType.defaultStratum()
-
should be used) unless the default stratum has been
set with
setDefaultStratum(String)
.setDefaultStratum(String)
,
ReferenceType.defaultStratum()
public String description()
version()
, VirtualMachineManager.majorInterfaceVersion()
,
and VirtualMachineManager.minorInterfaceVersion()
public String version()
java.version
.
For obtaining the JDI interface version, use
VirtualMachineManager.majorInterfaceVersion()
and VirtualMachineManager.minorInterfaceVersion()
public String name()
java.vm.name
.
public void setDebugTraceMode(int traceFlags)
Output is implementation dependent and trace mode may be ignored.
traceFlags
- identifies which kinds of tracing to enable.
|
Java Debug Interface | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |