summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-18 17:13:53 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-18 17:13:53 +0100
commit681785f7ad3f1aa7d3e8a974a3bcae2d1ad76aa6 (patch)
treed61ab540a4cc459ed0d3d8a45b08a11fd6cbacb2 /lib
parent3cd4d651565e4afcc3c72bd32bb9ce2285b5c93d (diff)
downloadabrt-681785f7ad3f1aa7d3e8a974a3bcae2d1ad76aa6.tar.gz
abrt-681785f7ad3f1aa7d3e8a974a3bcae2d1ad76aa6.tar.xz
abrt-681785f7ad3f1aa7d3e8a974a3bcae2d1ad76aa6.zip
CCpp analyzer: display __abort_msg in backtrace. closes rhbz#549735
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Plugins/CCpp.cpp9
-rw-r--r--lib/Utils/spawn.cpp36
2 files changed, 26 insertions, 19 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index e0db9cf..ab29fbb 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -270,7 +270,7 @@ static void GetBacktrace(const char *pDebugDumpDir,
unsetenv("TERM");
putenv((char*)"TERM=dumb");
- char *args[13];
+ char *args[15];
args[0] = (char*)"gdb";
args[1] = (char*)"-batch";
@@ -311,7 +311,10 @@ static void GetBacktrace(const char *pDebugDumpDir,
args[9] = (char*)"thread apply all backtrace 3000 full";
args[10] = (char*)"-ex";
args[11] = (char*)"info sharedlib";
- args[12] = NULL;
+ /* glibc's abort() stores its message in this variable */
+ args[12] = (char*)"-ex";
+ args[13] = (char*)"print (char*)__abort_msg";
+ args[14] = NULL;
ExecVP(args, xatoi_u(UID.c_str()), /*redirect_stderr:*/ 1, pBacktrace);
}
@@ -687,7 +690,6 @@ static bool DebuginfoCheckPolkit(uid_t uid)
void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force)
{
string package;
- string backtrace;
string UID;
CDebugDump dd;
@@ -725,6 +727,7 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force)
VERB1 log(_("Skipping debuginfo installation"));
}
+ string backtrace;
GetBacktrace(pDebugDumpDir, m_sDebugInfoDirs.c_str(), backtrace);
dd.Open(pDebugDumpDir);
diff --git a/lib/Utils/spawn.cpp b/lib/Utils/spawn.cpp
index d3e6ac6..43c4b4a 100644
--- a/lib/Utils/spawn.cpp
+++ b/lib/Utils/spawn.cpp
@@ -48,6 +48,22 @@ pid_t fork_execv_on_steroids(int flags,
if (child == 0) {
/* Child */
+ if (dir)
+ xchdir(dir);
+
+ if (flags & EXECFLG_SETGUID) {
+ struct passwd* pw = getpwuid(uid);
+ gid_t gid = pw ? pw->pw_gid : uid;
+ setgroups(1, &gid);
+ xsetregid(gid, gid);
+ xsetreuid(uid, uid);
+ }
+
+ if (unsetenv_vec) {
+ while (*unsetenv_vec)
+ unsetenv(*unsetenv_vec++);
+ }
+
/* Play with stdio descriptors */
if (flags & EXECFLG_INPUT) {
xmove_fd(pipe_to_child[0], STDIN_FILENO);
@@ -59,6 +75,10 @@ pid_t fork_execv_on_steroids(int flags,
} else if (flags & EXECFLG_OUTPUT_NUL) {
xmove_fd(xopen("/dev/null", O_RDWR), STDOUT_FILENO);
}
+
+ /* This should be done BEFORE stderr redirect */
+ VERB1 log("Executing: %s", concat_str_vector(argv).c_str());
+
if (flags & EXECFLG_ERR2OUT) {
/* Want parent to see errors in the same stream */
xdup2(STDOUT_FILENO, STDERR_FILENO);
@@ -66,25 +86,9 @@ pid_t fork_execv_on_steroids(int flags,
xmove_fd(xopen("/dev/null", O_RDWR), STDERR_FILENO);
}
- if (flags & EXECFLG_SETGUID) {
- struct passwd* pw = getpwuid(uid);
- gid_t gid = pw ? pw->pw_gid : uid;
- setgroups(1, &gid);
- xsetregid(gid, gid);
- xsetreuid(uid, uid);
- }
if (flags & EXECFLG_SETSID)
setsid();
- if (unsetenv_vec) {
- while (*unsetenv_vec)
- unsetenv(*unsetenv_vec++);
- }
-
- if (dir)
- xchdir(dir);
-
- VERB1 log("Executing: %s", concat_str_vector(argv).c_str());
execvp(argv[0], argv);
if (!(flags & EXECFLG_QUIET))
perror_msg("Can't execute '%s'", argv[0]);