mirror of https://github.com/x64dbg/TitanEngine
Fixed a bug in which thread termination froze
This commit is contained in:
parent
bbab6359b0
commit
39fe35a09e
|
|
@ -109,15 +109,30 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsDbgReplyLaterSupported && DBGEvent.dwDebugEventCode == EXCEPTION_DEBUG_EVENT)
|
if (IsDbgReplyLaterSupported)
|
||||||
{
|
{
|
||||||
// Check if there is a thread processing a single step
|
if (DBGEvent.dwDebugEventCode == EXCEPTION_DEBUG_EVENT)
|
||||||
if (ThreadBeingProcessed != 0 && DBGEvent.dwThreadId != ThreadBeingProcessed)
|
|
||||||
{
|
{
|
||||||
// Reply to the dbg event later
|
// Check if there is a thread processing a single step
|
||||||
DBGCode = DBG_REPLY_LATER;
|
if (ThreadBeingProcessed != 0 && DBGEvent.dwThreadId != ThreadBeingProcessed)
|
||||||
|
{
|
||||||
|
// Reply to the dbg event later
|
||||||
|
DBGCode = DBG_REPLY_LATER;
|
||||||
|
|
||||||
goto continue_dbg_event;
|
goto continue_dbg_event;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (DBGEvent.dwDebugEventCode == EXIT_THREAD_DEBUG_EVENT)
|
||||||
|
{
|
||||||
|
if (ThreadBeingProcessed != 0 && DBGEvent.dwThreadId == ThreadBeingProcessed)
|
||||||
|
{
|
||||||
|
// Resume the other threads since the thread being processed is exiting
|
||||||
|
for (auto& Thread : SuspendedThreads)
|
||||||
|
ResumeThread(Thread.hThread);
|
||||||
|
|
||||||
|
SuspendedThreads.clear();
|
||||||
|
ThreadBeingProcessed = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1394,7 +1409,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsDbgReplyLaterSupported)
|
if (IsDbgReplyLaterSupported && DBGEvent.dwDebugEventCode != EXIT_THREAD_DEBUG_EVENT)
|
||||||
{
|
{
|
||||||
CONTEXT DbgCtx;
|
CONTEXT DbgCtx;
|
||||||
|
|
||||||
|
|
@ -1414,6 +1429,11 @@ __declspec(dllexport) void TITCALL DebugLoop()
|
||||||
if (ThreadBeingProcessed == Thread.dwThreadId)
|
if (ThreadBeingProcessed == Thread.dwThreadId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Check if the thread is already suspended
|
||||||
|
for (auto& SuspendedThread : SuspendedThreads)
|
||||||
|
if (SuspendedThread.dwThreadId == Thread.dwThreadId)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (SuspendThread(Thread.hThread) != -1)
|
if (SuspendThread(Thread.hThread) != -1)
|
||||||
SuspendedThreads.push_back(Thread);
|
SuspendedThreads.push_back(Thread);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue