- remove unused VectoredTryCatch

# Conflicts:
#	src/win32/i_crash.cpp
This commit is contained in:
Magnus Norddahl 2018-06-10 13:15:31 +02:00 committed by drfrag666
parent ddbf2f3166
commit 9bcd8aeb13
3 changed files with 0 additions and 129 deletions

View file

@ -203,15 +203,6 @@ void DrawerThreads::StopThreads()
shutdown_flag = false;
}
#ifndef WIN32
void VectoredTryCatch(void *data, void(*tryBlock)(void *data), void(*catchBlock)(void *data, const char *reason, bool fatal))
{
tryBlock(data);
}
#endif
DrawerCommandQueue::DrawerCommandQueue(RenderMemory *frameMemory) : FrameMemory(frameMemory)
{
}

View file

@ -97,8 +97,6 @@ public:
virtual void Execute(DrawerThread *thread) = 0;
};
void VectoredTryCatch(void *data, void(*tryBlock)(void *data), void(*catchBlock)(void *data, const char *reason, bool fatal));
class DrawerCommandQueue;
typedef std::shared_ptr<DrawerCommandQueue> DrawerCommandQueuePtr;
@ -122,7 +120,6 @@ private:
void WorkerMain(DrawerThread *thread);
static DrawerThreads *Instance();
static void ReportDrawerError(DrawerCommand *command, bool worker_thread, const char *reason, bool fatal);
std::vector<DrawerThread> threads;

View file

@ -3351,120 +3351,3 @@ void DisplayCrashLog ()
}
CloseTarFiles ();
}
/////////////////////////////////////////////////////////////////////////////
namespace
{
bool thread_local DrawerExceptionSetJumpResult;
CONTEXT thread_local DrawerExceptionSetJumpContext;
PVOID thread_local DrawerExceptionHandlerHandle;
const char thread_local *DrawerExceptionReason;
bool thread_local DrawerExceptionFatal;
LONG WINAPI DrawerExceptionHandler(_EXCEPTION_POINTERS *exceptionInfo)
{
*exceptionInfo->ContextRecord = DrawerExceptionSetJumpContext;
DrawerExceptionFatal = false;
switch (exceptionInfo->ExceptionRecord->ExceptionCode)
{
default: DrawerExceptionReason = "Unknown exception code"; break;
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: DrawerExceptionReason = "Array bounds exceeded"; break;
case EXCEPTION_BREAKPOINT: DrawerExceptionReason = "Breakpoint"; break;
case EXCEPTION_DATATYPE_MISALIGNMENT: DrawerExceptionReason = "Datatype misalignment"; break;
case EXCEPTION_FLT_DENORMAL_OPERAND: DrawerExceptionReason = "Float denormal operand"; break;
case EXCEPTION_FLT_DIVIDE_BY_ZERO: DrawerExceptionReason = "Float divide by zero"; break;
case EXCEPTION_FLT_INEXACT_RESULT: DrawerExceptionReason = "Float inexact result"; break;
case EXCEPTION_FLT_INVALID_OPERATION: DrawerExceptionReason = "Float invalid operation"; break;
case EXCEPTION_FLT_OVERFLOW: DrawerExceptionReason = "Float overflow"; break;
case EXCEPTION_FLT_STACK_CHECK: DrawerExceptionReason = "Float stack check"; break;
case EXCEPTION_FLT_UNDERFLOW: DrawerExceptionReason = "Float underflow"; break;
case EXCEPTION_INT_DIVIDE_BY_ZERO: DrawerExceptionReason = "Int divide by zero"; break;
case EXCEPTION_INT_OVERFLOW: DrawerExceptionReason = "Int overflow"; break;
case EXCEPTION_INVALID_DISPOSITION: DrawerExceptionReason = "Invalid disposition"; break;
case EXCEPTION_NONCONTINUABLE_EXCEPTION: DrawerExceptionReason = "Noncontinuable exception"; break;
case EXCEPTION_PRIV_INSTRUCTION: DrawerExceptionReason = "Priv instruction"; break;
case EXCEPTION_SINGLE_STEP: DrawerExceptionReason = "Single step"; break;
case EXCEPTION_STACK_OVERFLOW: DrawerExceptionReason = "Stack overflow"; break;
case EXCEPTION_ILLEGAL_INSTRUCTION:
DrawerExceptionReason = "Illegal instruction";
DrawerExceptionFatal = true;
break;
case EXCEPTION_ACCESS_VIOLATION:
if (exceptionInfo->ExceptionRecord->ExceptionInformation[0] == 0)
{
DrawerExceptionReason = "Read access violation";
}
else if (exceptionInfo->ExceptionRecord->ExceptionInformation[0] == 1)
{
DrawerExceptionReason = "Write access violation";
DrawerExceptionFatal = true;
}
else if (exceptionInfo->ExceptionRecord->ExceptionInformation[0] == 8)
{
DrawerExceptionReason = "User-mode data execution prevention (DEP) violation";
DrawerExceptionFatal = true;
}
else
{
DrawerExceptionReason = "Unknown access violation";
DrawerExceptionFatal = true;
}
break;
case EXCEPTION_IN_PAGE_ERROR:
if (exceptionInfo->ExceptionRecord->ExceptionInformation[0] == 0)
{
DrawerExceptionReason = "In page read error";
}
else if (exceptionInfo->ExceptionRecord->ExceptionInformation[0] == 1)
{
DrawerExceptionReason = "In page write error";
DrawerExceptionFatal = true;
}
else if (exceptionInfo->ExceptionRecord->ExceptionInformation[0] == 8)
{
DrawerExceptionReason = "In page user-mode data execution prevention (DEP) error";
DrawerExceptionFatal = true;
}
else
{
DrawerExceptionReason = "Unknown in page read error";
DrawerExceptionFatal = true;
}
break;
}
return EXCEPTION_CONTINUE_EXECUTION;
}
}
#ifndef __MINGW32__
void VectoredTryCatch(void *data, void(*tryBlock)(void *data), void(*catchBlock)(void *data, const char *reason, bool fatal))
{
DrawerExceptionSetJumpResult = false;
RtlCaptureContext(&DrawerExceptionSetJumpContext);
if (DrawerExceptionSetJumpResult)
{
RemoveVectoredExceptionHandler(DrawerExceptionHandlerHandle);
catchBlock(data, DrawerExceptionReason, DrawerExceptionFatal);
}
else
{
DrawerExceptionSetJumpResult = true;
DrawerExceptionHandlerHandle = AddVectoredExceptionHandler(1, DrawerExceptionHandler);
tryBlock(data);
RemoveVectoredExceptionHandler(DrawerExceptionHandlerHandle);
}
}
#else
void VectoredTryCatch(void *data, void(*tryBlock)(void *data), void(*catchBlock)(void *data, const char *reason, bool fatal))
{
tryBlock(data);
}
#endif