Fix a couple of Windows createdump issues (#35820)
authorMike McLaughlin <mikem@microsoft.com>
Tue, 5 May 2020 04:00:10 +0000 (21:00 -0700)
committerGitHub <noreply@github.com>
Tue, 5 May 2020 04:00:10 +0000 (04:00 +0000)
* Fix ERROR_PARTIAL_COPY retry. MiniDumpWriteDump sets the last error to the HRESULT instead of win32 error code

* Fix createdump crash triggering on x86 runtime. The initialization code
was in the wrong place and not being called on the x86 coreclr.dll. Moved
it to early in EEStartupHelper.

src/coreclr/src/debug/createdump/createdumpwindows.cpp
src/coreclr/src/vm/ceemain.cpp
src/coreclr/src/vm/exceptionhandling.cpp

index 61e98ba..d806330 100644 (file)
@@ -41,9 +41,9 @@ CreateDump(const char* dumpPath, int pid, MINIDUMP_TYPE minidumpType)
         else
         {
             int err = GetLastError();
-            if (err != ERROR_PARTIAL_COPY)
+            if (err != HRESULT_FROM_WIN32(ERROR_PARTIAL_COPY))
             {
-                fprintf(stderr, "Write dump FAILED %d\n", err);
+                fprintf(stderr, "Write dump FAILED 0x%08x\n", err);
                 break;
             }
         }
index 3b9ebeb..ee67d1e 100644 (file)
@@ -644,6 +644,11 @@ void EEStartupHelper()
         IfFailGo(EEConfig::Setup());
 
 #ifndef CROSSGEN_COMPILE
+
+#ifdef HOST_WINDOWS
+        InitializeCrashDump();
+#endif // HOST_WINDOWS
+
         // Initialize Numa and CPU group information
         // Need to do this as early as possible. Used by creating object handle
         // table inside Ref_Initialization() before GC is initialized.
index 1612f39..740678e 100644 (file)
@@ -241,9 +241,6 @@ void InitializeExceptionHandling()
     // Register handler for termination requests (e.g. SIGTERM)
     PAL_SetTerminationRequestHandler(HandleTerminationRequest);
 #endif // TARGET_UNIX
-#ifdef HOST_WINDOWS
-    InitializeCrashDump();
-#endif // HOST_WINDOWS
 }
 
 struct UpdateObjectRefInResumeContextCallbackState