summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-09-07 18:36:29 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-09-07 18:36:29 +0200
commit76585105247365dd9f84997d933eeabd4303aabd (patch)
treeee3dc9315b1e8f204b486b12913e81970c6af3b4
parentcaef0b615fc0cc11de65fae634bd9674b0c634d2 (diff)
downloadabrt-76585105247365dd9f84997d933eeabd4303aabd.tar.gz
abrt-76585105247365dd9f84997d933eeabd4303aabd.tar.xz
abrt-76585105247365dd9f84997d933eeabd4303aabd.zip
preparatory work for proper (i.e. unicast) server->client dbus communication
+ /* send unicast dbus signal */ + if (!dbus_message_set_destination(msg, pDest)) + die_out_of_memory(); Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--lib/Plugins/CCpp.cpp31
-rw-r--r--src/Daemon/CommLayerServerDBus.cpp13
-rw-r--r--src/Daemon/CrashWatcher.cpp3
-rw-r--r--src/Daemon/Daemon.cpp3
-rw-r--r--src/Daemon/MiddleWare.cpp22
5 files changed, 48 insertions, 24 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index 2d0326c..995ddbe 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -428,22 +428,24 @@ std::string CAnalyzerCCpp::GetLocalUUID(const std::string& pDebugDumpDir)
{
update_client(_("Getting local universal unique identification..."));
- CDebugDump dd;
std::string UID;
std::string executable;
std::string package;
std::string buildIdPC;
std::string independentBuildIdPC;
- std::string core = "--core="+ pDebugDumpDir + "/" +FILENAME_COREDUMP;
+ std::string core = "--core=" + pDebugDumpDir + "/"FILENAME_COREDUMP;
char* command = (char*)"eu-unstrip";
char* args[4] = { (char*)"eu-unstrip", NULL, (char*)"-n", NULL };
args[1] = (char*)core.c_str();
+
+ CDebugDump dd;
dd.Open(pDebugDumpDir);
dd.LoadText(FILENAME_UID, UID);
dd.LoadText(FILENAME_EXECUTABLE, executable);
dd.LoadText(FILENAME_PACKAGE, package);
ExecVP(command, args, atoi(UID.c_str()), buildIdPC);
dd.Close();
+
GetIndependentBuildIdPC(buildIdPC, independentBuildIdPC);
return CreateHash(package + executable + independentBuildIdPC);
}
@@ -484,14 +486,13 @@ void CAnalyzerCCpp::CreateReport(const std::string& pDebugDumpDir)
dd.Close();
map_plugin_settings_t settings = GetSettings();
- if( settings["InstallDebuginfo"] == "yes" )
+ if (settings["InstallDebuginfo"] == "yes")
{
InstallDebugInfos(package);
}
- else {
- char buffer[1024];
- snprintf(buffer,1024, _("Skip debuginfo installation for package %s"), package.c_str());
- warn_client(std::string(buffer));
+ else
+ {
+ warn_client(ssprintf(_("Skip debuginfo installation for package %s"), package.c_str()));
}
GetBacktrace(pDebugDumpDir, backtrace);
@@ -554,17 +555,21 @@ void CAnalyzerCCpp::DeInit()
void CAnalyzerCCpp::SetSettings(const map_plugin_settings_t& pSettings)
{
- if (pSettings.find("MemoryMap") != pSettings.end())
+ map_plugin_settings_t::const_iterator end = pSettings.end();
+ map_plugin_settings_t::const_iterator it = pSettings.find("MemoryMap");
+ if (it != end)
{
- m_bMemoryMap = pSettings.find("MemoryMap")->second == "yes";
+ m_bMemoryMap = it->second == "yes";
}
- if (pSettings.find("DebugInfo") != pSettings.end())
+ it = pSettings.find("DebugInfo");
+ if (it != end)
{
- m_sDebugInfo = pSettings.find("DebugInfo")->second;
+ m_sDebugInfo = it->second;
}
- if (pSettings.find("InstallDebuginfo") != pSettings.end())
+ it = pSettings.find("InstallDebuginfo");
+ if (it != end)
{
- m_bInstallDebuginfo = pSettings.find("InstallDebuginfo")->second == "yes";
+ m_bInstallDebuginfo = it->second == "yes";
}
}
diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp
index c3cef3b..051a4b2 100644
--- a/src/Daemon/CommLayerServerDBus.cpp
+++ b/src/Daemon/CommLayerServerDBus.cpp
@@ -363,6 +363,7 @@ void CCommLayerServerDBus::Crash(const std::string& progname, const std::string&
DBUS_TYPE_STRING, &c_progname,
DBUS_TYPE_STRING, &c_uid,
DBUS_TYPE_INVALID);
+ VERB2 log("Sending signal Crash('%s','%s')", c_progname, c_uid);
send_flush_and_unref(msg);
}
@@ -373,28 +374,35 @@ void CCommLayerServerDBus::AnalyzeComplete(const map_crash_report_t& arg1)
DBusMessageIter out_iter;
dbus_message_iter_init_append(msg, &out_iter);
store_val(&out_iter, arg1);
+ VERB2 log("Sending signal AnalyzeComplete([%d elements])", (int)arg1.size());
send_flush_and_unref(msg);
}
void CCommLayerServerDBus::JobDone(const char* pDest, uint64_t job_id)
{
DBusMessage* msg = new_signal_msg("JobDone");
- /* TODO: if (!dbus_message_set_destination(msg, pDest) die_out_of_memory(); */
+ /* send unicast dbus signal */
+ if (!dbus_message_set_destination(msg, pDest))
+ die_out_of_memory();
dbus_message_append_args(msg,
DBUS_TYPE_STRING, &pDest, /* TODO: redundant parameter, remove from API */
DBUS_TYPE_UINT64, &job_id,
DBUS_TYPE_INVALID);
+ VERB2 log("Sending signal JobDone('%s',%llx)", pDest, (unsigned long long)job_id);
send_flush_and_unref(msg);
}
void CCommLayerServerDBus::JobStarted(const char* pDest, uint64_t job_id)
{
DBusMessage* msg = new_signal_msg("JobStarted");
- /* TODO: if (!dbus_message_set_destination(msg, pDest) die_out_of_memory(); */
+ /* send unicast dbus signal */
+ if (!dbus_message_set_destination(msg, pDest))
+ die_out_of_memory();
dbus_message_append_args(msg,
DBUS_TYPE_STRING, &pDest, /* TODO: redundant parameter, remove from API */
DBUS_TYPE_UINT64, &job_id,
DBUS_TYPE_INVALID);
+ VERB2 log("Sending signal JobStarted('%s',%llx)", pDest, (unsigned long long)job_id);
send_flush_and_unref(msg);
}
@@ -419,6 +427,7 @@ void CCommLayerServerDBus::Update(const std::string& pMessage, uint64_t job_id)
send_flush_and_unref(msg);
}
+/* TODO: one Warning()? */
void CCommLayerServerDBus::Warning(const std::string& pMessage)
{
DBusMessage* msg = new_signal_msg("Warning");
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp
index 06afabd..1b17af6 100644
--- a/src/Daemon/CrashWatcher.cpp
+++ b/src/Daemon/CrashWatcher.cpp
@@ -142,6 +142,7 @@ static void *create_report(void *arg)
pthread_mutex_lock(&g_pJobsMutex);
g_pending_jobs[std::string(thread_data->UID)][uint64_t(thread_data->thread_id)] = crashReport;
pthread_mutex_unlock(&g_pJobsMutex);
+
g_pCommLayer->JobDone(thread_data->dest, uint64_t(thread_data->thread_id));
}
catch (CABRTException& e)
@@ -179,7 +180,7 @@ uint64_t CreateReport_t(const char* pUUID, const char* pUID, const char* pSender
free(thread_data->dest);
free(thread_data);
/* The only reason this may happen is system-wide resource starvation,
- * or ulimit is exceeded (someoune floods us with CreateReport() dbus calls?)
+ * or ulimit is exceeded (someone floods us with CreateReport() dbus calls?)
*/
error_msg("cannot create thread");
return 0;
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index fc28e8b..149b2bd 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -503,7 +503,8 @@ static gboolean handle_event_cb(GIOChannel *gio, GIOCondition condition, gpointe
/* ignore lock files and such */
if (!(event->mask & IN_ISDIR))
{
- VERB3 log("File '%s' creation detected, ignoring", name);
+ // Happens all the time during normal run
+ //VERB3 log("File '%s' creation detected, ignoring", name);
continue;
}
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index e6c9187..4f499d6 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -173,33 +173,42 @@ mw_result_t CreateCrashReport(const std::string& pUUID,
const std::string& pUID,
map_crash_report_t& pCrashReport)
{
- CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase);
- database_row_t row;
- database->Connect();
- row = database->GetUUIDData(pUUID, pUID);
- database->DisConnect();
- CDebugDump dd;
+ VERB2 log("CreateCrashReport('%s','%',result)", pUUID.c_str(), pUID.c_str());
+ database_row_t row;
+ if (pUUID != "")
+ {
+ CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase);
+ database->Connect();
+ row = database->GetUUIDData(pUUID, pUID);
+ database->DisConnect();
+ }
if (pUUID == "" || row.m_sUUID != pUUID)
{
warn_client("CreateCrashReport(): UUID '"+pUUID+"' is not in database.");
return MW_IN_DB_ERROR;
}
+ CDebugDump dd;
try
{
std::string analyzer;
std::string gUUID;
+ VERB3 log(" LoadText(FILENAME_ANALYZER,'%s')", row.m_sDebugDumpDir.c_str());
dd.Open(row.m_sDebugDumpDir);
dd.LoadText(FILENAME_ANALYZER, analyzer);
dd.Close();
+ VERB3 log(" CreateReport('%s')", analyzer.c_str());
CreateReport(analyzer, row.m_sDebugDumpDir);
gUUID = GetGlobalUUID(analyzer, row.m_sDebugDumpDir);
+ VERB3 log(" GetGlobalUUID:'%s'", gUUID.c_str());
+ VERB3 log(" RunAnalyzerActions");
RunAnalyzerActions(analyzer, row.m_sDebugDumpDir);
+ VERB3 log(" DebugDumpToCrashReport");
DebugDumpToCrashReport(row.m_sDebugDumpDir, pCrashReport);
add_crash_data_to_crash_report(pCrashReport, CD_UUID, CD_TXT, CD_ISNOTEDITABLE, gUUID);
@@ -245,7 +254,6 @@ void RunAction(const std::string& pActionDir,
warn_client("RunAction(): " + e.what());
update_client("Execution of '"+pPluginName+"' was not successful: " + e.what());
}
-
}
void RunActionsAndReporters(const std::string& pDebugDumpDir)