Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/coreclr/src/debug/createdump/createdumpunix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/src/debug/createdump/dumpwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,24 +203,24 @@ DumpWriter::WriteDump()
// Only write the regions that are backed by memory
if (memoryRegion.IsBackedByMemory())
{
uint32_t size = memoryRegion.Size();
uint64_t address = memoryRegion.StartAddress();
size_t size = memoryRegion.Size();
total += size;

while (size > 0)
{
uint32_t bytesToRead = std::min(size, (uint32_t)sizeof(m_tempBuffer));
size_t bytesToRead = std::min(size, sizeof(m_tempBuffer));
size_t read = 0;

if (!m_crashInfo.ReadProcessMemory((void*)address, m_tempBuffer, bytesToRead, &read)) {
fprintf(stderr, "ReadProcessMemory(%" PRIA PRIx64 ", %08x) FAILED\n", address, bytesToRead);
fprintf(stderr, "ReadProcessMemory(%" PRIA PRIx64 ", %08zx) FAILED\n", address, bytesToRead);
return false;
}

// 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 ", %08zx) returned 0 bytes read\n", address, bytesToRead);
return false;
}

if (!WriteData(m_tempBuffer, read)) {
Expand Down