X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fthreads.c;h=67a2f637462e5b86252c40978b9cecee18cb21de;hb=d8976435eade14e409b01e58850b75990ad9a4a7;hp=0961f8d260c1c8d03478d5f7c726ea898acde2eb;hpb=cfe799a87802878b22f3c1c71007c722696af4dc;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/threads.c b/KernelLand/Kernel/threads.c index 0961f8d2..67a2f637 100644 --- a/KernelLand/Kernel/threads.c +++ b/KernelLand/Kernel/threads.c @@ -1133,9 +1133,20 @@ char **Threads_GetCWD(void) void Threads_int_DumpThread(tThread *thread) { + if( !thread ) { + Log(" %p NULL", thread); + return ; + } + if( !CheckMem(thread, sizeof(tThread)) ) { + Log(" %p INVAL", thread); + return ; + } + tPID pid = (thread->Process ? thread->Process->PID : -1); + const char *statstr = (thread->Status < sizeof(casTHREAD_STAT)/sizeof(casTHREAD_STAT[0]) + ? casTHREAD_STAT[thread->Status] : ""); Log(" %p %i (%i) - %s (CPU %i) - %i (%s)", - thread, thread->TID, thread->Process->PID, thread->ThreadName, thread->CurCPU, - thread->Status, casTHREAD_STAT[thread->Status] + thread, thread->TID, pid, thread->ThreadName, thread->CurCPU, + thread->Status, statstr ); switch(thread->Status) { @@ -1149,6 +1160,9 @@ void Threads_int_DumpThread(tThread *thread) ((tSemaphore*)thread->WaitPointer)->Name ); break; + case THREAD_STAT_EVENTSLEEP: + // TODO: Event mask + break; case THREAD_STAT_ZOMBIE: Log(" Return Status: %i", thread->RetStatus); break; @@ -1200,13 +1214,11 @@ void Threads_DumpActive(void) */ void Threads_Dump(void) { - tThread *thread; - Log("--- Thread Dump ---"); Threads_DumpActive(); Log("All Threads:"); - for(thread=gAllThreads;thread;thread=thread->GlobalNext) + for(tThread *thread = gAllThreads; thread; thread = thread->GlobalNext) { Threads_int_DumpThread(thread); }