.println("=> Send InvokeMethod command for method: " + PopFramesDebuggee.METHOD_TO_INVOKE_NAME);
invokeCommandID = debuggeeWrapper.vmMirror
.sendCommand(invokeCommand);
} catch (Exception e) {
logWriter.println("Exception during invokeCommand: " + e);
throw new TestErrorException(e);
}
// wait to ensure that method invocation started
logWriter.println("=> Wait " + timeoutToWait
+ " mls to ensure that method invocation started");
Object waitObj = new Object();
synchronized (waitObj) {
try {
waitObj.wait(timeoutToWait);
} catch (InterruptedException e) {
logWriter.println("##Exception while waiting on object: " + e);
throw new TestErrorException(e);
}
}
// perform PopFrame command
logWriter.println("=> Perform PopFrames command for method = " + methodToPop + " with frameID = " + frameID + " and expect errors");
CommandPacket popFramesCommand = new CommandPacket(
JDWPCommands.StackFrameCommandSet.CommandSetID,
JDWPCommands.StackFrameCommandSet.PopFramesCommand);
popFramesCommand.setNextValueAsThreadID(breakpointThreadID);
popFramesCommand.setNextValueAsFrameID(frameID);
ReplyPacket popFrameReply = debuggeeWrapper.vmMirror
.performCommand(popFramesCommand);
int res = popFrameReply.getErrorCode();
logWriter.println("=> Returned error code: " + res + " ("
+ JDWPConstants.Error.getName(res) + ")");
// check that PopFrames returns error, because thread is resumed by
// InvokeMethod
if (res == JDWPConstants.Error.NONE) {
logWriter
.println("##PopFrames command returned no error for thread resumed by InvokeMethod");
fail("##PopFrames command returned no error for thread resumed by InvokeMethod");
}
logWriter.println("=> Receive reply of invoked method: " + PopFramesDebuggee.METHOD_TO_INVOKE_NAME);
try {
ReplyPacket reply = debuggeeWrapper.vmMirror
.receiveReply(invokeCommandID);
checkReplyPacket(reply, "ClassType::InvokeMethod command");
} catch (Exception e) {
logWriter
.println("##Exception while receiving reply for invoke command: "
+ e);
throw new TestErrorException(e);
}
logWriter.println("=> Resume debuggee");
debuggeeWrapper.vmMirror.resume();