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-finallyblocks enclosing the current location will be triggered in due course.try-finallyandsynchronizedblocks 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
finallyblocks are not run, and that if the code is nested within asynchronizedstatement, the monitor lock is not released (however, if the method issynchronizedthe 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
finallyorsynchronizedblock enclosing the current instruction.- If there is no enclosing
finallyblock, the operation reduces to the above case.ll - If there is an enclosing
finallyblock, the VM creates a VM exception and activates thefinallyblock 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 afinallyblock manifests itself as (and is indistinguishable from) acatch Throwableblock.synchronizedstatements also compile to acatch Throwableblock. 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 anyfinallyorsynchronizedblocks 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 anOperationRefusedExceptionif 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
-