summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZdenek Prikryl <zprikryl@redhat.com>2009-02-25 17:43:39 +0100
committerZdenek Prikryl <zprikryl@redhat.com>2009-02-25 17:43:39 +0100
commit5a39c948a4da1aa2515e15dfdda5486f9a5c9e35 (patch)
tree1472c53d539c3de0d5eb274fb882795289f258d7 /lib
parentb0f7c3729302bf66f96eedecb8633ed8e196f122 (diff)
downloadabrt-5a39c948a4da1aa2515e15dfdda5486f9a5c9e35.tar.gz
abrt-5a39c948a4da1aa2515e15dfdda5486f9a5c9e35.tar.xz
abrt-5a39c948a4da1aa2515e15dfdda5486f9a5c9e35.zip
test
Diffstat (limited to 'lib')
-rw-r--r--lib/MiddleWare/MiddleWare.cpp40
-rw-r--r--lib/MiddleWare/MiddleWare.h7
-rw-r--r--lib/MiddleWare/test.cpp5
-rw-r--r--lib/Plugins/CCpp.cpp36
-rw-r--r--lib/Plugins/SQLite3.cpp8
5 files changed, 61 insertions, 35 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();
}
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index 2845688b..de832319 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -118,26 +118,24 @@ void CLanguageCCpp::GetIndependentBacktrace(const std::string& pBacktrace, std::
}
if (line[jj] == '#')
{
- // "#0 0x080483a8 in main () at sigsegv.c:6
- while(!isspace(line[jj]))
+ while(jj < line.length())
{
- jj++;
- }
- // " 0x080483a8 in main () at sigsegv.c:6
- while (isspace(line[jj]))
- {
- jj++;
- }
- // "0x080483a8 in main () at sigsegv.c:6
- while (isalnum(line[jj]))
- {
- jj++;
- }
- // " in main () at sigsegv.c:6
- while (jj < line.length())
- {
- pIndependentBacktrace += line[jj];
- jj++;
+ if (isspace(line[jj]))
+ {
+ jj++;
+ }
+ else if (line[jj] == '0' && line[jj+1] == 'x')
+ {
+ while (isalnum(line[jj]))
+ {
+ jj++;
+ }
+ }
+ else
+ {
+ pIndependentBacktrace += line[jj];
+ jj++;
+ }
}
}
ii++;
diff --git a/lib/Plugins/SQLite3.cpp b/lib/Plugins/SQLite3.cpp
index f272bf55..3a67badf 100644
--- a/lib/Plugins/SQLite3.cpp
+++ b/lib/Plugins/SQLite3.cpp
@@ -178,6 +178,10 @@ void CSQLite3::Delete(const std::string& pUUID, const std::string& pUID)
"WHERE "DATABASE_COLUMN_UUID" = '"+pUUID+"' "
"AND "DATABASE_COLUMN_UID" = '"+pUID+"';");
}
+ else
+ {
+ throw std::string("CSQLite3::SetReported(): UUID is not found in DB.");
+ }
}
void CSQLite3::SetReported(const std::string& pUUID, const std::string& pUID)
@@ -189,6 +193,10 @@ void CSQLite3::SetReported(const std::string& pUUID, const std::string& pUID)
"WHERE "DATABASE_COLUMN_UUID" = '"+pUUID+"' "
"AND "DATABASE_COLUMN_UID" = '"+pUID+"';");
}
+ else
+ {
+ throw std::string("CSQLite3::SetReported(): UUID is not found in DB.");
+ }
}
const vector_database_rows_t CSQLite3::GetUIDData(const std::string& pUID)