1
0

Restricted windows crash dump generating code to 32-bit platforms only due to inline assembly

git-svn-id: http://mc-server.googlecode.com/svn/trunk@307 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-02-22 08:06:56 +00:00
parent 16da9e07ae
commit e2e261dd17

View File

@ -55,9 +55,9 @@ void ShowCrashReport(int)
#ifdef _WIN32 #if defined(_WIN32) && !defined(_WIN64)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Windows stuff: when the server crashes, create a "dump file" containing the callstack of each thread and some variables; let the user send us that crash file for analysis // Windows 32-bit stuff: when the server crashes, create a "dump file" containing the callstack of each thread and some variables; let the user send us that crash file for analysis
typedef BOOL (WINAPI *pMiniDumpWriteDump)( typedef BOOL (WINAPI *pMiniDumpWriteDump)(
HANDLE hProcess, HANDLE hProcess,
@ -88,6 +88,7 @@ LONG WINAPI LastChanceExceptionFilter(__in struct _EXCEPTION_POINTERS * a_Except
char * oldStack; char * oldStack;
// Use the substitute stack: // Use the substitute stack:
// This code is the reason why we don't support 64-bit (yet)
_asm _asm
{ {
mov oldStack, esp mov oldStack, esp
@ -113,7 +114,7 @@ LONG WINAPI LastChanceExceptionFilter(__in struct _EXCEPTION_POINTERS * a_Except
return 0; return 0;
} }
#endif // _WIN32 #endif // _WIN32 && !_WIN64
@ -131,7 +132,7 @@ int main( int argc, char **argv )
#endif #endif
// Magic code to produce dump-files on Windows if the server crashes: // Magic code to produce dump-files on Windows if the server crashes:
#ifdef _WIN32 #if defined(_WIN32) && !defined(_WIN64)
HINSTANCE hDbgHelp = LoadLibrary("DBGHELP.DLL"); HINSTANCE hDbgHelp = LoadLibrary("DBGHELP.DLL");
g_WriteMiniDump = (pMiniDumpWriteDump)GetProcAddress(hDbgHelp, "MiniDumpWriteDump"); g_WriteMiniDump = (pMiniDumpWriteDump)GetProcAddress(hDbgHelp, "MiniDumpWriteDump");
if (g_WriteMiniDump != NULL) if (g_WriteMiniDump != NULL)
@ -139,7 +140,7 @@ int main( int argc, char **argv )
_snprintf_s(g_DumpFileName, ARRAYCOUNT(g_DumpFileName), _TRUNCATE, "crash_mcs_%x.dmp", GetCurrentProcessId()); _snprintf_s(g_DumpFileName, ARRAYCOUNT(g_DumpFileName), _TRUNCATE, "crash_mcs_%x.dmp", GetCurrentProcessId());
SetUnhandledExceptionFilter(LastChanceExceptionFilter); SetUnhandledExceptionFilter(LastChanceExceptionFilter);
} }
#endif // _WIN32 #endif // _WIN32 && !_WIN64
// End of dump-file magic // End of dump-file magic
#ifdef _DEBUG #ifdef _DEBUG