* @see ThreadReference#popFrames(StackFrame)
*/
public void popFrames(StackFrame frameToPop)
throws IncompatibleThreadStateException {
if (!isSuspended()) {
throw new IncompatibleThreadStateException();
}
if (!virtualMachineImpl().canPopFrames()) {
throw new UnsupportedOperationException();
}
StackFrameImpl frame = (StackFrameImpl) frameToPop;
initJdwpRequest();
try {
ByteArrayOutputStream outBytes = new ByteArrayOutputStream();
DataOutputStream outData = new DataOutputStream(outBytes);
frame.writeWithThread(frame, outData);
JdwpReplyPacket replyPacket = requestVM(
JdwpCommandPacket.SF_POP_FRAME, outBytes);
switch (replyPacket.errorCode()) {
case JdwpReplyPacket.INVALID_THREAD:
throw new InvalidStackFrameException();
case JdwpReplyPacket.INVALID_FRAMEID:
throw new InvalidStackFrameException(
JDIMessages.ThreadReferenceImpl_Unable_to_pop_the_requested_stack_frame_from_the_call_stack__Reasons_include__The_frame_id_was_invalid__The_thread_was_resumed__10);
case JdwpReplyPacket.THREAD_NOT_SUSPENDED:
throw new IncompatibleThreadStateException(
JDIMessages.ThreadReferenceImpl_Unable_to_pop_the_requested_stack_frame__The_requested_stack_frame_is_not_suspended_11);
case JdwpReplyPacket.NO_MORE_FRAMES:
throw new InvalidStackFrameException(
JDIMessages.ThreadReferenceImpl_Unable_to_pop_the_requested_stack_frame_from_the_call_stack__Reasons_include__The_requested_frame_was_the_last_frame_on_the_call_stack__The_requested_frame_was_the_last_frame_above_a_native_frame__12);
default: