diff options
Diffstat (limited to 'lib/MiddleWare')
-rw-r--r-- | lib/MiddleWare/MiddleWare.cpp | 40 | ||||
-rw-r--r-- | lib/MiddleWare/MiddleWare.h | 7 | ||||
-rw-r--r-- | lib/MiddleWare/test.cpp | 5 |
3 files changed, 36 insertions, 16 deletions
diff --git a/lib/MiddleWare/MiddleWare.cpp b/lib/MiddleWare/MiddleWare.cpp index 19cbf8b8..1f50ed18 100644 --- a/lib/MiddleWare/MiddleWare.cpp +++ b/lib/MiddleWare/MiddleWare.cpp @@ -109,6 +109,7 @@ void CMiddleWare::DebugDump2Report(const std::string& pDebugDumpDir, crash_repor dd.LoadText(FILENAME_PACKAGE, pCrashReport.m_sPackage); dd.LoadText(FILENAME_EXECUTABLE, pCrashReport.m_sExecutable); dd.LoadText(FILENAME_CMDLINE, pCrashReport.m_sCmdLine); + dd.LoadText(FILENAME_RELEASE, pCrashReport.m_sRelease); if (dd.Exist(FILENAME_TEXTDATA1)) { @@ -184,7 +185,6 @@ void CMiddleWare::CreateReportApplication(const std::string& pApplication, void CMiddleWare::CreateReport(const std::string& pUUID, const std::string& pUID, - crash_context_t& pCrashContext, crash_report_t& pCrashReport) { CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase); @@ -193,7 +193,7 @@ void CMiddleWare::CreateReport(const std::string& pUUID, row = database->GetUUIDData(pUUID, pUID); database->DisConnect(); - if (row.m_sUUID != pUUID) + if (pUUID == "" || row.m_sUUID != pUUID) { throw std::string("CMiddleWare::CreateReport(): UUID '"+pUUID+"' is not in database."); } @@ -219,15 +219,25 @@ void CMiddleWare::CreateReport(const std::string& pUUID, DebugDump2Report(row.m_sDebugDumpDir, pCrashReport); - pCrashContext.m_sLanAppPlugin = appLan; - pCrashContext.m_sUUID = pUUID; - pCrashContext.m_sUID = pUID; + pCrashReport.m_sMWID = appLan + ";" + pUID + ";" + pUUID ; } -void CMiddleWare::Report(const crash_context_t& pCrashContext, - const crash_report_t& pCrashReport) +void CMiddleWare::Report(const crash_report_t& pCrashReport) { - std::string lanAppPlugin = pCrashContext.m_sLanAppPlugin; + std::string::size_type pos1 = 0; + std::string::size_type pos2 = pCrashReport.m_sMWID.find(";", pos1); + std::string lanAppPlugin = pCrashReport.m_sMWID.substr(pos1, pos2); + pos1 = pos2 + 1; + pos2 = pCrashReport.m_sMWID.find(";", pos1); + std::string UID = pCrashReport.m_sMWID.substr(pos1, pos2); + pos1 = pos2 + 1; + std::string UUID = pCrashReport.m_sMWID.substr(pos1);; + + CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase); + database->Connect(); + database->SetReported(UUID, UID); + database->DisConnect(); + if (m_mapPlugin2Reporters.find(lanAppPlugin) != m_mapPlugin2Reporters.end()) { set_reporters_t::iterator it_r; @@ -239,13 +249,23 @@ void CMiddleWare::Report(const crash_context_t& pCrashContext, reporter->Report(pCrashReport); } } +} +void CMiddleWare::DeleteDebugDump(const std::string& pUUID, + const std::string& pUID) +{ + database_row_t row; CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase); database->Connect(); - database->SetReported(pCrashContext.m_sUUID, pCrashContext.m_sUID); + row = database->GetUUIDData(pUUID, pUID); + database->Delete(pUUID, pUID); database->DisConnect(); + CDebugDump dd; + dd.Open(row.m_sDebugDumpDir); + dd.Delete(); + dd.Close(); } -#include <iostream> + int CMiddleWare::SaveDebugDump(const std::string& pDebugDumpDir, crash_info_t& pCrashInfo) { CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase); diff --git a/lib/MiddleWare/MiddleWare.h b/lib/MiddleWare/MiddleWare.h index f0b263ab..a492257b 100644 --- a/lib/MiddleWare/MiddleWare.h +++ b/lib/MiddleWare/MiddleWare.h @@ -79,11 +79,12 @@ class CMiddleWare void CreateReport(const std::string& pUUID, const std::string& pUID, - crash_context_t& pCrashContext, crash_report_t& pCrashReport); - void Report(const crash_context_t& pCrashContext, - const crash_report_t& pCrashReport); + void Report(const crash_report_t& pCrashReport); + + void DeleteDebugDump(const std::string& pUUID, + const std::string& pUID); int SaveDebugDump(const std::string& pDebugDumpDir, crash_info_t& pCrashInfo); vector_crash_infos_t GetCrashInfos(const std::string& pUID); diff --git a/lib/MiddleWare/test.cpp b/lib/MiddleWare/test.cpp index 02312790..e21da3a2 100644 --- a/lib/MiddleWare/test.cpp +++ b/lib/MiddleWare/test.cpp @@ -57,11 +57,10 @@ int main(int argc, char** argv) /* Get Report, so user can change data (remove private stuff) * If we do not want user interaction, just send data immediately */ - crash_context_t crashContext; crash_report_t crashReport; - middleWare.CreateReport(crashInfo.m_sUUID, crashInfo.m_sUID, crashContext, crashReport); + middleWare.CreateReport(crashInfo.m_sUUID, crashInfo.m_sUID, crashReport); /* Report crash */ - middleWare.Report(crashContext, crashReport); + middleWare.Report(crashReport); } dd.Close(); } |