Fix crash in VirtualMachine.AllThreads JDWP command

When collecting all the started threads, we may encounter a thread in the
process of being started from Java code (Thread.start) in the threads list. The
crash occurs when we attempt to access the java.lang.Thread peer (calling
Thread::GetPeer) but the JNI global reference to it (Thread::jpeer) has not
been destroyed yet (which is verified with a check). This only happens when the
thread is starting up.

We now check the thread finished starting up before accessing the Java peer.
This also prevents from returning non-started threads in the reply.

Bug: 16660101

(cherry picked from commit a22d115711b5158cfc67b4f260a5b40f3ab303ca)

Change-Id: Ib61dbd0b01f63bfdda708d3c93eac58284bbe236
1 file changed