comparison src/os/windows/vm/os_windows.cpp @ 3240:5504afd15955

7033100: CreateMinidumpOnCrash does not work for failed asserts Summary: Passing NULL as MINIDUMP_EXCEPTION_INFORMATION when calling MiniDumpWriteDump when crash is due to assertion instead of real exception to avoid creating zero-length mini dump file. Reviewed-by: acorn, dcubed, poonam, coleenp
author zgu
date Thu, 14 Apr 2011 11:50:36 -0400
parents 083f13976b51
children 188c9a5d6a6d 089aee76df10
comparison
equal deleted inserted replaced
2477:3449f5e02cc4 3240:5504afd15955
919 919
920 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) { 920 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
921 HINSTANCE dbghelp; 921 HINSTANCE dbghelp;
922 EXCEPTION_POINTERS ep; 922 EXCEPTION_POINTERS ep;
923 MINIDUMP_EXCEPTION_INFORMATION mei; 923 MINIDUMP_EXCEPTION_INFORMATION mei;
924 MINIDUMP_EXCEPTION_INFORMATION* pmei;
925
924 HANDLE hProcess = GetCurrentProcess(); 926 HANDLE hProcess = GetCurrentProcess();
925 DWORD processId = GetCurrentProcessId(); 927 DWORD processId = GetCurrentProcessId();
926 HANDLE dumpFile; 928 HANDLE dumpFile;
927 MINIDUMP_TYPE dumpType; 929 MINIDUMP_TYPE dumpType;
928 static const char* cwd; 930 static const char* cwd;
969 971
970 if (dumpFile == INVALID_HANDLE_VALUE) { 972 if (dumpFile == INVALID_HANDLE_VALUE) {
971 VMError::report_coredump_status("Failed to create file for dumping", false); 973 VMError::report_coredump_status("Failed to create file for dumping", false);
972 return; 974 return;
973 } 975 }
974 976 if (exceptionRecord != NULL && contextRecord != NULL) {
975 ep.ContextRecord = (PCONTEXT) contextRecord; 977 ep.ContextRecord = (PCONTEXT) contextRecord;
976 ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord; 978 ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord;
977 979
978 mei.ThreadId = GetCurrentThreadId(); 980 mei.ThreadId = GetCurrentThreadId();
979 mei.ExceptionPointers = &ep; 981 mei.ExceptionPointers = &ep;
982 pmei = &mei;
983 } else {
984 pmei = NULL;
985 }
986
980 987
981 // Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all 988 // Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all
982 // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then. 989 // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then.
983 if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, &mei, NULL, NULL) == false && 990 if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) == false &&
984 _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, &mei, NULL, NULL) == false) { 991 _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL) == false) {
985 VMError::report_coredump_status("Call to MiniDumpWriteDump() failed", false); 992 VMError::report_coredump_status("Call to MiniDumpWriteDump() failed", false);
986 } else { 993 } else {
987 VMError::report_coredump_status(buffer, true); 994 VMError::report_coredump_status(buffer, true);
988 } 995 }
989 996