Lines Matching refs:Thread
43 that the debugger thread can't cause a GC: it has to expand the heap or
44 fail to allocate. (Might want to make that "is debugger thread AND all
74 The VM has a Thread struct associated with every active thread. The
75 ThreadId we pass to the debugger is the ObjectId for the java/lang/Thread
76 object, so to retrieve the VM's Thread struct we have to scan through the
79 When a thread goes away, we lock the list and free the struct. To
80 avoid having the thread list updated or Thread structs freed out from
81 under us, we want to acquire and hold the thread list lock while we're
85 We can speed this up a bit by adding a Thread struct pointer to the
86 java/lang/Thread object, and ensuring that both are discarded at the
226 LOGI("ignoring registerObject request in thread=%d",
375 * Only called from the JDWP handler thread.
391 * Only called from the JDWP handler thread.
413 * Only called from the JDWP handler thread.
458 * JDWP thread is running, don't allow GC.
467 * JDWP thread is idle, allow GC.
1691 * Thread and ThreadGroup
1696 * Convert a thread object to a Thread ptr.
1703 static Thread* threadObjToThread(Object* threadObj)
1705 Thread* thread;
1707 for (thread = gDvm.threadList; thread != NULL; thread = thread->next) {
1708 if (thread->threadObj == threadObj)
1712 return thread;
1716 * Get the status and suspend state of a thread.
1722 Thread* thread;
1728 /* lock the thread list, so the thread doesn't vanish while we work */
1731 thread = threadObjToThread(threadObj);
1732 if (thread == NULL)
1735 switch (thread->status) {
1752 if (dvmIsSuspended(thread))
1765 * Get the thread's suspend count.
1770 Thread* thread;
1776 /* lock the thread list, so the thread doesn't vanish while we work */
1779 thread = threadObjToThread(threadObj);
1780 if (thread == NULL)
1783 result = thread->suspendCount;
1791 * Determine whether or not a thread exists in the VM's thread list.
1793 * Returns "true" if the thread exists.
1798 Thread* thread;
1804 /* lock the thread list, so the thread doesn't vanish while we work */
1807 thread = threadObjToThread(threadObj);
1808 if (thread == NULL)
1818 * Determine whether or not a thread is suspended.
1820 * Returns "false" if the thread is running or doesn't exist.
1825 Thread* thread;
1831 /* lock the thread list, so the thread doesn't vanish while we work */
1834 thread = threadObjToThread(threadObj);
1835 if (thread == NULL)
1838 result = dvmIsSuspended(thread);
1846 * Return the ObjectId for the "system" thread group.
1855 * Return the ObjectId for the "main" thread group.
1864 * Get the name of a thread.
1883 /* lock the thread list, so the thread doesn't vanish while we work */
1885 Thread* thread = threadObjToThread(threadObj);
1886 if (thread != NULL)
1887 sprintf(result, "<%d> %s", thread->threadId, str);
1897 * Get a thread's group.
1913 * Get the name of a thread group.
1931 * Get the parent of a thread group.
1948 * Get the list of threads in the thread group.
1962 Thread* thread;
1972 thread = gDvm.threadList;
1974 for (thread = gDvm.threadList; thread != NULL; thread = thread->next) {
1977 /* Skip over the JDWP support thread. Some debuggers
1982 if (thread->handle == dvmJdwpGetDebugThread(gDvm.jdwpState))
1985 /* This thread is currently being created, and isn't ready
1988 if (thread->threadObj == NULL)
1991 group = dvmGetFieldObject(thread->threadObj,
2005 for (thread = gDvm.threadList; thread != NULL; thread = thread->next) {
2008 /* Skip over the JDWP support thread. Some debuggers
2013 if (thread->handle == dvmJdwpGetDebugThread(gDvm.jdwpState))
2016 /* This thread is currently being created, and isn't ready
2019 if (thread->threadObj == NULL)
2022 group = dvmGetFieldObject(thread->threadObj,
2026 *ptr++ = objectToObjectId(thread->threadObj);
2049 * Count up the #of frames on the thread's stack.
2056 Thread* thread;
2062 thread = threadObjToThread(threadObj);
2063 if (thread != NULL) {
2064 count = dvmComputeExactFrameDepth(thread->interpSave.curFrame);
2072 * Get info for frame N from the specified thread's stack.
2078 Thread* thread;
2086 thread = threadObjToThread(threadObj);
2087 if (thread == NULL)
2090 framePtr = thread->interpSave.curFrame;
2125 * Get the ThreadId for the current thread.
2129 Thread* self = dvmThreadSelf();
2150 * Suspend one thread (not ourselves).
2155 Thread* thread;
2159 thread = threadObjToThread(threadObj);
2160 if (thread == NULL) {
2164 dvmSuspendThread(thread);
2171 * Resume one thread (not ourselves).
2176 Thread* thread;
2180 thread = threadObjToThread(threadObj);
2181 if (thread == NULL) {
2184 dvmResumeThread(thread);
2238 * Return the "this" object for the specified frame. The thread must be
2492 * Tell JDWP and/or DDMS that a thread has started.
2494 void dvmDbgPostThreadStart(Thread* thread)
2498 objectToObjectId(thread->threadObj), true);
2501 dvmDdmSendThreadNotification(thread, true);
2505 * Tell JDWP and/or DDMS that a thread has gone away.
2507 void dvmDbgPostThreadDeath(Thread* thread)
2511 objectToObjectId(thread->threadObj), false);
2514 dvmDdmSendThreadNotification(thread, false);
2569 Thread* thread;
2576 * Get a pointer to the Thread struct for this ID. The pointer will
2577 * be used strictly for comparisons against the current thread pointer
2581 thread = threadObjToThread(threadObj);
2583 if (thread == NULL) {
2584 LOGE("Thread for single-step not found");
2587 if (!dvmIsSuspended(thread)) {
2588 LOGE("Thread for single-step not suspended");
2593 assert(dvmIsSuspended(thread));
2594 if (!dvmAddSingleStep(thread, size, depth))
2611 /* right now it's global, so don't need to find Thread */
2616 * Invoke a method in a thread that has been stopped on a breakpoint or
2617 * other debugger event. (This function is called from the JDWP thread.)
2629 Thread* targetThread = threadObjToThread(threadObj);
2632 return ERR_INVALID_THREAD; /* thread does not exist */
2636 return ERR_INVALID_THREAD; /* thread not stopped by event */
2641 * target thread if the suspend count is too deep. We're expected to
2651 * be stuck waiting on a suspended thread.
2668 targetThread->invokeReq.thread = threadObj;
2677 * This is a bit risky -- if the thread goes away we're sitting high
2684 * We change our (JDWP thread) status, which should be THREAD_RUNNING,
2689 Thread* self = dvmThreadSelf();
2692 LOGV(" Transferring control to event thread");
2699 LOGV(" Resuming event thread only");
2711 LOGV(" Control has returned from event thread");
2713 /* wait for thread to re-suspend itself */
2722 * Suspend the threads. We waited for the target thread to suspend
2725 * The suspendAllThreads() call will double-suspend the event thread,
2726 * so we want to resume the target thread once to keep the books straight.
2731 LOGV(" Resuming event thread to balance the count");
2766 Thread* self = dvmThreadSelf();
2836 * the object is going to be handed off to a different thread.
2966 LOGV("Debugger thread not active, ignoring DDM send (t=0x%08x)",