1.1 --- a/src/os/windows/vm/os_windows.cpp Mon May 27 12:49:08 2013 -0700 1.2 +++ b/src/os/windows/vm/os_windows.cpp Tue May 28 15:08:57 2013 +0200 1.3 @@ -944,6 +944,8 @@ 1.4 MINIDUMP_TYPE dumpType; 1.5 static const char* cwd; 1.6 1.7 +// Default is to always create dump for debug builds, on product builds only dump on server versions of Windows. 1.8 +#ifndef ASSERT 1.9 // If running on a client version of Windows and user has not explicitly enabled dumping 1.10 if (!os::win32::is_windows_server() && !CreateMinidumpOnCrash) { 1.11 VMError::report_coredump_status("Minidumps are not enabled by default on client versions of Windows", false); 1.12 @@ -953,6 +955,12 @@ 1.13 VMError::report_coredump_status("Minidump has been disabled from the command line", false); 1.14 return; 1.15 } 1.16 +#else 1.17 + if (!FLAG_IS_DEFAULT(CreateMinidumpOnCrash) && !CreateMinidumpOnCrash) { 1.18 + VMError::report_coredump_status("Minidump has been disabled from the command line", false); 1.19 + return; 1.20 + } 1.21 +#endif 1.22 1.23 dbghelp = os::win32::load_Windows_dll("DBGHELP.DLL", NULL, 0); 1.24 1.25 @@ -1004,7 +1012,21 @@ 1.26 // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then. 1.27 if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) == false && 1.28 _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL) == false) { 1.29 - VMError::report_coredump_status("Call to MiniDumpWriteDump() failed", false); 1.30 + DWORD error = GetLastError(); 1.31 + LPTSTR msgbuf = NULL; 1.32 + 1.33 + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 1.34 + FORMAT_MESSAGE_FROM_SYSTEM | 1.35 + FORMAT_MESSAGE_IGNORE_INSERTS, 1.36 + NULL, error, 0, (LPTSTR)&msgbuf, 0, NULL) != 0) { 1.37 + 1.38 + jio_snprintf(buffer, bufferSize, "Call to MiniDumpWriteDump() failed (Error 0x%x: %s)", error, msgbuf); 1.39 + LocalFree(msgbuf); 1.40 + } else { 1.41 + // Call to FormatMessage failed, just include the result from GetLastError 1.42 + jio_snprintf(buffer, bufferSize, "Call to MiniDumpWriteDump() failed (Error 0x%x)", error); 1.43 + } 1.44 + VMError::report_coredump_status(buffer, false); 1.45 } else { 1.46 VMError::report_coredump_status(buffer, true); 1.47 }