String failureMessage = "## FAILURE: Can NOT get MethodEntryLocation for method '"
+ methodForEvents + "'";
printErrorAndFail(failureMessage);
}
ReplyPacket reply = debuggeeWrapper.vmMirror.setBreakpoint(combinedEventsLocation);
int breakpointRequestID = reply.getNextValueAsInt();
logWriter.println("=> Breakpoint requestID = " + breakpointRequestID);
logWriter.println("=> Set request for METHOD_EXIT event in debuggee: "
+ getDebuggeeClassName() + ", method: " + methodForEvents);
reply = debuggeeWrapper.vmMirror
.setMethodExit(methodEntryClassNameRegexp);
checkReplyPacket(reply, "EventRequest::Set command");
int methodExitRequestID = reply.getNextValueAsInt();
logWriter.println("=> METHOD_EXIT requestID = " + methodExitRequestID);
logWriter.println("=> Set request for SINGLE_STEP event in class "
+ debuggeeSignature);
CommandPacket setRequestCommand = new CommandPacket(
JDWPCommands.EventRequestCommandSet.CommandSetID,
JDWPCommands.EventRequestCommandSet.SetCommand);
setRequestCommand
.setNextValueAsByte(JDWPConstants.EventKind.SINGLE_STEP);
setRequestCommand.setNextValueAsByte(JDWPConstants.SuspendPolicy.ALL);
setRequestCommand.setNextValueAsInt(2);
setRequestCommand.setNextValueAsByte(EventMod.ModKind.Step);
setRequestCommand.setNextValueAsThreadID(threadID);
setRequestCommand.setNextValueAsInt(JDWPConstants.StepSize.MIN);
setRequestCommand.setNextValueAsInt(JDWPConstants.StepDepth.INTO);
setRequestCommand.setNextValueAsByte(EventMod.ModKind.ClassOnly);
setRequestCommand.setNextValueAsReferenceTypeID(debuggeeClassID);
ReplyPacket setRequestReply = debuggeeWrapper.vmMirror
.performCommand(setRequestCommand);
checkReplyPacket(setRequestReply, "EventRequest::Set command");
int stepRequestID = setRequestReply.getNextValueAsInt();
logWriter.println("=> SINGLE_STEP requestID = " + stepRequestID);
logWriter.println("");
logWriter.println("=> Resume debuggee");
debuggeeWrapper.vmMirror.resume();
// ignore SINGLE_STEP events until receiving combined METHOD_EXIT,
// SINGLE_STEP, BREAKPOINT events
logWriter.println("=> Try to receive and check combined events: "
+ " METHOD_EXIT, SINGLE_STEP, BREAKPOINT events; ignore single SINGLE_STEP event");
receiveAndCheckEvents(EXPECTED_EVENTS_ARRAY, combinedEventsLocation);
if ( eventVmDeathReceived ) {
logWriter.println("==> testCombinedEvents002 is FINISHing as VM_DEATH is received!");
return;
}
if ( eventMethodExitReceived ) {
logWriter.println("");
logWriter.println("=> Clean request for METHOD_EXIT event...");
ReplyPacket clearReply = debuggeeWrapper.vmMirror.clearEvent(
JDWPConstants.EventKind.METHOD_EXIT, methodExitRequestID);
checkReplyPacket(clearReply, "EventRequest::Clear");
}
logWriter.println("");
logWriter.println("=> Clean request for SINGLE_STEP event...");
ReplyPacket clearReply = debuggeeWrapper.vmMirror.clearEvent(
JDWPConstants.EventKind.SINGLE_STEP, stepRequestID);
checkReplyPacket(clearReply, "EventRequest::Clear");
logWriter.println("=> Resume debuggee");
debuggeeWrapper.vmMirror.resume();