Skip to content
16 changes: 15 additions & 1 deletion src/coreclr/nativeaot/Runtime/unix/PalCreateDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
const char* g_argvCreateDump[MAX_ARGV_ENTRIES] = { nullptr };
char* g_szCreateDumpPath = nullptr;
char* g_ppidarg = nullptr;
bool g_warnCreateDumpMissing = false;

const char* g_createDumpMissingMessage = "DOTNET_DbgEnableMiniDump is set and the createdump binary does not exist\n";

const size_t MaxUnsigned32BitDecString = STRING_LENGTH("4294967295");
const size_t MaxUnsigned64BitDecString = STRING_LENGTH("18446744073709551615");
Expand Down Expand Up @@ -131,6 +134,10 @@ BuildCreateDumpCommandLine(
{
if (g_szCreateDumpPath == nullptr || g_ppidarg == nullptr)
{
if (g_warnCreateDumpMissing)
{
fprintf(stderr, "%s", g_createDumpMissingMessage);
}
return false;
}

Expand Down Expand Up @@ -465,6 +472,11 @@ PalCreateCrashDumpIfEnabled(int signal, siginfo_t* siginfo, void* context, void*
free(signalAddressArg);
free(exceptionRecordArg);
}
else if (g_warnCreateDumpMissing)
{
// DOTNET_DbgEnableMiniDump was set but createdump binary was not found
fprintf(stderr, "%s", g_createDumpMissingMessage);
}
#endif // !defined(HOST_MACCATALYST) && !defined(HOST_IOS) && !defined(HOST_TVOS)
}

Expand Down Expand Up @@ -624,7 +636,9 @@ PalCreateDumpInitialize()
struct stat fileData;
if (stat(program, &fileData) == -1 || !S_ISREG(fileData.st_mode))
{
fprintf(stderr, "DOTNET_DbgEnableMiniDump is set and the createdump binary does not exist: %s\n", program);
// Createdump binary not found - set flag to warn if someone tries to create a dump
g_warnCreateDumpMissing = true;
free(program);
return true;
}
g_szCreateDumpPath = program;
Expand Down
Loading