Package org.eclipse.jdi.hcr
Interface ThreadReference
public interface ThreadReference
Hot code replacement extension to
com.sun.jdi.ThreadReference
.-
Method Summary
-
Method Details
-
doReturn
Resumes the execution of this thread as if the next instruction was a return instruction with the given value. This causes the top stack frame to be popped with the given value.A breakpoint instruction at the current instruction is not triggered that is, this operation takes precedence over breakpoints.
The triggerFinallyAndSynchronizedBlocks option on this operation controls whethertry-finally
blocks enclosing the current location will be triggered in due course.try-finally
andsynchronized
blocks enclosing the current location should be triggered:- If no, the stack frame is popped, the return value is returned, and execution continues back in the caller. Note that
finally
blocks are not run, and that if the code is nested within asynchronized
statement, the monitor lock is not released (however, if the method issynchronized
the monitor lock will be properly released). This mechanism is sure-fire, but at the risk of not letting the target program clean itself up (e.g., close its files). - If yes, the VM checks to see whether there might be a
finally
orsynchronized
block enclosing the current instruction.- If there is no enclosing
finally
block, the operation reduces to the above case.ll - If there is an enclosing
finally
block, the VM creates a VM exception and activates thefinally
block with it. If this exception eventually causes the stack frame to be popped, the exception is caught by the VM itself, the return value is returned, and execution continues back in the caller.
- If there is no enclosing
Note that afinally
block manifests itself as (and is indistinguishable from) acatch Throwable
block.synchronized
statements also compile to acatch Throwable
block. The target program may inadventently end up catching this exception. Since the choices each have their pros and cons, making the decision is left to the debugger. However the later option is the recommended choice.
The reply to the operation contains a flag indicating whether anyfinally
orsynchronized
blocks are enclosing the current instruction.
This operation is ignored if the thread was not suspended. If the thread was suspended multiple times, wait for the same number of resumes before executing the return instruction.
The returned value is ignored if the method returns void.
Throws anOperationRefusedException
if the VM refused to perform this operation. This in recognition that the VM may be in an awkward state and unable to comply:- for example, execution is suspended in a native method,
- for example, execution is suspended during class preparation.
- Parameters:
returnValue
- the value to return from the thread withtriggerFinallyAndSynchronizedBlocks
- if finally / synchronization blocks should be executed before resuming- Returns:
- if the forced return was successful
- If no, the stack frame is popped, the return value is returned, and execution continues back in the caller. Note that
-