1 11 package org.eclipse.jdi.internal; 12 13 14 import java.io.ByteArrayOutputStream ; 15 import java.io.DataInputStream ; 16 import java.io.DataOutputStream ; 17 import java.io.IOException ; 18 import java.lang.reflect.Field ; 19 import java.lang.reflect.Modifier ; 20 import java.util.ArrayList ; 21 import java.util.HashMap ; 22 import java.util.List ; 23 import java.util.Map ; 24 25 import org.eclipse.jdi.internal.jdwp.JdwpCommandPacket; 26 import org.eclipse.jdi.internal.jdwp.JdwpID; 27 import org.eclipse.jdi.internal.jdwp.JdwpReplyPacket; 28 import org.eclipse.jdi.internal.jdwp.JdwpThreadID; 29 30 import com.ibm.icu.text.MessageFormat; 31 import com.sun.jdi.ClassNotLoadedException; 32 import com.sun.jdi.IncompatibleThreadStateException; 33 import com.sun.jdi.InternalException; 34 import com.sun.jdi.InvalidStackFrameException; 35 import com.sun.jdi.InvalidTypeException; 36 import com.sun.jdi.NativeMethodException; 37 import com.sun.jdi.ObjectCollectedException; 38 import com.sun.jdi.ObjectReference; 39 import com.sun.jdi.StackFrame; 40 import com.sun.jdi.ThreadGroupReference; 41 import com.sun.jdi.ThreadReference; 42 import com.sun.jdi.VMCannotBeModifiedException; 43 import com.sun.jdi.VMDisconnectedException; 44 import com.sun.jdi.Value; 45 46 47 53 public class ThreadReferenceImpl extends ObjectReferenceImpl implements ThreadReference, org.eclipse.jdi.hcr.ThreadReference { 54 55 public static final int JDWP_THREAD_STATUS_ZOMBIE = 0; 56 public static final int JDWP_THREAD_STATUS_RUNNING = 1; 57 public static final int JDWP_THREAD_STATUS_SLEEPING = 2; 58 public static final int JDWP_THREAD_STATUS_MONITOR = 3; 59 public static final int JDWP_THREAD_STATUS_WAIT = 4; 60 61 62 public static final int SUSPEND_STATUS_SUSPENDED = 0x01; 63 64 65 private static Map fgThreadStatusMap = null; 66 67 68 private static String [] fgSuspendStatusStrings = null; 69 70 71 protected static final byte tag = JdwpID.THREAD_TAG; 72 73 74 private boolean fIsAtBreakpoint = false; 75 76 79 private ThreadGroupReferenceImpl fThreadGroup = null; 80 81 84 public ThreadReferenceImpl(VirtualMachineImpl vmImpl, JdwpThreadID threadID) { 85 super("ThreadReference", vmImpl, threadID); } 87 88 91 public void setIsAtBreakpoint() { 92 fIsAtBreakpoint = true; 93 } 94 95 98 public void resetEventFlags() { 99 fIsAtBreakpoint = false; 100 } 101 102 105 public byte getTag() { 106 return tag; 107 } 108 109 112 public ObjectReference currentContendedMonitor() throws IncompatibleThreadStateException { 113 if (!virtualMachine().canGetCurrentContendedMonitor()) { 114 throw new UnsupportedOperationException (); 115 } 116 initJdwpRequest(); 118 try { 119 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_CURRENT_CONTENDED_MONITOR, this); 120 switch (replyPacket.errorCode()) { 121 case JdwpReplyPacket.INVALID_THREAD: 122 throw new ObjectCollectedException(); 123 case JdwpReplyPacket.THREAD_NOT_SUSPENDED: 124 throw new IncompatibleThreadStateException(JDIMessages.ThreadReferenceImpl_Thread_was_not_suspended_1); 125 } 126 defaultReplyErrorHandler(replyPacket.errorCode()); 127 128 DataInputStream replyData = replyPacket.dataInStream(); 129 ObjectReference result = ObjectReferenceImpl.readObjectRefWithTag(this, replyData); 130 return result; 131 } catch (IOException e) { 132 defaultIOExceptionHandler(e); 133 return null; 134 } finally { 135 handledJdwpRequest(); 136 } 137 } 138 139 143 public void forceEarlyReturn(Value value) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException { 144 if(!virtualMachineImpl().canBeModified()) { 145 throw new VMCannotBeModifiedException(JDIMessages.ThreadReferenceImpl_vm_read_only); 146 } 147 initJdwpRequest(); 148 ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream (); 149 DataOutputStream dataOutStream = new DataOutputStream (byteOutStream); 150 try { 151 write(this, dataOutStream); 152 ((ValueImpl)value).writeWithTag((ValueImpl)value, dataOutStream); 153 JdwpReplyPacket reply = requestVM(JdwpCommandPacket.TR_FORCE_EARLY_RETURN, byteOutStream); 154 switch(reply.errorCode()) { 155 case JdwpReplyPacket.INVALID_THREAD: 156 throw new ObjectCollectedException(JDIMessages.ThreadReferenceImpl_thread_object_invalid); 157 case JdwpReplyPacket.INVALID_OBJECT: 158 throw new ClassNotLoadedException(JDIMessages.ThreadReferenceImpl_thread_or_value_unknown); 159 case JdwpReplyPacket.THREAD_NOT_SUSPENDED: 160 case JdwpReplyPacket.THREAD_NOT_ALIVE: 161 throw new IncompatibleThreadStateException(JDIMessages.ThreadReferenceImpl_thread_not_suspended); 162 case JdwpReplyPacket.NOT_IMPLEMENTED: 163 throw new UnsupportedOperationException (JDIMessages.ThreadReferenceImpl_no_force_early_return_on_threads); 164 case JdwpReplyPacket.OPAQUE_FRAME: 165 throw new NativeMethodException(JDIMessages.ThreadReferenceImpl_thread_cannot_force_native_method); 166 case JdwpReplyPacket.NO_MORE_FRAMES: 167 throw new InvalidStackFrameException(JDIMessages.ThreadReferenceImpl_thread_no_stackframes); 168 case JdwpReplyPacket.TYPE_MISMATCH: 169 throw new InvalidTypeException(JDIMessages.ThreadReferenceImpl_incapatible_return_type); 170 case JdwpReplyPacket.VM_DEAD: 171 throw new VMDisconnectedException(JDIMessages.vm_dead); 172 } 173 defaultReplyErrorHandler(reply.errorCode()); 174 } 175 catch (IOException e) { 176 defaultIOExceptionHandler(e); 177 } 178 finally { 179 handledJdwpRequest(); 180 } 181 } 182 183 186 public StackFrame frame(int index) throws IncompatibleThreadStateException { 187 return (StackFrameImpl)frames(index, 1).get(0); 188 } 189 190 193 public int frameCount() throws IncompatibleThreadStateException { 194 initJdwpRequest(); 196 try { 197 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_FRAME_COUNT, this); 198 switch (replyPacket.errorCode()) { 199 case JdwpReplyPacket.INVALID_THREAD: 200 throw new ObjectCollectedException(); 201 case JdwpReplyPacket.THREAD_NOT_SUSPENDED: 202 throw new IncompatibleThreadStateException(JDIMessages.ThreadReferenceImpl_Thread_was_not_suspended_1); 203 } 204 defaultReplyErrorHandler(replyPacket.errorCode()); 205 206 DataInputStream replyData = replyPacket.dataInStream(); 207 int result = readInt("frame count", replyData); return result; 209 } catch (IOException e) { 210 defaultIOExceptionHandler(e); 211 return 0; 212 } finally { 213 handledJdwpRequest(); 214 } 215 } 216 217 220 public List frames() throws IncompatibleThreadStateException { 221 return frames(0, -1); 222 } 223 224 227 public List frames(int start, int length) throws IndexOutOfBoundsException , IncompatibleThreadStateException { 228 initJdwpRequest(); 230 try { 231 ByteArrayOutputStream outBytes = new ByteArrayOutputStream (); 232 DataOutputStream outData = new DataOutputStream (outBytes); 233 write(this, outData); 234 writeInt(start, "start", outData); writeInt(length, "length", outData); 237 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_FRAMES, outBytes); 238 switch (replyPacket.errorCode()) { 239 case JdwpReplyPacket.INVALID_THREAD: 240 throw new ObjectCollectedException(); 241 case JdwpReplyPacket.THREAD_NOT_SUSPENDED: 242 throw new IncompatibleThreadStateException(JDIMessages.ThreadReferenceImpl_Thread_was_not_suspended_1); 243 case JdwpReplyPacket.INVALID_INDEX: 244 throw new IndexOutOfBoundsException (JDIMessages.ThreadReferenceImpl_Invalid_index_of_stack_frames_given_4); 245 } 246 defaultReplyErrorHandler(replyPacket.errorCode()); 247 248 DataInputStream replyData = replyPacket.dataInStream(); 249 int nrOfElements = readInt("elements", replyData); List frames = new ArrayList (nrOfElements); 251 for (int i = 0; i < nrOfElements; i++) { 252 StackFrameImpl frame = StackFrameImpl.readWithLocation(this, this, replyData); 253 if (frame == null) { 254 continue; 255 } 256 frames.add(frame); 257 } 258 return frames; 259 } catch (IOException e) { 260 defaultIOExceptionHandler(e); 261 return null; 262 } finally { 263 handledJdwpRequest(); 264 } 265 } 266 267 271 public void interrupt() { 272 initJdwpRequest(); 274 try { 275 requestVM(JdwpCommandPacket.TR_INTERRUPT, this); 276 } finally { 277 handledJdwpRequest(); 278 } 279 } 280 281 284 public boolean isAtBreakpoint() { 285 return isSuspended() && fIsAtBreakpoint; 286 } 287 288 291 public boolean isSuspended() { 292 initJdwpRequest(); 294 try { 295 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_STATUS, this); 296 switch (replyPacket.errorCode()) { 297 case JdwpReplyPacket.INVALID_THREAD: 298 throw new ObjectCollectedException(); 299 } 300 defaultReplyErrorHandler(replyPacket.errorCode()); 301 DataInputStream replyData = replyPacket.dataInStream(); 302 readInt("thread status", threadStatusMap(), replyData); int suspendStatus = readInt("suspend status", suspendStatusStrings(), replyData); boolean result = suspendStatus == SUSPEND_STATUS_SUSPENDED; 306 return result; 307 } catch (IOException e) { 308 defaultIOExceptionHandler(e); 309 return false; 310 } finally { 311 handledJdwpRequest(); 312 } 313 } 314 315 318 public String name() { 319 initJdwpRequest(); 320 try { 321 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_NAME, this); 322 switch (replyPacket.errorCode()) { 323 case JdwpReplyPacket.INVALID_THREAD: 324 throw new ObjectCollectedException(); 325 } 326 defaultReplyErrorHandler(replyPacket.errorCode()); 327 DataInputStream replyData = replyPacket.dataInStream(); 328 return readString("name", replyData); } catch (IOException e) { 330 defaultIOExceptionHandler(e); 331 return null; 332 } finally { 333 handledJdwpRequest(); 334 } 335 } 336 337 340 public List ownedMonitors() throws IncompatibleThreadStateException { 341 if (!virtualMachine().canGetOwnedMonitorInfo()) { 342 throw new UnsupportedOperationException (); 343 } 344 initJdwpRequest(); 346 try { 347 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_OWNED_MONITORS, this); 348 switch (replyPacket.errorCode()) { 349 case JdwpReplyPacket.INVALID_THREAD: 350 throw new ObjectCollectedException(); 351 case JdwpReplyPacket.THREAD_NOT_SUSPENDED: 352 throw new IncompatibleThreadStateException(JDIMessages.ThreadReferenceImpl_Thread_was_not_suspended_5); 353 } 354 defaultReplyErrorHandler(replyPacket.errorCode()); 355 DataInputStream replyData = replyPacket.dataInStream(); 356 357 int nrOfMonitors = readInt("nr of monitors", replyData); List result = new ArrayList (nrOfMonitors); 359 for (int i = 0; i < nrOfMonitors; i++) { 360 result.add(ObjectReferenceImpl.readObjectRefWithTag(this, replyData)); 361 } 362 return result; 363 } catch (IOException e) { 364 defaultIOExceptionHandler(e); 365 return null; 366 } finally { 367 handledJdwpRequest(); 368 } 369 } 370 371 375 public List ownedMonitorsAndFrames() throws IncompatibleThreadStateException { 376 initJdwpRequest(); 377 try { 378 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_OWNED_MONITOR_STACK_DEPTH, this); 379 switch (replyPacket.errorCode()) { 380 case JdwpReplyPacket.INVALID_THREAD: 381 case JdwpReplyPacket.INVALID_OBJECT: 382 throw new ObjectCollectedException(JDIMessages.ThreadReferenceImpl_thread_object_invalid); 383 case JdwpReplyPacket.THREAD_NOT_SUSPENDED: 384 throw new IncompatibleThreadStateException(JDIMessages.ThreadReferenceImpl_Thread_was_not_suspended_5); 385 case JdwpReplyPacket.NOT_IMPLEMENTED: 386 throw new UnsupportedOperationException (JDIMessages.ThreadReferenceImpl_no_force_early_return_on_threads); 387 case JdwpReplyPacket.VM_DEAD: 388 throw new VMDisconnectedException(JDIMessages.vm_dead); 389 } 390 defaultReplyErrorHandler(replyPacket.errorCode()); 391 DataInputStream replyData = replyPacket.dataInStream(); 392 393 int owned = readInt("owned monitors", replyData); List result = new ArrayList (owned); 395 for (int i = 0; i < owned; i++) { 396 result.add(new MonitorInfoImpl(this, 397 readInt("stack depth", replyData), ObjectReferenceImpl.readObjectRefWithTag(this, replyData), 399 virtualMachineImpl())); 400 } 401 return result; 402 } 403 catch (IOException e) { 404 defaultIOExceptionHandler(e); 405 return null; 406 } 407 finally { 408 handledJdwpRequest(); 409 } 410 } 411 412 416 public void resume() { 417 initJdwpRequest(); 418 try { 419 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_RESUME, this); 420 switch (replyPacket.errorCode()) { 421 case JdwpReplyPacket.INVALID_THREAD: 422 throw new ObjectCollectedException(); 423 } 424 defaultReplyErrorHandler(replyPacket.errorCode()); 425 resetEventFlags(); 426 } finally { 427 handledJdwpRequest(); 428 } 429 } 430 431 434 public int status() { 435 initJdwpRequest(); 437 try { 438 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_STATUS, this); 439 switch (replyPacket.errorCode()) { 440 case JdwpReplyPacket.ABSENT_INFORMATION: 441 return THREAD_STATUS_UNKNOWN; 442 case JdwpReplyPacket.INVALID_THREAD: 443 return THREAD_STATUS_NOT_STARTED; 444 } 445 defaultReplyErrorHandler(replyPacket.errorCode()); 446 DataInputStream replyData = replyPacket.dataInStream(); 447 int threadStatus = readInt("thread status", threadStatusMap(), replyData); readInt("suspend status", suspendStatusStrings(), replyData); switch (threadStatus) { 450 case JDWP_THREAD_STATUS_ZOMBIE: 451 return THREAD_STATUS_ZOMBIE; 452 case JDWP_THREAD_STATUS_RUNNING: 453 return THREAD_STATUS_RUNNING; 454 case JDWP_THREAD_STATUS_SLEEPING: 455 return THREAD_STATUS_SLEEPING; 456 case JDWP_THREAD_STATUS_MONITOR: 457 return THREAD_STATUS_MONITOR; 458 case JDWP_THREAD_STATUS_WAIT: 459 return THREAD_STATUS_WAIT; 460 case -1: return THREAD_STATUS_UNKNOWN; 462 } 463 throw new InternalException(JDIMessages.ThreadReferenceImpl_Unknown_thread_status_received___6 + threadStatus); 464 } catch (IOException e) { 465 defaultIOExceptionHandler(e); 466 return 0; 467 } finally { 468 handledJdwpRequest(); 469 } 470 } 471 472 476 public void stop(ObjectReference throwable) throws InvalidTypeException { 477 checkVM(throwable); 478 ObjectReferenceImpl throwableImpl = (ObjectReferenceImpl) throwable; 479 480 initJdwpRequest(); 481 try { 482 ByteArrayOutputStream outBytes = new ByteArrayOutputStream (); 483 DataOutputStream outData = new DataOutputStream (outBytes); 484 write(this, outData); 485 throwableImpl.write(this, outData); 486 487 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_STOP, outBytes); 488 switch (replyPacket.errorCode()) { 489 case JdwpReplyPacket.INVALID_THREAD: 490 throw new ObjectCollectedException(); 491 case JdwpReplyPacket.INVALID_CLASS: 492 throw new InvalidTypeException (JDIMessages.ThreadReferenceImpl_Stop_argument_not_an_instance_of_java_lang_Throwable_in_the_target_VM_7); 493 } 494 defaultReplyErrorHandler(replyPacket.errorCode()); 495 } catch (IOException e) { 496 defaultIOExceptionHandler(e); 497 } finally { 498 handledJdwpRequest(); 499 } 500 } 501 502 506 public void suspend() { 507 initJdwpRequest(); 508 try { 509 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_SUSPEND, this); 510 switch (replyPacket.errorCode()) { 511 case JdwpReplyPacket.INVALID_THREAD: 512 throw new ObjectCollectedException(); 513 } 514 defaultReplyErrorHandler(replyPacket.errorCode()); 515 } finally { 516 handledJdwpRequest(); 517 } 518 } 519 520 523 public int suspendCount() { 524 initJdwpRequest(); 526 try { 527 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_SUSPEND_COUNT, this); 528 defaultReplyErrorHandler(replyPacket.errorCode()); 529 DataInputStream replyData = replyPacket.dataInStream(); 530 int result = readInt("suspend count", replyData); return result; 532 } catch (IOException e) { 533 defaultIOExceptionHandler(e); 534 return 0; 535 } finally { 536 handledJdwpRequest(); 537 } 538 } 539 540 543 public ThreadGroupReference threadGroup() { 544 if (fThreadGroup != null) { 545 return fThreadGroup; 546 } 547 initJdwpRequest(); 548 try { 549 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.TR_THREAD_GROUP, this); 550 switch (replyPacket.errorCode()) { 551 case JdwpReplyPacket.INVALID_THREAD: 552 throw new ObjectCollectedException(); 553 } 554 defaultReplyErrorHandler(replyPacket.errorCode()); 555 DataInputStream replyData = replyPacket.dataInStream(); 556 fThreadGroup= ThreadGroupReferenceImpl.read(this, replyData); 557 return fThreadGroup; 558 } catch (IOException e) { 559 defaultIOExceptionHandler(e); 560 return null; 561 } finally { 562 handledJdwpRequest(); 563 } 564 } 565 566 570 public boolean doReturn(Value returnValue, boolean triggerFinallyAndSynchronized) throws org.eclipse.jdi.hcr.OperationRefusedException { 571 virtualMachineImpl().checkHCRSupported(); 572 ValueImpl valueImpl; 573 if (returnValue != null) { checkVM(returnValue); 575 valueImpl = (ValueImpl)returnValue; 576 } else { 577 try { 578 TypeImpl returnType = (TypeImpl)frame(0).location().method().returnType(); 579 valueImpl = (ValueImpl)returnType.createNullValue(); 580 } catch (IncompatibleThreadStateException e) { 581 throw new org.eclipse.jdi.hcr.OperationRefusedException(e.toString()); 582 } catch (ClassNotLoadedException e) { 583 throw new org.eclipse.jdi.hcr.OperationRefusedException(e.toString()); 584 } 585 } 586 587 initJdwpRequest(); 589 try { 590 ByteArrayOutputStream outBytes = new ByteArrayOutputStream (); 591 DataOutputStream outData = new DataOutputStream (outBytes); 592 write(this, outData); 593 valueImpl.writeWithTag(this, outData); 594 writeBoolean(triggerFinallyAndSynchronized, "trigger finaly+sync", outData); 596 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.HCR_DO_RETURN, outBytes); 597 switch (replyPacket.errorCode()) { 598 case JdwpReplyPacket.INVALID_THREAD: 599 throw new ObjectCollectedException(); 600 } 601 defaultReplyErrorHandler(replyPacket.errorCode()); 602 603 DataInputStream replyData = replyPacket.dataInStream(); 604 boolean result = readBoolean("is enclosed", replyData); return result; 606 } catch (IOException e) { 607 defaultIOExceptionHandler(e); 608 return false; 609 } finally { 610 handledJdwpRequest(); 611 } 612 } 613 614 617 public String toString() { 618 try { 619 return MessageFormat.format(JDIMessages.ThreadReferenceImpl_8, new String []{type().toString(), name(), getObjectID().toString()}); 620 } catch (ObjectCollectedException e) { 621 return JDIMessages.ThreadReferenceImpl__Garbage_Collected__ThreadReference__9 + idString(); 622 } catch (Exception e) { 623 return fDescription; 624 } 625 } 626 627 630 public static ThreadReferenceImpl read(MirrorImpl target, DataInputStream in) throws IOException { 631 VirtualMachineImpl vmImpl = target.virtualMachineImpl(); 632 JdwpThreadID ID = new JdwpThreadID(vmImpl); 633 ID.read(in); 634 if (target.fVerboseWriter != null) 635 target.fVerboseWriter.println("threadReference", ID.value()); 637 if (ID.isNull()) 638 return null; 639 640 ThreadReferenceImpl mirror = (ThreadReferenceImpl)vmImpl.getCachedMirror(ID); 641 if (mirror == null) { 642 mirror = new ThreadReferenceImpl(vmImpl, ID); 643 vmImpl.addCachedMirror(mirror); 644 } 645 return mirror; 646 } 647 648 651 public static void getConstantMaps() { 652 if (fgThreadStatusMap != null) { 653 return; 654 } 655 656 Field [] fields = ThreadReferenceImpl.class.getDeclaredFields(); 657 fgThreadStatusMap = new HashMap (); 658 fgSuspendStatusStrings = new String [32]; 660 for (int i = 0; i < fields.length; i++) { 661 Field field = fields[i]; 662 if ((field.getModifiers() & Modifier.PUBLIC) == 0 || (field.getModifiers() & Modifier.STATIC) == 0 || (field.getModifiers() & Modifier.FINAL) == 0) 663 continue; 664 665 try { 666 String name = field.getName(); 667 int value = field.getInt(null); 668 Integer intValue = new Integer (value); 669 670 if (name.startsWith("JDWP_THREAD_STATUS_")) { name = name.substring(19); 672 fgThreadStatusMap.put(intValue, name); 673 } else if (name.startsWith("SUSPEND_STATUS_")) { name = name.substring(15); 675 for (int j = 0; j < fgSuspendStatusStrings.length; j++) { 676 if ((1 << j & value) != 0) { 677 fgSuspendStatusStrings[j]= name; 678 break; 679 } 680 } 681 } 682 } catch (IllegalAccessException e) { 683 } catch (IllegalArgumentException e) { 685 } 689 } 690 } 691 692 695 public static Map threadStatusMap() { 696 getConstantMaps(); 697 return fgThreadStatusMap; 698 } 699 700 703 public static String [] suspendStatusStrings() { 704 getConstantMaps(); 705 return fgSuspendStatusStrings; 706 } 707 708 711 public void popFrames(StackFrame frameToPop) throws IncompatibleThreadStateException { 712 if (!isSuspended()) { 713 throw new IncompatibleThreadStateException(); 714 } 715 if (!virtualMachineImpl().canPopFrames()) { 716 throw new UnsupportedOperationException (); 717 } 718 719 StackFrameImpl frame = (StackFrameImpl) frameToPop; 720 721 initJdwpRequest(); 722 try { 723 ByteArrayOutputStream outBytes = new ByteArrayOutputStream (); 724 DataOutputStream outData = new DataOutputStream (outBytes); 725 frame.writeWithThread(frame, outData); 726 727 JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.SF_POP_FRAME, outBytes); 728 switch (replyPacket.errorCode()) { 729 case JdwpReplyPacket.INVALID_THREAD: 730 throw new InvalidStackFrameException(); 731 case JdwpReplyPacket.INVALID_FRAMEID: 732 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); 733 case JdwpReplyPacket.THREAD_NOT_SUSPENDED: 734 throw new IncompatibleThreadStateException(JDIMessages.ThreadReferenceImpl_Unable_to_pop_the_requested_stack_frame__The_requested_stack_frame_is_not_suspended_11); 735 case JdwpReplyPacket.NO_MORE_FRAMES: 736 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); 737 default: 738 defaultReplyErrorHandler(replyPacket.errorCode()); 739 } 740 } catch (IOException ioe) { 741 defaultIOExceptionHandler(ioe); 742 } finally { 743 handledJdwpRequest(); 744 } 745 } 746 747 } 748 | Popular Tags |