summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-07 12:37:45 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-07 12:37:45 +0100
commit6b36135970dd9ba4694e626e3fbd8166c64d8cdc (patch)
tree09468c7403bdd77ceddb02ac3571e83a6a504406
parent9fa0918b822b4d81a8adf7392c4e18e87d351872 (diff)
downloadabrt-6b36135970dd9ba4694e626e3fbd8166c64d8cdc.tar.gz
abrt-6b36135970dd9ba4694e626e3fbd8166c64d8cdc.tar.xz
abrt-6b36135970dd9ba4694e626e3fbd8166c64d8cdc.zip
ccpp: add a possibility to disable backtrace generation
+ assorted minor tweaks Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--lib/Plugins/CCpp.conf3
-rw-r--r--lib/Plugins/CCpp.cpp147
-rw-r--r--lib/Plugins/CCpp.h1
-rw-r--r--lib/Plugins/Firefox.cpp23
-rw-r--r--lib/Plugins/Firefox.h1
-rw-r--r--lib/Plugins/Mailx.cpp2
-rw-r--r--lib/Plugins/Python.cpp1
-rw-r--r--lib/Utils/make_descr.cpp1
-rw-r--r--src/Daemon/abrt.conf15
-rw-r--r--src/Gui/CCMainWindow.py2
10 files changed, 116 insertions, 80 deletions
diff --git a/lib/Plugins/CCpp.conf b/lib/Plugins/CCpp.conf
index e42b85a..dfdbec8 100644
--- a/lib/Plugins/CCpp.conf
+++ b/lib/Plugins/CCpp.conf
@@ -4,6 +4,9 @@
# in crashed process' current dir, set to "yes"
MakeCompatCore = no
+# Generate backtrace
+Backtrace = yes
+
# Generate memory map too (IGNORED FOR NOW)
MemoryMap = no
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index a5315b7..1a01c01 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -46,6 +46,7 @@ using namespace std;
#define DEBUGINFO_CACHE_DIR LOCALSTATEDIR"/cache/abrt-di"
CAnalyzerCCpp::CAnalyzerCCpp() :
+ m_bBacktrace(true),
m_bMemoryMap(false),
m_bInstallDebugInfo(true),
m_nDebugInfoCacheMB(4000)
@@ -157,7 +158,7 @@ static int ExecVP(char **pArgs, uid_t uid, int redirect_stderr, string& pOutput)
close(pipeout[0]);
int status;
- wait(&status); /* prevent having zombie child process */
+ waitpid(child, &status, 0); /* prevent having zombie child process */
return status;
}
@@ -410,7 +411,7 @@ static void InstallDebugInfos(const char *pDebugDumpDir,
if (pipeout_fp == NULL) /* never happens */
{
close(pipeout[0]);
- wait(NULL);
+ waitpid(child, NULL, 0);
return;
}
@@ -544,7 +545,7 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir)
{
log(_("Getting global universal unique identification..."));
- string backtrace_path = (string)pDebugDumpDir + "/" + FILENAME_BACKTRACE;
+ string backtrace_path = concat_path_file(pDebugDumpDir, FILENAME_BACKTRACE);
string executable;
string package;
string uid_str;
@@ -553,74 +554,82 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir)
dd.Open(pDebugDumpDir);
dd.LoadText(FILENAME_EXECUTABLE, executable);
dd.LoadText(FILENAME_PACKAGE, package);
- dd.LoadText(FILENAME_UID, uid_str);
+ if (m_bBacktrace)
+ dd.LoadText(FILENAME_UID, uid_str);
}
- /* Run abrt-backtrace to get independent backtrace suitable
- to UUID calculation. */
- char *args[7];
- args[0] = (char*)"abrt-backtrace";
- args[1] = (char*)"--single-thread";
- args[2] = (char*)"--remove-exit-handlers";
- args[3] = (char*)"--frame-depth=5";
- args[4] = (char*)"--remove-noncrash-frames";
- args[5] = (char*)backtrace_path.c_str();
- args[6] = NULL;
-
- int pipeout[2];
- xpipe(pipeout); /* stdout of abrt-backtrace */
- pid_t child = fork();
- if (child == -1)
- perror_msg_and_die("fork");
- if (child == 0)
- {
- VERB1 log("Executing: %s", concat_str_vector(args).c_str());
-
- xmove_fd(pipeout[1], STDOUT_FILENO);
- close(pipeout[0]); /* read side of the pipe */
-
- /* abrt-backtrace is executed under the user's uid and gid. */
- uid_t uid = xatoi_u(uid_str.c_str());
- struct passwd* pw = getpwuid(uid);
- gid_t gid = pw ? pw->pw_gid : uid;
- setgroups(1, &gid);
- xsetregid(gid, gid);
- xsetreuid(uid, uid);
+ string independent_backtrace;
+ if (m_bBacktrace)
+ {
+ /* Run abrt-backtrace to get independent backtrace suitable
+ to UUID calculation. */
+ char *args[7];
+ args[0] = (char*)"abrt-backtrace";
+ args[1] = (char*)"--single-thread";
+ args[2] = (char*)"--remove-exit-handlers";
+ args[3] = (char*)"--frame-depth=5";
+ args[4] = (char*)"--remove-noncrash-frames";
+ args[5] = (char*)backtrace_path.c_str();
+ args[6] = NULL;
+
+ int pipeout[2];
+ xpipe(pipeout); /* stdout of abrt-backtrace */
+ pid_t child = fork();
+ if (child == -1)
+ perror_msg_and_die("fork");
+ if (child == 0)
+ {
+ VERB1 log("Executing: %s", concat_str_vector(args).c_str());
+
+ xmove_fd(pipeout[1], STDOUT_FILENO);
+ close(pipeout[0]); /* read side of the pipe */
+
+ /* abrt-backtrace is executed under the user's uid and gid. */
+ uid_t uid = xatoi_u(uid_str.c_str());
+ struct passwd* pw = getpwuid(uid);
+ gid_t gid = pw ? pw->pw_gid : uid;
+ setgroups(1, &gid);
+ xsetregid(gid, gid);
+ xsetreuid(uid, uid);
+
+ execvp(args[0], args);
+ VERB1 perror_msg("Can't execute '%s'", args[0]);
+ exit(1);
+ }
- execvp(args[0], args);
- VERB1 perror_msg("Can't execute '%s'", args[0]);
- exit(1);
- }
+ close(pipeout[1]); /* write side of the pipe */
- close(pipeout[1]); /* write side of the pipe */
+ /* Read the result from abrt-backtrace. */
+ int r;
+ char buff[1024];
+ while ((r = safe_read(pipeout[0], buff, sizeof(buff) - 1)) > 0)
+ {
+ buff[r] = '\0';
+ independent_backtrace += buff;
+ }
+ close(pipeout[0]);
- /* Read the result from abrt-backtrace. */
- int r;
- char buff[1024];
- string independent_backtrace;
- while ((r = read(pipeout[0], buff, sizeof(buff) - 1)) > 0)
- {
- buff[r] = '\0';
- independent_backtrace += buff;
- }
- close(pipeout[0]);
+ /* Wait until it exits, and check the exit status. */
+ errno = 0;
+ int status;
+ waitpid(child, &status, 0);
+ if (!WIFEXITED(status))
+ {
+ perror_msg("abrt-backtrace not executed properly, "
+ "status: %x signal: %d", status, WIFSIGNALED(status));
+ } else
+ {
+ int exit_status = WEXITSTATUS(status);
+ if (exit_status != 0)
+ {
+ error_msg("abrt-backtrace run failed, exit value: %d",
+ exit_status);
+ }
+ }
- /* Wait until it ends, and check the exit status. */
- int status;
- wait(&status); /* prevent having zombie child process */
- if (!WIFEXITED(status))
- {
- perror_msg_and_die("abrt-backtrace not executed properly, "
- "status: %x", status);
- }
- int exit_status = WEXITSTATUS(status);
- if (exit_status > 0 && exit_status <= EX__MAX)
- {
- error_msg_and_die("abrt-backtrace run failed, exit value: %d",
- exit_status);
+ /*VERB1 log("abrt-backtrace result: %s", independent_backtrace.c_str());*/
}
-
- /*VERB1 log("abrt-backtrace result: %s", independent_backtrace.c_str());*/
+ /* else: no backtrace, independent_backtrace == "" */
string hash_base = package + executable + independent_backtrace;
return CreateHash(hash_base.c_str());
@@ -661,6 +670,11 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force)
CDebugDump dd;
dd.Open(pDebugDumpDir);
+ if (!m_bBacktrace)
+ {
+ return;
+ }
+
if (!force)
{
bool bt_exists = dd.Exist(FILENAME_BACKTRACE);
@@ -753,6 +767,11 @@ void CAnalyzerCCpp::SetSettings(const map_plugin_settings_t& pSettings)
map_plugin_settings_t::const_iterator end = pSettings.end();
map_plugin_settings_t::const_iterator it;
+ it = pSettings.find("Backtrace");
+ if (it != end)
+ {
+ m_bBacktrace = string_to_bool(it->second.c_str());
+ }
it = pSettings.find("MemoryMap");
if (it != end)
{
diff --git a/lib/Plugins/CCpp.h b/lib/Plugins/CCpp.h
index 26dedea..03ba5ee 100644
--- a/lib/Plugins/CCpp.h
+++ b/lib/Plugins/CCpp.h
@@ -30,6 +30,7 @@
class CAnalyzerCCpp : public CAnalyzer
{
private:
+ bool m_bBacktrace;
bool m_bMemoryMap;
bool m_bInstallDebugInfo;
unsigned m_nDebugInfoCacheMB;
diff --git a/lib/Plugins/Firefox.cpp b/lib/Plugins/Firefox.cpp
index ab2ea8a..92ef4e5 100644
--- a/lib/Plugins/Firefox.cpp
+++ b/lib/Plugins/Firefox.cpp
@@ -43,6 +43,7 @@
#define DEBUGINFO_CACHE_DIR LOCALSTATEDIR"/cache/abrt-di"
CAnalyzerFirefox::CAnalyzerFirefox() :
+ m_bBacktrace(true),
m_bMemoryMap(false),
m_bInstallDebugInfo(true),
m_nDebugInfoCacheMB(4000)
@@ -148,7 +149,7 @@ static pid_t ExecVP(char** pArgs, uid_t uid, std::string& pOutput)
}
close(pipeout[0]);
- wait(NULL); /* prevent having zombie child process */
+ waitpid(child, NULL, 0); /* prevent having zombie child process */
return 0;
}
@@ -608,7 +609,7 @@ Another application is holding the yum lock, cannot continue
if (pipeout_fp == NULL) /* never happens */
{
close(pipeout[0]);
- wait(NULL);
+ waitpid(child, NULL, 0);
return;
}
@@ -652,14 +653,14 @@ Another application is holding the yum lock, cannot continue
{
fclose(pipeout_fp);
kill(child, SIGTERM);
- wait(NULL);
+ waitpid(child, NULL, 0);
throw CABRTException(EXCEP_PLUGIN, "%s: can't install debuginfos for %s", __func__, pPackage);
}
#endif
}
fclose(pipeout_fp);
- wait(NULL);
+ waitpid(child, NULL, 0);
}
#endif
/* Needs gdb feature from here: https://bugzilla.redhat.com/show_bug.cgi?id=528668
@@ -704,7 +705,7 @@ static void InstallDebugInfos(const char *pDebugDumpDir, std::string& build_ids)
if (pipeout_fp == NULL) /* never happens */
{
close(pipeout[0]);
- wait(NULL);
+ waitpid(child, NULL, 0);
return;
}
@@ -735,7 +736,7 @@ static void InstallDebugInfos(const char *pDebugDumpDir, std::string& build_ids)
}
fclose(pipeout_fp);
- wait(NULL);
+ waitpid(child, NULL, 0);
}
static double get_dir_size(const char *dirname, std::string *worst_file, double *maxsz)
@@ -873,6 +874,11 @@ void CAnalyzerFirefox::CreateReport(const char *pDebugDumpDir, int force)
CDebugDump dd;
dd.Open(pDebugDumpDir);
+ if (!m_bBacktrace)
+ {
+ return;
+ }
+
if (!force)
{
bool bt_exists = dd.Exist(FILENAME_BACKTRACE);
@@ -962,6 +968,11 @@ void CAnalyzerFirefox::SetSettings(const map_plugin_settings_t& pSettings)
map_plugin_settings_t::const_iterator end = pSettings.end();
map_plugin_settings_t::const_iterator it;
+ it = pSettings.find("Backtrace");
+ if (it != end)
+ {
+ m_bBacktrace = string_to_bool(it->second.c_str());
+ }
it = pSettings.find("MemoryMap");
if (it != end)
{
diff --git a/lib/Plugins/Firefox.h b/lib/Plugins/Firefox.h
index 0669f4f..dd7758d 100644
--- a/lib/Plugins/Firefox.h
+++ b/lib/Plugins/Firefox.h
@@ -30,6 +30,7 @@
class CAnalyzerFirefox : public CAnalyzer
{
private:
+ bool m_bBacktrace;
bool m_bMemoryMap;
bool m_bInstallDebugInfo;
unsigned m_nDebugInfoCacheMB;
diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp
index 6904c16..70eddb8 100644
--- a/lib/Plugins/Mailx.cpp
+++ b/lib/Plugins/Mailx.cpp
@@ -68,7 +68,7 @@ static void exec_and_feed_input(uid_t uid, const char* pText, char **pArgs)
safe_write(pipein[1], pText, strlen(pText));
close(pipein[1]);
- wait(NULL); /* wait for command completion */
+ waitpid(child, NULL, 0); /* wait for command completion */
}
static char** append_str_to_vector(char **vec, unsigned &size, const char *str)
diff --git a/lib/Plugins/Python.cpp b/lib/Plugins/Python.cpp
index 906e815..23d6f5c 100644
--- a/lib/Plugins/Python.cpp
+++ b/lib/Plugins/Python.cpp
@@ -1,4 +1,3 @@
-#include <fstream>
#include "Python.h"
#include "DebugDump.h"
#include "ABRTException.h"
diff --git a/lib/Utils/make_descr.cpp b/lib/Utils/make_descr.cpp
index 7f60c90..90bd76a 100644
--- a/lib/Utils/make_descr.cpp
+++ b/lib/Utils/make_descr.cpp
@@ -1,5 +1,4 @@
#include "abrtlib.h"
-//#include "abrt_types.h"
#include "CrashTypes.h"
#include "DebugDump.h" /* FILENAME_ARCHITECTURE etc */
#ifdef HAVE_CONFIG_H
diff --git a/src/Daemon/abrt.conf b/src/Daemon/abrt.conf
index 0a5cdc4..276bf25 100644
--- a/src/Daemon/abrt.conf
+++ b/src/Daemon/abrt.conf
@@ -1,16 +1,17 @@
-# test conf file. it will be generated in the future
-
-# Common abrt settings
[ Common ]
# With this option set to "yes",
# only crashes in signed packages will be analyzed.
-# uses prelink which can be dangerous, and it's disallowed by SELinux
+# Checking signatures may require prelink to be run.
+# This has a remote possibility of breaking binaries and libraries,
+# and also SELinux gets unhappy about prelink trying to modify them.
OpenGPGCheck = no
# GPG keys
OpenGPGPublicKeys = /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
# Blacklisted packages
BlackList = nspluginwrapper
-# Enabled plugins. There has to be exactly one database plugin
+# Enabled plugins.
+# You can disable handling e.g. Python crashes by not listing Python here.
+# There has to be exactly one database plugin enabled.
EnabledPlugins = SQLite3, CCpp, Logger, Kerneloops, KerneloopsScanner, KerneloopsReporter, Bugzilla, Python, RunApp
# Database
Database = SQLite3
@@ -20,14 +21,14 @@ MaxCrashReportsSize = 1000
#ActionsAndReporters = Mailx("[abrt] new crash was detected")
ActionsAndReporters = RunApp("test x\"`cat component`\" = x\"xorg-x11-server-Xorg\" && cp /var/log/Xorg.0.log .")
-# Reporters association with analyzers
+# What actions or reporters to run on specified crash type
[ AnalyzerActionsAndReporters ]
Kerneloops = KerneloopsReporter
CCpp = Bugzilla, Logger
Python = Bugzilla, Logger
#CCpp:xorg-x11-apps = RunApp("date", "date.txt")
-# Repeated calling of Action plugins
+# Which Action plugins to run repeatedly
[ Cron ]
# h:m - at h:m an action plugin is activated
# s - every s seconds is an action plugin activated
diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py
index db1f727..77ce3d3 100644
--- a/src/Gui/CCMainWindow.py
+++ b/src/Gui/CCMainWindow.py
@@ -114,6 +114,8 @@ class MainWindow():
self.ccdaemon.connect("analyze-complete", self.on_analyze_complete_cb, self.pBarWindow)
self.ccdaemon.connect("abrt-error", self.error_cb)
self.ccdaemon.connect("update", self.update_cb)
+ # for now, just treat them the same (w/o this, we don't even see daemon warnings in logs!):
+ self.ccdaemon.connect("warning", self.update_cb)
self.ccdaemon.connect("show", self.show_cb)
self.ccdaemon.connect("daemon-state-changed", self.on_daemon_state_changed_cb)
self.ccdaemon.connect("report-done", self.on_report_done_cb)