- remove unused VectoredTryCatch

This commit is contained in:
Magnus Norddahl 2018-06-10 13:15:31 +02:00
parent 628f6c32d9
commit efa434d47b
3 changed files with 0 additions and 120 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

@ -3341,111 +3341,3 @@ void DisplayCrashLog ()
}
CloseTarFiles ();
}
/////////////////////////////////////////////////////////////////////////////
namespace
{
bool __declspec(thread) DrawerExceptionSetJumpResult;
CONTEXT __declspec(thread) DrawerExceptionSetJumpContext;
PVOID __declspec(thread) DrawerExceptionHandlerHandle;
const char __declspec(thread) *DrawerExceptionReason;
bool __declspec(thread) 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;
}
}
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);
}
}