--- old/src/os/windows/vm/os_windows.cpp 2015-03-12 11:02:57.074128507 -0700 +++ new/src/os/windows/vm/os_windows.cpp 2015-03-12 11:02:56.952122385 -0700 @@ -988,7 +988,11 @@ PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION); -void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) { +void os::check_create_dump_limit(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) { + // do nothing, check done in function abort below. +} + +void os::abort(bool dump_core, void* exceptionRecord, void* contextRecord) { HINSTANCE dbghelp; EXCEPTION_POINTERS ep; MINIDUMP_EXCEPTION_INFORMATION mei; @@ -999,20 +1003,24 @@ HANDLE dumpFile; MINIDUMP_TYPE dumpType; static const char* cwd; + static char buffer[O_BUFLEN]; -// Default is to always create dump for debug builds, on product builds only dump on server versions of Windows. + os::shutdown(); + if (!dump_core) return; + + // Default is to always create dump for debug builds, on product builds only dump on server versions of Windows. #ifndef ASSERT // If running on a client version of Windows and user has not explicitly enabled dumping - if (!os::win32::is_windows_server() && !CreateMinidumpOnCrash) { + if (!os::win32::is_windows_server() && !CreateCoredumpOnCrash) { VMError::report_coredump_status("Minidumps are not enabled by default on client versions of Windows", false); return; // If running on a server version of Windows and user has explictly disabled dumping - } else if (os::win32::is_windows_server() && !FLAG_IS_DEFAULT(CreateMinidumpOnCrash) && !CreateMinidumpOnCrash) { + } else if (os::win32::is_windows_server() && !FLAG_IS_DEFAULT(CreateCoredumpOnCrash) && !CreateCoredumpOnCrash) { VMError::report_coredump_status("Minidump has been disabled from the command line", false); return; } #else - if (!FLAG_IS_DEFAULT(CreateMinidumpOnCrash) && !CreateMinidumpOnCrash) { + if (!FLAG_IS_DEFAULT(CreateCoredumpOnCrash) && !CreateCoredumpOnCrash) { VMError::report_coredump_status("Minidump has been disabled from the command line", false); return; } @@ -1048,13 +1056,14 @@ #endif cwd = get_current_directory(NULL, 0); - jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp", cwd, current_process_id()); + jio_snprintf(buffer, sizeof(buffer), "%s\\hs_err_pid%u.mdmp", cwd, current_process_id()); dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (dumpFile == INVALID_HANDLE_VALUE) { VMError::report_coredump_status("Failed to create file for dumping", false); return; } + if (exceptionRecord != NULL && contextRecord != NULL) { ep.ContextRecord = (PCONTEXT) contextRecord; ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord; @@ -1079,11 +1088,11 @@ FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, 0, (LPTSTR)&msgbuf, 0, NULL) != 0) { - jio_snprintf(buffer, bufferSize, "Call to MiniDumpWriteDump() failed (Error 0x%x: %s)", error, msgbuf); + jio_snprintf(buffer, sizeof(buffer), "Call to MiniDumpWriteDump() failed (Error 0x%x: %s)", error, msgbuf); LocalFree(msgbuf); } else { // Call to FormatMessage failed, just include the result from GetLastError - jio_snprintf(buffer, bufferSize, "Call to MiniDumpWriteDump() failed (Error 0x%x)", error); + jio_snprintf(buffer, sizeof(buffer), "Call to MiniDumpWriteDump() failed (Error 0x%x)", error); } VMError::report_coredump_status(buffer, false); } else { @@ -1091,12 +1100,6 @@ } CloseHandle(dumpFile); -} - - -void os::abort(bool dump_core) { - os::shutdown(); - // no core dump on Windows win32::exit_process_or_thread(win32::EPT_PROCESS, 1); }