From ac32205b722276a0e7502e3ab003171f852341de Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 22 Nov 2013 17:45:18 +0800 Subject: [PATCH] Kernel - Working on allowing \0 out debug --- KernelLand/Kernel/libc.c | 8 +++++++- KernelLand/Kernel/logging.c | 3 ++- KernelLand/Kernel/threads.c | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/KernelLand/Kernel/libc.c b/KernelLand/Kernel/libc.c index c065e1ed..d42e5249 100644 --- a/KernelLand/Kernel/libc.c +++ b/KernelLand/Kernel/libc.c @@ -394,7 +394,13 @@ int vsnprintf(char *__s, const size_t __maxlen, const char *__format, va_list ar if( !CheckMem(p, minSize) ) continue; // No #PFs please if(!p) goto printString; while(minSize--) { - PUTCH(*p); + if(*p == '\0') { + PUTCH('\\'); + PUTCH('0'); + } + else { + PUTCH(*p); + } p ++; } break; diff --git a/KernelLand/Kernel/logging.c b/KernelLand/Kernel/logging.c index 5149e021..e0f20504 100644 --- a/KernelLand/Kernel/logging.c +++ b/KernelLand/Kernel/logging.c @@ -163,10 +163,11 @@ void Log_Int_PrintMessage(tLogEntry *Entry) csaLevelColours[Entry->Level], Entry->Time ); - LogF("%s [%-8s] %i - %s", + LogF("%s [%-8s] %i - %*C", csaLevelCodes[Entry->Level], Entry->Ident, Threads_GetTID(), + Entry->Length, Entry->Data ); LogF("\x1B[0m\r\n"); // Separate in case Entry->Data is too long diff --git a/KernelLand/Kernel/threads.c b/KernelLand/Kernel/threads.c index 1781f699..b2ce594f 100644 --- a/KernelLand/Kernel/threads.c +++ b/KernelLand/Kernel/threads.c @@ -505,6 +505,7 @@ tTID Threads_WaitTID(int TID, int *Status) // Specific Thread if(TID > 0) { + // TODO: Register on thread to be poked when it dies tTID ret; // NOTE: Race condition - Other child dies, desired child dies, first death is 'lost' while( (ret = Threads_WaitTID(-1, Status)) != TID ) -- 2.20.1