Show the current thread name in the log file.

This is very useful, although it kinda entwines the logging a bit
more than might be desired.
This commit is contained in:
Unknown W. Brackets committed 2013-03-10 22:25:03 -07:00
1 parent f5bb835dcb
commit 118050485f
4 files changed
+44 -7

No files matched your search

+16 -2
View File
@@ -20,6 +20,7 @@
#include <queue>
#include <algorithm>
#include "Common/LogManager.h"
#include "HLE.h"
#include "HLETables.h"
#include "../MIPS/MIPSInt.h"
@@ -684,6 +685,8 @@ void __KernelThreadingDoState(PointerWrap &p)
p.Do(actionAfterCallback);
__KernelRestoreActionType(actionAfterCallback, ActionAfterCallback::Create);
hleCurrentThreadName = __KernelGetThreadName(currentThread);
p.DoMarker("sceKernelThread");
}
@@ -833,6 +836,7 @@ void __KernelThreadingShutdown()
currentThread = 0;
intReturnHackAddr = 0;
curModule = 0;
hleCurrentThreadName = NULL;
}
const char *__KernelGetThreadName(SceUID threadID)
@@ -1202,7 +1206,10 @@ u32 __KernelDeleteThread(SceUID threadID, int exitStatus, const char *reason, bo
__KernelTriggerWait(WAITTYPE_THREADEND, threadID, exitStatus, reason, dontSwitch);
if (currentThread == threadID)
{
currentThread = 0;
hleCurrentThreadName = NULL;
}
if (currentCallbackThreadID == threadID)
{
currentCallbackThreadID = 0;
@@ -1426,6 +1433,7 @@ void __KernelSetupRootThread(SceUID moduleID, int args, const char *argp, int pr
if (prevThread && prevThread->isRunning())
__KernelChangeReadyState(currentThread, true);
currentThread = id;
hleCurrentThreadName = "root";
thread->nt.status = THREADSTATUS_RUNNING; // do not schedule
strcpy(thread->nt.name, "root");
@@ -2360,12 +2368,18 @@ void __KernelSwitchContext(Thread *target, const char *reason)
__KernelChangeReadyState(cur, oldUID, true);
}
currentThread = target->GetUID();
if (target)
{
currentThread = target->GetUID();
hleCurrentThreadName = target->nt.name;
__KernelChangeReadyState(target, currentThread, false);
target->nt.status = (target->nt.status | THREADSTATUS_RUNNING) & ~THREADSTATUS_READY;
}
else
{
currentThread = 0;
hleCurrentThreadName = NULL;
}
__KernelLoadContext(&target->context);
@@ -2374,7 +2388,7 @@ void __KernelSwitchContext(Thread *target, const char *reason)
if (!(fromIdle && toIdle))
{
DEBUG_LOG(HLE,"Context switched: %s -> %s (%s) (%i - pc: %08x -> %i - pc: %08x)",
oldName, target->GetName(),
oldName, hleCurrentThreadName,
reason,
oldUID, oldPC, currentThread, currentMIPS->pc);
}