From 7c4a92651592752bb73c2f672f3fa358b6839c1f Mon Sep 17 00:00:00 2001 From: Kyle Galloway Date: Tue, 24 Apr 2007 19:56:55 +0000 Subject: [PATCH] 2007-04-24 Kyle Galloway * gnu/classpath/jdwp/natVMVirtualMachine.java (getThreadStatus): Implement. From-SVN: r124117 --- libjava/ChangeLog | 5 +++ .../gnu/classpath/jdwp/natVMVirtualMachine.cc | 33 +++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 0c294216537..0596c8ac8be 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2007-04-24 Kyle Galloway + + * gnu/classpath/jdwp/natVMVirtualMachine.java + (getThreadStatus): Implement. + 2007-04-24 Keith Seitz * headers.txt (gnu/gcj/jvmti/Breakpoint.h)[DIRECT_THREADED]: diff --git a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc index c77aed257dd..1dfc52995e0 100644 --- a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc +++ b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc @@ -31,6 +31,7 @@ details. */ #include #include #include +#include #include #include #include @@ -622,9 +623,37 @@ getFrameCount (Thread *thread) jint gnu::classpath::jdwp::VMVirtualMachine:: -getThreadStatus (MAYBE_UNUSED Thread *thread) +getThreadStatus (Thread *thread) { - return 0; + jint thr_state, status; + + jvmtiError jerr = _jdwp_jvmtiEnv->GetThreadState (thread, &thr_state); + if (jerr != JVMTI_ERROR_NONE) + throw_jvmti_error (jerr); + + if (thr_state & JVMTI_THREAD_STATE_SLEEPING) + status = gnu::classpath::jdwp::JdwpConstants$ThreadStatus::SLEEPING; + else if (thr_state & JVMTI_THREAD_STATE_RUNNABLE) + status = gnu::classpath::jdwp::JdwpConstants$ThreadStatus::RUNNING; + else if (thr_state & JVMTI_THREAD_STATE_WAITING) + { + if (thr_state & (JVMTI_THREAD_STATE_IN_OBJECT_WAIT + | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER)) + status = gnu::classpath::jdwp::JdwpConstants$ThreadStatus::MONITOR; + else + status = gnu::classpath::jdwp::JdwpConstants$ThreadStatus::WAIT; + } + else + { + // The thread is not SLEEPING, MONITOR, or WAIT. It may, however, be + // alive but not yet started. + if (!(thr_state & (JVMTI_THREAD_STATE_ALIVE + | JVMTI_THREAD_STATE_TERMINATED))) + status = gnu::classpath::jdwp::JdwpConstants$ThreadStatus::RUNNING; + status = gnu::classpath::jdwp::JdwpConstants$ThreadStatus::ZOMBIE; + } + + return status; } java::util::ArrayList * -- 2.30.2