From 3f5dab65d20400a8633daae57be1269c6e584249 Mon Sep 17 00:00:00 2001 From: Nikola Pajkovsky Date: Mon, 21 Sep 2009 16:23:26 +0200 Subject: comments and how to reproduce are stored now --- lib/Utils/DebugDump.h | 3 ++- src/Daemon/MiddleWare.cpp | 29 +++++++++++++++++++++++++++++ src/Daemon/MiddleWare.h | 9 +++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/lib/Utils/DebugDump.h b/lib/Utils/DebugDump.h index 4b1ec8ed..5fbd617e 100644 --- a/lib/Utils/DebugDump.h +++ b/lib/Utils/DebugDump.h @@ -37,7 +37,8 @@ #define FILENAME_RELEASE "release" #define FILENAME_EXECUTABLE "executable" #define FILENAME_REASON "reason" - +#define FILENAME_COMMENTS "comment" +#define FILENAME_REPRODUCE "reproduce" class CDebugDump { diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index 6480ab57..30dd012c 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.cpp @@ -336,6 +336,24 @@ report_status_t Report(const map_crash_report_t& pCrashReport, std::string packageNVR = pCrashReport.find(FILENAME_PACKAGE)->second[CD_CONTENT]; std::string packageName = packageNVR.substr(0, packageNVR.rfind("-", packageNVR.rfind("-") - 1 )); + // Save comments and how to reproduciton + map_crash_report_t::const_iterator it_comment = pCrashReport.find(CD_COMMENT); + map_crash_report_t::const_iterator it_reproduce = pCrashReport.find(CD_REPRODUCE); + std::cout << "save reproduce " << std::endl << it_reproduce->second[CD_CONTENT] << std::endl; + std::string pDumpDir = getDebugDumpDir(UUID,UID); + CDebugDump dd; + dd.Open(pDumpDir); + if ( it_comment != pCrashReport.end() ) + { + std::cout << "save comment " << std::endl << it_comment->second[CD_CONTENT] << std::endl; + dd.SaveText(FILENAME_COMMENTS, it_comment->second[CD_CONTENT]); + } + if ( it_reproduce != pCrashReport.end() ) + { + std::cout << "save reproduce " << std::endl << it_reproduce->second[CD_CONTENT] << std::endl; + dd.SaveText(FILENAME_REPRODUCE, it_reproduce->second[CD_CONTENT]); + } + dd.Close(); // analyzer with package name (CCpp:xrog-x11-app) has higher priority key = analyzer + ":" + packageName; map_analyzer_actions_and_reporters_t::iterator keyPtr = s_mapAnalyzerActionsAndReporters.find(key); @@ -602,6 +620,17 @@ static mw_result_t SaveDebugDumpToDatabase(const std::string& pUUID, return res; } +std::string getDebugDumpDir( const std::string& pUUID, + const std::string& pUID) +{ + CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase); + database_row_t row; + database->Connect(); + row = database->GetUUIDData(pUUID, pUID); + database->DisConnect(); + return row.m_sDebugDumpDir; +} + mw_result_t SaveDebugDump(const std::string& pDebugDumpDir) { map_crash_info_t info; diff --git a/src/Daemon/MiddleWare.h b/src/Daemon/MiddleWare.h index 86d59396..bc80952a 100644 --- a/src/Daemon/MiddleWare.h +++ b/src/Daemon/MiddleWare.h @@ -93,6 +93,15 @@ void RunActionsAndReporters(const std::string& pDebugDumpDir); */ report_status_t Report(const map_crash_report_t& pCrashReport, const std::string& pUID); +/** + * Get debugdump direcotory. If debugdump is not found + * in database it will return empty string. + * @param pUUID A local UUID of a crash. + * @param pUID An UID of an user. + * @return A debugdump directory. + */ +std::string getDebugDumpDir( const std::string& pUUID, + const std::string& pUID); /** * Deletes particular debugdump directory. * @param pDebugDumpDir A debugdump directory. -- cgit