< prev index next >

src/jdk.jdwp.agent/share/native/libjdwp/ThreadReferenceImpl.c

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this
--- 1,7 ---
  /*
!  * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

*** 457,10 ***
--- 457,18 ---
      if (threadControl_isDebugThread(thread)) {
          outStream_setError(out, JDWP_ERROR(INVALID_THREAD));
          return JNI_TRUE;
      }
  
+     /* vthread fixme: We should just call throught to JVMTI and let the failure come from
+        there, but first we need a test that exercises this code for vthreads. */
+     if (isVThread(thread)) {
+         tty_message("ThreadReferenceImpl::stop() not supported.");
+         outStream_setError(out, JDWP_ERROR(INVALID_THREAD));
+         return JNI_TRUE;
+     }
+ 
      error = threadControl_stop(thread, throwable);
      if (error != JVMTI_ERROR_NONE) {
          outStream_setError(out, map2jdwpError(error));
      }
      return JNI_TRUE;

*** 480,10 ***
--- 488,18 ---
      if (threadControl_isDebugThread(thread)) {
          outStream_setError(out, JDWP_ERROR(INVALID_THREAD));
          return JNI_TRUE;
      }
  
+     /* vthread fixme: This should work. Need to disable this forced failure,
+        but first we need a test that exercises this code for vthreads. */
+     if (isVThread(thread)) {
+         tty_message("ThreadReferenceImpl::interrupt() not supported.");
+         outStream_setError(out, JDWP_ERROR(INVALID_THREAD));
+         return JNI_TRUE;
+     }
+ 
      error = threadControl_interrupt(thread);
      if (error != JVMTI_ERROR_NONE) {
          outStream_setError(out, map2jdwpError(error));
      }
      return JNI_TRUE;

*** 663,10 ***
--- 679,35 ---
        }
      }
      return JNI_TRUE;
  }
  
+ static jboolean
+ isVirtual(PacketInputStream *in, PacketOutputStream *out)
+ {
+     JNIEnv *env;
+     jthread thread;
+     jboolean isVirtual;
+ 
+     env = getEnv();
+ 
+     thread = inStream_readThreadRef(env, in);
+     if (inStream_error(in)) {
+         return JNI_TRUE;
+     }
+ 
+     if (threadControl_isDebugThread(thread)) {
+         outStream_setError(out, JDWP_ERROR(INVALID_THREAD));
+         return JNI_TRUE;
+     }
+ 
+     isVirtual = JNI_FUNC_PTR(env,IsVirtualThread)(env, thread);
+     (void)outStream_writeBoolean(out, isVirtual);
+ 
+     return JNI_TRUE;
+ }
+ 
  Command ThreadReference_Commands[] = {
      {name, "Name"},
      {suspend, "Suspend"},
      {resume, "Resume"},
      {status, "Status"},

*** 677,9 ***
      {currentContendedMonitor, "CurrentContendedMonitor"},
      {stop, "Stop"},
      {interrupt, "Interrupt"},
      {suspendCount, "SuspendCount"},
      {ownedMonitorsWithStackDepth, "OwnedMonitorsWithStackDepth"},
!     {forceEarlyReturn, "ForceEarlyReturn"}
  };
  
  DEBUG_DISPATCH_DEFINE_CMDSET(ThreadReference)
--- 718,10 ---
      {currentContendedMonitor, "CurrentContendedMonitor"},
      {stop, "Stop"},
      {interrupt, "Interrupt"},
      {suspendCount, "SuspendCount"},
      {ownedMonitorsWithStackDepth, "OwnedMonitorsWithStackDepth"},
!     {forceEarlyReturn, "ForceEarlyReturn"},
+     {isVirtual, "IsVirtual"}
  };
  
  DEBUG_DISPATCH_DEFINE_CMDSET(ThreadReference)
< prev index next >