Misc createdump fixes (#49038)
authorMike McLaughlin <mikem@microsoft.com>
Thu, 4 Mar 2021 00:06:19 +0000 (16:06 -0800)
committerGitHub <noreply@github.com>
Thu, 4 Mar 2021 00:06:19 +0000 (16:06 -0800)
* Misc createdump fixes

* Fixed issue https://github.com/dotnet/runtime/issues/42589

* Code review feedback

src/coreclr/debug/createdump/crashinfounix.cpp
src/coreclr/debug/createdump/createdumpunix.cpp
src/coreclr/debug/createdump/dumpwriter.cpp

index 4c72cc7..d300d34 100644 (file)
@@ -262,7 +262,7 @@ CrashInfo::GetDSOInfo()
 void
 CrashInfo::VisitModule(uint64_t baseAddress, std::string& moduleName)
 {
-    if (baseAddress == 0 || baseAddress == m_auxvValues[AT_SYSINFO_EHDR] || baseAddress == m_auxvValues[AT_BASE]) {
+    if (baseAddress == 0 || baseAddress == m_auxvValues[AT_SYSINFO_EHDR]) {
         return;
     }
     if (m_coreclrPath.empty())
index 6ddc21a..da74dda 100644 (file)
@@ -45,6 +45,7 @@ CreateDump(const char* dumpPathTemplate, int pid, const char* dumpType, MINIDUMP
     }
     if (!dumpWriter.WriteDump())
     {
+        fprintf(stderr, "Writing dump FAILED\n");
         goto exit;
     }
     result = true;
index 677a8b0..14c144f 100644 (file)
@@ -219,8 +219,8 @@ DumpWriter::WriteDump()
 
                 // This can happen if the target process dies before createdump is finished
                 if (read == 0) {
-                    TRACE("ReadProcessMemory(%" PRIA PRIx64 ", %08x) return 0 bytes read\n", address, bytesToRead);
-                    break;
+                    fprintf(stderr, "ReadProcessMemory(%" PRIA PRIx64 ", %08x) returned 0 bytes read\n", address, bytesToRead);
+                    return false;
                 }
 
                 if (!WriteData(m_tempBuffer, read)) {