comparison src/os/windows/vm/os_windows.cpp @ 3430:089aee76df10

Merge
author asaha
date Wed, 04 May 2011 16:38:05 -0700
parents 5def270bc147 5504afd15955
children 7c948af3e651
comparison
equal deleted inserted replaced
3429:5def270bc147 3430:089aee76df10
918 918
919 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) { 919 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
920 HINSTANCE dbghelp; 920 HINSTANCE dbghelp;
921 EXCEPTION_POINTERS ep; 921 EXCEPTION_POINTERS ep;
922 MINIDUMP_EXCEPTION_INFORMATION mei; 922 MINIDUMP_EXCEPTION_INFORMATION mei;
923 MINIDUMP_EXCEPTION_INFORMATION* pmei;
924
923 HANDLE hProcess = GetCurrentProcess(); 925 HANDLE hProcess = GetCurrentProcess();
924 DWORD processId = GetCurrentProcessId(); 926 DWORD processId = GetCurrentProcessId();
925 HANDLE dumpFile; 927 HANDLE dumpFile;
926 MINIDUMP_TYPE dumpType; 928 MINIDUMP_TYPE dumpType;
927 static const char* cwd; 929 static const char* cwd;
968 970
969 if (dumpFile == INVALID_HANDLE_VALUE) { 971 if (dumpFile == INVALID_HANDLE_VALUE) {
970 VMError::report_coredump_status("Failed to create file for dumping", false); 972 VMError::report_coredump_status("Failed to create file for dumping", false);
971 return; 973 return;
972 } 974 }
973 975 if (exceptionRecord != NULL && contextRecord != NULL) {
974 ep.ContextRecord = (PCONTEXT) contextRecord; 976 ep.ContextRecord = (PCONTEXT) contextRecord;
975 ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord; 977 ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord;
976 978
977 mei.ThreadId = GetCurrentThreadId(); 979 mei.ThreadId = GetCurrentThreadId();
978 mei.ExceptionPointers = &ep; 980 mei.ExceptionPointers = &ep;
981 pmei = &mei;
982 } else {
983 pmei = NULL;
984 }
985
979 986
980 // Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all 987 // Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all
981 // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then. 988 // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then.
982 if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, &mei, NULL, NULL) == false && 989 if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) == false &&
983 _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, &mei, NULL, NULL) == false) { 990 _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL) == false) {
984 VMError::report_coredump_status("Call to MiniDumpWriteDump() failed", false); 991 VMError::report_coredump_status("Call to MiniDumpWriteDump() failed", false);
985 } else { 992 } else {
986 VMError::report_coredump_status(buffer, true); 993 VMError::report_coredump_status(buffer, true);
987 } 994 }
988 995