blob: 33277ba8c6991719347a78a8905dc0559d24f555 [file] [log] [blame]
The Android Open Source Projectf6c38712009-03-03 19:28:47 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Andy McFadden0083d372009-08-21 14:44:04 -070016
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080017/*
18 * VM thread support.
19 */
20#ifndef _DALVIK_THREAD
21#define _DALVIK_THREAD
22
23#include "jni.h"
buzbee9f601a92011-02-11 17:48:20 -080024#include "interp/InterpState.h"
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080025
Carl Shapiro980ffb02010-03-13 22:34:01 -080026#include <errno.h>
Andy McFadden2b94b302010-03-09 16:38:36 -080027#include <cutils/sched_policy.h>
28
29
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080030#if defined(CHECK_MUTEX) && !defined(__USE_UNIX98)
Andy McFadden0083d372009-08-21 14:44:04 -070031/* glibc lacks this unless you #define __USE_UNIX98 */
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080032int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
33enum { PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP };
34#endif
35
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080036/*
37 * Current status; these map to JDWP constants, so don't rearrange them.
38 * (If you do alter this, update the strings in dvmDumpThread and the
39 * conversion table in VMThread.java.)
40 *
41 * Note that "suspended" is orthogonal to these values (so says JDWP).
42 */
43typedef enum ThreadStatus {
Andy McFaddenb5f3c0b2010-08-23 16:45:24 -070044 THREAD_UNDEFINED = -1, /* makes enum compatible with int32_t */
Andy McFaddenab227f72010-04-06 12:37:48 -070045
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080046 /* these match up with JDWP values */
47 THREAD_ZOMBIE = 0, /* TERMINATED */
48 THREAD_RUNNING = 1, /* RUNNABLE or running now */
49 THREAD_TIMED_WAIT = 2, /* TIMED_WAITING in Object.wait() */
50 THREAD_MONITOR = 3, /* BLOCKED on a monitor */
51 THREAD_WAIT = 4, /* WAITING in Object.wait() */
52 /* non-JDWP states */
53 THREAD_INITIALIZING = 5, /* allocated, not yet running */
54 THREAD_STARTING = 6, /* started, not yet on thread list */
55 THREAD_NATIVE = 7, /* off in a JNI native method */
56 THREAD_VMWAIT = 8, /* waiting on a VM resource */
Andy McFaddenb5f3c0b2010-08-23 16:45:24 -070057 THREAD_SUSPENDED = 9, /* suspended, usually by GC or debugger */
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080058} ThreadStatus;
59
60/* thread priorities, from java.lang.Thread */
61enum {
62 THREAD_MIN_PRIORITY = 1,
63 THREAD_NORM_PRIORITY = 5,
64 THREAD_MAX_PRIORITY = 10,
65};
66
67
68/* initialization */
69bool dvmThreadStartup(void);
70bool dvmThreadObjStartup(void);
71void dvmThreadShutdown(void);
72void dvmSlayDaemons(void);
73
74
Andy McFaddend5ab7262009-08-25 07:19:34 -070075#define kJniLocalRefMin 32
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080076#define kJniLocalRefMax 512 /* arbitrary; should be plenty */
77#define kInternalRefDefault 32 /* equally arbitrary */
78#define kInternalRefMax 4096 /* mainly a sanity check */
79
80#define kMinStackSize (512 + STACK_OVERFLOW_RESERVE)
Andy McFadden80e8d7f2011-01-25 12:26:41 -080081#define kDefaultStackSize (16*1024) /* four 4K pages */
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080082#define kMaxStackSize (256*1024 + STACK_OVERFLOW_RESERVE)
83
84/*
85 * Our per-thread data.
86 *
87 * These are allocated on the system heap.
88 */
89typedef struct Thread {
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080090 /*
buzbee9f601a92011-02-11 17:48:20 -080091 * Interpreter state which must be preserved across nested
92 * interpreter invocations (via JNI callbacks). Must be the first
93 * element in Thread.
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080094 */
buzbee9f601a92011-02-11 17:48:20 -080095 InterpSaveState interpSave;
96 /*
97 * Begin interpreter state which does not need to be preserved, but should
98 * be located towards the beginning of the Thread structure for
99 * efficiency.
100 */
101 JValue retval;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800102 /*
103 * This is the number of times the thread has been suspended. When the
104 * count drops to zero, the thread resumes.
105 *
106 * "dbgSuspendCount" is the portion of the suspend count that the
107 * debugger is responsible for. This has to be tracked separately so
108 * that we can recover correctly if the debugger abruptly disconnects
109 * (suspendCount -= dbgSuspendCount). The debugger should not be able
110 * to resume GC-suspended threads, because we ignore the debugger while
111 * a GC is in progress.
112 *
113 * Both of these are guarded by gDvm.threadSuspendCountLock.
114 *
115 * (We could store both of these in the same 32-bit, using 16-bit
116 * halves, to make atomic ops possible. In practice, you only need
117 * to read suspendCount, and we need to hold a mutex when making
118 * changes, so there's no need to merge them. Note the non-debug
119 * component will rarely be other than 1 or 0 -- not sure it's even
120 * possible with the way mutexes are currently used.)
121 */
122 int suspendCount;
123 int dbgSuspendCount;
124
buzbee9f601a92011-02-11 17:48:20 -0800125 u1* cardTable;
126
127 /* current limit of stack; flexes for StackOverflowError */
128 const u1* interpStackEnd;
129
130 /* FP of bottom-most (currently executing) stack frame on interp stack */
131 void* curFrame;
132 /* current exception, or NULL if nothing pending */
133 Object* exception;
134
135 /* small unique integer; useful for "thin" locks and debug messages */
136 u4 threadId;
137
138 bool debugIsMethodEntry;
139 /* interpreter stack size; our stacks are fixed-length */
140 int interpStackSize;
141 bool stackOverflowed;
142
143 InterpEntry entryPoint; // What to do when we start the interpreter
144
145 /* JNI local reference tracking */
146#ifdef USE_INDIRECT_REF
147 IndirectRefTable jniLocalRefTable;
148#else
149 ReferenceTable jniLocalRefTable;
150#endif
151
152#ifdef WITH_JIT
153 struct JitToInterpEntries jitToInterpEntries;
154 /*
155 * Whether the current top VM frame is in the interpreter or JIT cache:
156 * NULL : in the interpreter
157 * non-NULL: entry address of the JIT'ed code (the actual value doesn't
158 * matter)
159 */
160 void* inJitCodeCache;
161 unsigned char* pJitProfTable;
162 unsigned char** ppJitProfTable; // Used to refresh pJitProfTable
163 int jitThreshold;
164 const void* jitResumeNPC;
165 const u2* jitResumeDPC;
166 JitState jitState;
167 int icRechainCount;
168 const void* pProfileCountdown;
169#if defined(WITH_SELF_VERIFICATION)
170 /* Buffer for register state during self verification */
171 struct ShadowSpace* shadowSpace;
172#endif
173 int currTraceRun;
174 int totalTraceLen; // Number of Dalvik insts in trace
175 const u2* currTraceHead; // Start of the trace we're building
176 const u2* currRunHead; // Start of run we're building
177 int currRunLen; // Length of run in 16-bit words
178 const u2* lastPC; // Stage the PC for the threaded interpreter
179 intptr_t threshFilter[JIT_TRACE_THRESH_FILTER_SIZE];
180 JitTraceRun trace[MAX_JIT_RUN_LEN];
181#endif
182
183 /*
184 * Thread's current status. Can only be changed by the thread itself
185 * (i.e. don't mess with this from other threads).
186 */
187 volatile ThreadStatus status;
188
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800189 /* thread handle, as reported by pthread_self() */
190 pthread_t handle;
191
192 /* thread ID, only useful under Linux */
193 pid_t systemTid;
194
195 /* start (high addr) of interp stack (subtract size to get malloc addr) */
196 u1* interpStackStart;
197
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800198 /* the java/lang/Thread that we are associated with */
199 Object* threadObj;
200
201 /* the JNIEnv pointer associated with this thread */
202 JNIEnv* jniEnv;
203
204 /* internal reference tracking */
205 ReferenceTable internalLocalRefTable;
206
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800207
208 /* JNI native monitor reference tracking (initialized on first use) */
209 ReferenceTable jniMonitorRefTable;
210
211 /* hack to make JNI_OnLoad work right */
212 Object* classLoaderOverride;
213
Carl Shapirob4539192010-01-04 16:50:00 -0800214 /* mutex to guard the interrupted and the waitMonitor members */
215 pthread_mutex_t waitMutex;
216
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800217 /* pointer to the monitor lock we're currently waiting on */
Carl Shapiro77f52eb2009-12-24 19:56:53 -0800218 /* guarded by waitMutex */
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800219 /* TODO: consider changing this to Object* for better JDWP interaction */
220 Monitor* waitMonitor;
Carl Shapiro77f52eb2009-12-24 19:56:53 -0800221
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800222 /* thread "interrupted" status; stays raised until queried or thrown */
Carl Shapiro77f52eb2009-12-24 19:56:53 -0800223 /* guarded by waitMutex */
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800224 bool interrupted;
225
Carl Shapiro77f52eb2009-12-24 19:56:53 -0800226 /* links to the next thread in the wait set this thread is part of */
227 struct Thread* waitNext;
228
229 /* object to sleep on while we are waiting for a monitor */
230 pthread_cond_t waitCond;
231
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800232 /*
233 * Set to true when the thread is in the process of throwing an
234 * OutOfMemoryError.
235 */
236 bool throwingOOME;
237
238 /* links to rest of thread list; grab global lock before traversing */
239 struct Thread* prev;
240 struct Thread* next;
241
Andy McFadden909ce242009-12-10 16:38:30 -0800242 /* used by threadExitCheck when a thread exits without detaching */
243 int threadExitCheckCount;
244
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800245 /* JDWP invoke-during-breakpoint support */
246 DebugInvokeReq invokeReq;
247
buzbee9f601a92011-02-11 17:48:20 -0800248 /* Interpreter switching */
249 int nextMode;
250
Andy McFadden0d615c32010-08-18 12:19:51 -0700251 /* base time for per-thread CPU timing (used by method profiling) */
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800252 bool cpuClockBaseSet;
253 u8 cpuClockBase;
254
255 /* memory allocation profiling state */
256 AllocProfState allocProf;
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800257
258#ifdef WITH_JNI_STACK_CHECK
259 u4 stackCrc;
260#endif
The Android Open Source Project99409882009-03-18 22:20:24 -0700261
262#if WITH_EXTRA_GC_CHECKS > 1
263 /* PC, saved on every instruction; redundant with StackSaveArea */
264 const u2* currentPc2;
265#endif
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800266} Thread;
267
268/* start point for an internal thread; mimics pthread args */
269typedef void* (*InternalThreadStart)(void* arg);
270
271/* args for internal thread creation */
272typedef struct InternalStartArgs {
273 /* inputs */
274 InternalThreadStart func;
275 void* funcArg;
276 char* name;
277 Object* group;
278 bool isDaemon;
279 /* result */
280 volatile Thread** pThread;
281 volatile int* pCreateStatus;
282} InternalStartArgs;
283
284/* finish init */
285bool dvmPrepMainForJni(JNIEnv* pEnv);
286bool dvmPrepMainThread(void);
287
288/* utility function to get the tid */
289pid_t dvmGetSysThreadId(void);
290
291/*
292 * Get our Thread* from TLS.
293 *
294 * Returns NULL if this isn't a thread that the VM is aware of.
295 */
296Thread* dvmThreadSelf(void);
297
298/* grab the thread list global lock */
299void dvmLockThreadList(Thread* self);
Andy McFaddend19988d2010-10-22 13:32:12 -0700300/* try to grab the thread list global lock */
301bool dvmTryLockThreadList(void);
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800302/* release the thread list global lock */
303void dvmUnlockThreadList(void);
304
305/*
306 * Thread suspend/resume, used by the GC and debugger.
307 */
308typedef enum SuspendCause {
309 SUSPEND_NOT = 0,
310 SUSPEND_FOR_GC,
311 SUSPEND_FOR_DEBUG,
312 SUSPEND_FOR_DEBUG_EVENT,
313 SUSPEND_FOR_STACK_DUMP,
314 SUSPEND_FOR_DEX_OPT,
Carl Shapiro1e714bb2010-03-16 03:26:49 -0700315 SUSPEND_FOR_VERIFY,
Carl Shapiro07018e22010-10-26 21:07:41 -0700316 SUSPEND_FOR_HPROF,
Bill Buzbee27176222009-06-09 09:20:16 -0700317#if defined(WITH_JIT)
Ben Cheng60c24f42010-01-04 12:29:56 -0800318 SUSPEND_FOR_TBL_RESIZE, // jit-table resize
319 SUSPEND_FOR_IC_PATCH, // polymorphic callsite inline-cache patch
320 SUSPEND_FOR_CC_RESET, // code-cache reset
Bill Buzbee964a7b02010-01-28 12:54:19 -0800321 SUSPEND_FOR_REFRESH, // Reload data cached in interpState
Bill Buzbee27176222009-06-09 09:20:16 -0700322#endif
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800323} SuspendCause;
324void dvmSuspendThread(Thread* thread);
325void dvmSuspendSelf(bool jdwpActivity);
326void dvmResumeThread(Thread* thread);
327void dvmSuspendAllThreads(SuspendCause why);
328void dvmResumeAllThreads(SuspendCause why);
329void dvmUndoDebuggerSuspensions(void);
330
331/*
332 * Check suspend state. Grab threadListLock before calling.
333 */
Andy McFadden3469a7e2010-08-04 16:09:10 -0700334bool dvmIsSuspended(const Thread* thread);
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800335
336/*
337 * Wait until a thread has suspended. (Used by debugger support.)
338 */
339void dvmWaitForSuspend(Thread* thread);
340
341/*
342 * Check to see if we should be suspended now. If so, suspend ourselves
343 * by sleeping on a condition variable.
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800344 */
345bool dvmCheckSuspendPending(Thread* self);
346
347/*
The Android Open Source Project99409882009-03-18 22:20:24 -0700348 * Fast test for use in the interpreter. Returns "true" if our suspend
349 * count is nonzero.
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800350 */
The Android Open Source Project99409882009-03-18 22:20:24 -0700351INLINE bool dvmCheckSuspendQuick(Thread* self) {
352 return (self->suspendCount != 0);
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800353}
354
355/*
356 * Used when changing thread state. Threads may only change their own.
357 * The "self" argument, which may be NULL, is accepted as an optimization.
358 *
359 * If you're calling this before waiting on a resource (e.g. THREAD_WAIT
360 * or THREAD_MONITOR), do so in the same function as the wait -- this records
361 * the current stack depth for the GC.
362 *
363 * If you're changing to THREAD_RUNNING, this will check for suspension.
364 *
365 * Returns the old status.
366 */
367ThreadStatus dvmChangeStatus(Thread* self, ThreadStatus newStatus);
368
369/*
370 * Initialize a mutex.
371 */
372INLINE void dvmInitMutex(pthread_mutex_t* pMutex)
373{
374#ifdef CHECK_MUTEX
375 pthread_mutexattr_t attr;
376 int cc;
377
378 pthread_mutexattr_init(&attr);
379 cc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP);
380 assert(cc == 0);
381 pthread_mutex_init(pMutex, &attr);
382 pthread_mutexattr_destroy(&attr);
383#else
384 pthread_mutex_init(pMutex, NULL); // default=PTHREAD_MUTEX_FAST_NP
385#endif
386}
387
388/*
389 * Grab a plain mutex.
390 */
391INLINE void dvmLockMutex(pthread_mutex_t* pMutex)
392{
Carl Shapirob31b3012010-05-25 18:35:37 -0700393 int cc __attribute__ ((__unused__)) = pthread_mutex_lock(pMutex);
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800394 assert(cc == 0);
395}
396
397/*
Bill Buzbee964a7b02010-01-28 12:54:19 -0800398 * Try grabbing a plain mutex. Returns 0 if successful.
399 */
400INLINE int dvmTryLockMutex(pthread_mutex_t* pMutex)
401{
Carl Shapiro980ffb02010-03-13 22:34:01 -0800402 int cc = pthread_mutex_trylock(pMutex);
403 assert(cc == 0 || cc == EBUSY);
404 return cc;
Bill Buzbee964a7b02010-01-28 12:54:19 -0800405}
406
407/*
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800408 * Unlock pthread mutex.
409 */
410INLINE void dvmUnlockMutex(pthread_mutex_t* pMutex)
411{
Carl Shapirob31b3012010-05-25 18:35:37 -0700412 int cc __attribute__ ((__unused__)) = pthread_mutex_unlock(pMutex);
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800413 assert(cc == 0);
414}
415
416/*
417 * Destroy a mutex.
418 */
419INLINE void dvmDestroyMutex(pthread_mutex_t* pMutex)
420{
Carl Shapirob31b3012010-05-25 18:35:37 -0700421 int cc __attribute__ ((__unused__)) = pthread_mutex_destroy(pMutex);
422 assert(cc == 0);
423}
424
425INLINE void dvmBroadcastCond(pthread_cond_t* pCond)
426{
427 int cc __attribute__ ((__unused__)) = pthread_cond_broadcast(pCond);
428 assert(cc == 0);
429}
430
431INLINE void dvmSignalCond(pthread_cond_t* pCond)
432{
433 int cc __attribute__ ((__unused__)) = pthread_cond_signal(pCond);
434 assert(cc == 0);
435}
436
437INLINE void dvmWaitCond(pthread_cond_t* pCond, pthread_mutex_t* pMutex)
438{
439 int cc __attribute__ ((__unused__)) = pthread_cond_wait(pCond, pMutex);
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800440 assert(cc == 0);
441}
442
443/*
444 * Create a thread as a result of java.lang.Thread.start().
445 */
446bool dvmCreateInterpThread(Object* threadObj, int reqStackSize);
447
448/*
449 * Create a thread internal to the VM. It's visible to interpreted code,
450 * but found in the "system" thread group rather than "main".
451 */
452bool dvmCreateInternalThread(pthread_t* pHandle, const char* name,
453 InternalThreadStart func, void* funcArg);
454
455/*
456 * Attach or detach the current thread from the VM.
457 */
458bool dvmAttachCurrentThread(const JavaVMAttachArgs* pArgs, bool isDaemon);
459void dvmDetachCurrentThread(void);
460
461/*
462 * Get the "main" or "system" thread group.
463 */
464Object* dvmGetMainThreadGroup(void);
465Object* dvmGetSystemThreadGroup(void);
466
467/*
468 * Given a java/lang/VMThread object, return our Thread.
469 */
470Thread* dvmGetThreadFromThreadObject(Object* vmThreadObj);
471
472/*
Andy McFadden2b94b302010-03-09 16:38:36 -0800473 * Given a pthread handle, return the associated Thread*.
Andy McFaddenfd542662010-03-12 13:39:59 -0800474 * Caller must hold the thread list lock.
Andy McFadden2b94b302010-03-09 16:38:36 -0800475 *
476 * Returns NULL if the thread was not found.
477 */
478Thread* dvmGetThreadByHandle(pthread_t handle);
479
480/*
Andy McFaddenfd542662010-03-12 13:39:59 -0800481 * Given a thread ID, return the associated Thread*.
482 * Caller must hold the thread list lock.
483 *
484 * Returns NULL if the thread was not found.
485 */
486Thread* dvmGetThreadByThreadId(u4 threadId);
487
488/*
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800489 * Sleep in a thread. Returns when the sleep timer returns or the thread
490 * is interrupted.
491 */
492void dvmThreadSleep(u8 msec, u4 nsec);
493
494/*
495 * Get the name of a thread. (For safety, hold the thread list lock.)
496 */
497char* dvmGetThreadName(Thread* thread);
498
499/*
Ben Cheng7a0bcd02010-01-22 16:45:45 -0800500 * Convert ThreadStatus to a string.
501 */
502const char* dvmGetThreadStatusStr(ThreadStatus status);
503
504/*
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800505 * Return true if a thread is on the internal list. If it is, the
506 * thread is part of the GC's root set.
507 */
508bool dvmIsOnThreadList(const Thread* thread);
Jeff Hao97319a82009-08-12 16:57:15 -0700509
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800510/*
511 * Get/set the JNIEnv field.
512 */
513INLINE JNIEnv* dvmGetThreadJNIEnv(Thread* self) { return self->jniEnv; }
514INLINE void dvmSetThreadJNIEnv(Thread* self, JNIEnv* env) { self->jniEnv = env;}
515
516/*
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800517 * Update the priority value of the underlying pthread.
518 */
519void dvmChangeThreadPriority(Thread* thread, int newPriority);
520
Andy McFadden2b94b302010-03-09 16:38:36 -0800521/* "change flags" values for raise/reset thread priority calls */
522#define kChangedPriority 0x01
523#define kChangedPolicy 0x02
524
525/*
526 * If necessary, raise the thread's priority to nice=0 cgroup=fg.
527 *
528 * Returns bit flags indicating changes made (zero if nothing was done).
529 */
530int dvmRaiseThreadPriorityIfNeeded(Thread* thread, int* pSavedThreadPrio,
531 SchedPolicy* pSavedThreadPolicy);
532
533/*
534 * Drop the thread priority to what it was before an earlier call to
535 * dvmRaiseThreadPriorityIfNeeded().
536 */
537void dvmResetThreadPriority(Thread* thread, int changeFlags,
538 int savedThreadPrio, SchedPolicy savedThreadPolicy);
539
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800540/*
541 * Debug: dump information about a single thread.
542 */
543void dvmDumpThread(Thread* thread, bool isRunning);
544void dvmDumpThreadEx(const DebugOutputTarget* target, Thread* thread,
545 bool isRunning);
546
547/*
548 * Debug: dump information about all threads.
549 */
550void dvmDumpAllThreads(bool grabLock);
551void dvmDumpAllThreadsEx(const DebugOutputTarget* target, bool grabLock);
552
Andy McFadden384ef6b2010-03-15 17:24:55 -0700553/*
554 * Debug: kill a thread to get a debuggerd stack trace. Leaves the VM
555 * in an uncertain state.
556 */
557void dvmNukeThread(Thread* thread);
558
The Android Open Source Projectf6c38712009-03-03 19:28:47 -0800559#endif /*_DALVIK_THREAD*/