Skip to content

Commit

Permalink
Merge pull request #353 from goruklu/RDK-54421
Browse files Browse the repository at this point in the history
RDK-54421: updated minidump plugin
  • Loading branch information
goruklu authored Dec 4, 2024
2 parents e8958e8 + c22fb17 commit 7581add
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion rdkPlugins/Minidump/source/Minidump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,32 @@ bool Minidump::postHalt()
*
* @return Destination minidump file path string
*/
#define FIREBOLT_STATE "fireboltState"
#define MINIDUMP_FN_SEPERATOR "<#=#>"

std::string Minidump::getDestinationFile()
{
// If an app crashes multiple times, a previous dump might still exist in the destination
// path. Append the current date/time to the filename to prevent conflicts
std::time_t currentTime = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
std::stringstream timeString;
timeString << std::put_time(std::localtime(&currentTime), "%FT%T");
std::string destFile;

std::string dir(mContainerConfig->rdk_plugins->minidump->data->destination_path);

return dir + "/" + mUtils->getContainerId() + "-" + timeString.str() + ".dmp";
std::map<std::string, std::string> annotations = mUtils->getAnnotations();

auto it = annotations.find(FIREBOLT_STATE);
if (it != annotations.end()) {
destFile = dir + "/" + mUtils->getContainerId() + MINIDUMP_FN_SEPERATOR + it->second.c_str() + MINIDUMP_FN_SEPERATOR + timeString.str() + ".dmp";
AI_LOG_INFO("Firebolt state: %s, minidump filename: %s", it->second.c_str(), destFile.c_str());
}else{
AI_LOG_INFO("Firebolt state not found");
destFile = dir + "/" + mUtils->getContainerId() + MINIDUMP_FN_SEPERATOR + timeString.str() + ".dmp";
}

return destFile;
}

/**
Expand Down

0 comments on commit 7581add

Please sign in to comment.