hotspot/src/share/vm/prims/jvmtiEnvBase.hpp
changeset 22738 e2e6f03308f9
parent 22234 da823d78ad65
child 22797 a4bbf1828275
--- a/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp	Mon Feb 03 15:24:20 2014 +0100
+++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp	Tue Feb 04 19:41:46 2014 -0800
@@ -533,7 +533,11 @@
   VMOp_Type type() const { return VMOp_GetFrameCount; }
   jvmtiError result()    { return _result; }
   void doit() {
-    _result = ((JvmtiEnvBase*)_env)->get_frame_count(_state, _count_ptr);
+    _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
+    JavaThread* jt = _state->get_thread();
+    if (Threads::includes(jt) && !jt->is_exiting() && jt->threadObj() != NULL) {
+      _result = ((JvmtiEnvBase*)_env)->get_frame_count(_state, _count_ptr);
+    }
   }
 };
 
@@ -559,8 +563,12 @@
   VMOp_Type type() const { return VMOp_GetFrameLocation; }
   jvmtiError result()    { return _result; }
   void doit() {
-    _result = ((JvmtiEnvBase*)_env)->get_frame_location(_java_thread, _depth,
-                                                        _method_ptr, _location_ptr);
+    _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
+    if (Threads::includes(_java_thread) && !_java_thread->is_exiting() &&
+        _java_thread->threadObj() != NULL) {
+      _result = ((JvmtiEnvBase*)_env)->get_frame_location(_java_thread, _depth,
+                                                          _method_ptr, _location_ptr);
+    }
   }
 };