diff --git a/projects/clr/rocclr/compiler/lib/utils/options.cpp b/projects/clr/rocclr/compiler/lib/utils/options.cpp index 14e2eb1d72..c8d004bbf7 100644 --- a/projects/clr/rocclr/compiler/lib/utils/options.cpp +++ b/projects/clr/rocclr/compiler/lib/utils/options.cpp @@ -1513,8 +1513,20 @@ static std::string getValidDumpBaseName(const std::string &path, const std::stri void Options::setDumpFileName(const char* val) { + std::string dumpPrefix = oVariables->DumpPrefix; + const size_t pidPos = dumpPrefix.find("%pid%"); + if (pidPos != std::string::npos) { +#ifdef _WIN32 + const std::int32_t pid = _getpid(); +#endif +#ifdef __linux__ + const std::int32_t pid = getpid(); +#endif + dumpPrefix.replace(pidPos, 5, std::to_string(pid)); + } + std::stringstream prefix; - prefix << oVariables->DumpPrefix << "_" << buildNo << "_" << val; + prefix << dumpPrefix << "_" << buildNo << "_" << val; dumpFileRoot = prefix.str(); // Check whether the length of path meets the system limits diff --git a/projects/clr/rocclr/compiler/lib/utils/options.hpp b/projects/clr/rocclr/compiler/lib/utils/options.hpp index f721f58869..cdbec7870c 100644 --- a/projects/clr/rocclr/compiler/lib/utils/options.hpp +++ b/projects/clr/rocclr/compiler/lib/utils/options.hpp @@ -16,6 +16,7 @@ #include #endif #ifdef _WIN32 +#include #include #endif