move globals into namespace
This commit is contained in:
@@ -593,7 +593,7 @@ void RageMutex::Lock()
|
||||
g_ThreadSlotsLock.Unlock();
|
||||
|
||||
/* Pass the crash handle of the other thread, so it can backtrace that thread. */
|
||||
ForceCrashHandlerDeadlock( sReason, CrashHandle );
|
||||
CrashHandler::ForceDeadlock( sReason, CrashHandle );
|
||||
#else
|
||||
FAIL_M( sReason );
|
||||
#endif
|
||||
@@ -747,7 +747,7 @@ retry:
|
||||
const CString sReason = ssprintf( "Semaphore timeout on mutex %s on thread %s",
|
||||
GetName().c_str(), ThisSlot? ThisSlot->GetThreadName(): "(???" ")" ); // stupid trigraph warnings
|
||||
#if defined(CRASH_HANDLER)
|
||||
ForceCrashHandlerDeadlock( sReason, GetInvalidThreadId() );
|
||||
CrashHandler::ForceDeadlock( sReason, GetInvalidThreadId() );
|
||||
#else
|
||||
RageException::Throw( "%s", sReason.c_str() );
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,7 @@ static bool g_bIsMultipleInstance = false;
|
||||
|
||||
ArchHooks_Win32::ArchHooks_Win32()
|
||||
{
|
||||
SetUnhandledExceptionFilter(CrashHandler);
|
||||
SetUnhandledExceptionFilter( CrashHandler::ExceptionHandler );
|
||||
TimeCritMutex = new RageMutex("TimeCritMutex");
|
||||
|
||||
/* Disable critical errors, and handle them internally. We never want the
|
||||
|
||||
@@ -164,7 +164,7 @@ bool VDDebugInfoInitFromFile( VDDebugInfoContext *pctx );
|
||||
void VDDebugInfoDeinit( VDDebugInfoContext *pctx );
|
||||
|
||||
|
||||
long __stdcall CrashHandler( EXCEPTION_POINTERS *pExc )
|
||||
long __stdcall CrashHandler::ExceptionHandler( EXCEPTION_POINTERS *pExc )
|
||||
{
|
||||
/* Flush the log it isn't cut off at the end. */
|
||||
/* 1. We can't do regular file access in the crash handler.
|
||||
@@ -659,7 +659,7 @@ static bool PointsToValidCall( unsigned long ptr )
|
||||
return IsValidCall(buf+7, len);
|
||||
}
|
||||
|
||||
void do_backtrace( const void **buf, size_t size,
|
||||
void CrashHandler::do_backtrace( const void **buf, size_t size,
|
||||
HANDLE hProcess, HANDLE hThread, const CONTEXT *pContext )
|
||||
{
|
||||
// Retrieve stack pointers.
|
||||
@@ -949,20 +949,20 @@ BOOL APIENTRY CrashDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void NORETURN debug_crash()
|
||||
void NORETURN CrashHandler::debug_crash()
|
||||
{
|
||||
__try {
|
||||
__asm xor ebx,ebx
|
||||
__asm mov eax,dword ptr [ebx]
|
||||
// __asm mov dword ptr [ebx],eax
|
||||
// __asm lock add dword ptr cs:[00000000h], 12345678h
|
||||
} __except(CrashHandler((EXCEPTION_POINTERS*)_exception_info())) {
|
||||
} __except(ExceptionHandler((EXCEPTION_POINTERS*)_exception_info())) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Get a stack trace of the current thread and the specified thread. If
|
||||
* iID == GetInvalidThreadId(), then output a stack trace for every thread. */
|
||||
void ForceCrashHandlerDeadlock( CString reason, uint64_t iID )
|
||||
void CrashHandler::ForceDeadlock( CString reason, uint64_t iID )
|
||||
{
|
||||
strncpy( g_CrashInfo.m_CrashReason, reason, sizeof(g_CrashInfo.m_CrashReason) );
|
||||
g_CrashInfo.m_CrashReason[ sizeof(g_CrashInfo.m_CrashReason)-1 ] = 0;
|
||||
@@ -1024,7 +1024,7 @@ void ForceCrashHandlerDeadlock( CString reason, uint64_t iID )
|
||||
debug_crash();
|
||||
}
|
||||
|
||||
void ForceCrashHandler( const char *reason )
|
||||
void CrashHandler::ForceCrash( const char *reason )
|
||||
{
|
||||
strncpy( g_CrashInfo.m_CrashReason, reason, sizeof(g_CrashInfo.m_CrashReason) );
|
||||
g_CrashInfo.m_CrashReason[ sizeof(g_CrashInfo.m_CrashReason)-1 ] = 0;
|
||||
|
||||
@@ -3,16 +3,18 @@
|
||||
#ifndef CRASH_H
|
||||
#define CRASH_H
|
||||
#include <windows.h>
|
||||
extern long __stdcall CrashHandler(struct _EXCEPTION_POINTERS *ExceptionInfo);
|
||||
namespace CrashHandler
|
||||
{
|
||||
extern long __stdcall ExceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo);
|
||||
|
||||
/* Exactly as advertised. (This will bring up the crash handler even
|
||||
* in the debugger.) */
|
||||
void NORETURN debug_crash();
|
||||
/* Trigger the crash handler. This works even in the debugger. */
|
||||
void NORETURN debug_crash();
|
||||
|
||||
void do_backtrace( const void **buf, size_t size, HANDLE hProcess, HANDLE hThread, const CONTEXT *pContext );
|
||||
void SymLookup( const void *ptr, char *buf );
|
||||
void ForceCrashHandler( const char *reason );
|
||||
void ForceCrashHandlerDeadlock( CString reason, uint64_t iID );
|
||||
void do_backtrace( const void **buf, size_t size, HANDLE hProcess, HANDLE hThread, const CONTEXT *pContext );
|
||||
void SymLookup( const void *ptr, char *buf );
|
||||
void ForceCrash( const char *reason );
|
||||
void ForceDeadlock( CString reason, uint64_t iID );
|
||||
};
|
||||
|
||||
#endif
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user