Spec-Zone .ru
спецификации, руководства, описания, API
|
|
Java Debug Interface | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The state of one method invocation on a thread's call stack.
As a thread executes, stack frames are pushed and popped from
its call stack as methods are invoked and then return. A StackFrame
mirrors one such frame from a target VM at some point in its
thread's execution. The call stack is, then, simply a List of
StackFrame objects. The call stack can be obtained any time a thread
is suspended through a call to ThreadReference.frames()
StackFrames provide access to a method's local variables and their current values.
The lifetime of a StackFrame is very limited. It is available only for suspended threads and becomes invalid once its thread is resumed.
Method Summary | |
Value |
getValue(LocalVariable variable)
Gets the Value of a LocalVariable in this frame. |
Map |
getValues(List variables)
Returns the values of multiple local variables in this frame. |
Location |
location()
Returns the Location of the current instruction in the frame. |
void |
setValue(LocalVariable variable,
Value value)
Sets the Value of a LocalVariable in this frame. |
ObjectReference |
thisObject()
Returns the value of 'this' for the current frame. |
ThreadReference |
thread()
Returns the thread under which this frame's method is running. |
LocalVariable |
visibleVariableByName(String name)
Finds a LocalVariable that matches the given name and is
visible at the current frame location. |
List |
visibleVariables()
Returns a list containing each LocalVariable
that can be accessed from this frame's location. |
Methods inherited from interface com.sun.jdi.Mirror |
toString, virtualMachine |
Method Detail |
public Location location()
Location
of the current instruction in the frame.
The method for which this frame was created can also be accessed
through the returned location.
For the top frame in the stack, this location identifies the
next instruction to be executed. For all other frames, this
location identifies the instruction that caused the next frame's
method to be invoked.
If the frame represents a native method invocation, the returned
location indicates the class and method, but the code index will
not be valid.location
in interface Locatable
Location
of the current instruction.InvalidStackFrameException
- if this stack frame has become
invalid. Once the frame's thread is resumed, the stack frame is
no longer valid.public ThreadReference thread()
ThreadReference
which mirrors the frame's thread.InvalidStackFrameException
- if this stack frame has become
invalid. Once the frame's thread is resumed, the stack frame is
no longer valid.public ObjectReference thisObject()
ObjectReference
for 'this' is only available for
non-native instance methods.ObjectReference
, or null if the frame represents
a native or static method.InvalidStackFrameException
- if this stack frame has become
invalid. Once the frame's thread is resumed, the stack frame is
no longer valid.public List visibleVariables() throws AbsentInformationException
LocalVariable
that can be accessed from this frame's location.
Visibility is based on the code index of the current instruction of this StackFrame. Each variable has a range of byte code indices in which it is accessible. If this stack frame's method matches this variable's method and if the code index of this StackFrame is within the variable's byte code range, the variable is visible.
A variable's byte code range is at least as large as the scope of that variable, but can continue beyond the end of the scope under certain circumstances:
LocalVariable
objects currently visible.AbsentInformationException
- if there is no line number
information for this method.InvalidStackFrameException
- if this stack frame has become
invalid. Once the frame's thread is resumed, the stack frame is
no longer valid.public LocalVariable visibleVariableByName(String name) throws AbsentInformationException
LocalVariable
that matches the given name and is
visible at the current frame location.
See visibleVariables()
for more information on visibility.name
- the variable name to findLocalVariable
, or null if there is no
visible variable with the given name.AbsentInformationException
- if there is no line number
information for this method.InvalidStackFrameException
- if this stack frame has become
invalid. Once the frame's thread is resumed, the stack frame is
no longer valid.public Value getValue(LocalVariable variable)
Value
of a LocalVariable
in this frame.
The variable must be valid for this frame's method and visible
according to the rules described in visibleVariables()
.variable
- the LocalVariable
to be accessedValue
of the instance field.IllegalArgumentException
- if the variable is
either invalid for this frame's method or not visible.InvalidStackFrameException
- if this stack frame has become
invalid. Once the frame's thread is resumed, the stack frame is
no longer valid.VMMismatchException
- if a Mirror
argument and this mirror
do not belong to the same VirtualMachine
.public Map getValues(List variables)
visibleVariables()
.variables
- a list of LocalVariable
objects to be accessedLocalVariable
with
its Value
IllegalArgumentException
- if any variable is
either invalid for this frame's method or not visible.InvalidStackFrameException
- if this stack frame has become
invalid. Once the frame's thread is resumed, the stack frame is
no longer valid.VMMismatchException
- if a Mirror
argument and this mirror
do not belong to the same VirtualMachine
.public void setValue(LocalVariable variable, Value value) throws InvalidTypeException, ClassNotLoadedException
Value
of a LocalVariable
in this frame.
The variable must be valid for this frame's method and visible
according to the rules described in visibleVariables()
.
Object values must be assignment compatible with the variable type (This implies that the variable type must be loaded through the enclosing class's class loader). Primitive values must be either assignment compatible with the variable type or must be convertible to the variable type without loss of information. See JLS section 5.2 for more information on assignment compatibility.
variable
- the field containing the requested valuevalue
- the new value to assignIllegalArgumentException
- if the field is not valid for
this object's class.InvalidTypeException
- if the value's type does not match
the variable's type.ClassNotLoadedException
- if the variable type has not yet been loaded
through the appropriate class loader.InvalidStackFrameException
- if this stack frame has become
invalid. Once the frame's thread is resumed, the stack frame is
no longer valid.VMMismatchException
- if a Mirror
argument and this mirror
do not belong to the same VirtualMachine
.
|
Java Debug Interface | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |