summaryrefslogtreecommitdiffstats
path: root/lib/plugins/CCpp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins/CCpp.cpp')
-rw-r--r--lib/plugins/CCpp.cpp161
1 files changed, 0 insertions, 161 deletions
diff --git a/lib/plugins/CCpp.cpp b/lib/plugins/CCpp.cpp
index ddc17206..fad9cf62 100644
--- a/lib/plugins/CCpp.cpp
+++ b/lib/plugins/CCpp.cpp
@@ -50,167 +50,6 @@ CAnalyzerCCpp::CAnalyzerCCpp() :
m_nGdbTimeoutSec(60)
{}
-static void create_hash(char hash_str[SHA1_RESULT_LEN*2 + 1], const char *pInput)
-{
- unsigned len;
- unsigned char hash2[SHA1_RESULT_LEN];
- sha1_ctx_t sha1ctx;
-
- sha1_begin(&sha1ctx);
- sha1_hash(pInput, strlen(pInput), &sha1ctx);
- sha1_end(hash2, &sha1ctx);
- len = SHA1_RESULT_LEN;
-
- char *d = hash_str;
- unsigned char *s = hash2;
- while (len)
- {
- *d++ = "0123456789abcdef"[*s >> 4];
- *d++ = "0123456789abcdef"[*s & 0xf];
- s++;
- len--;
- }
- *d = '\0';
- //log("hash2:%s str:'%s'", hash_str, pInput);
-}
-
-string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir)
-{
- struct dump_dir *dd = dd_opendir(pDebugDumpDir, /*flags:*/ 0);
- if (!dd)
- return string("");
-
- if (dd_exist(dd, FILENAME_DUPHASH))
- {
- char *uuid = dd_load_text(dd, FILENAME_DUPHASH);
- dd_close(dd);
- string ret = uuid;
- free(uuid);
- return ret;
- }
- else
- {
- // Compatibility code.
- // This whole block should be deleted for Fedora 14.
- log(_("Getting global universal unique identification..."));
-
- string backtrace_path = concat_path_file(pDebugDumpDir, FILENAME_BACKTRACE);
- char *executable = dd_load_text(dd, FILENAME_EXECUTABLE);
- char *package = dd_load_text(dd, FILENAME_PACKAGE);
- char *uid_str = m_bBacktrace ? dd_load_text(dd, CD_UID) : xstrdup("");
-
- string independent_backtrace;
- if (m_bBacktrace)
- {
- /* Run abrt-backtrace to get independent backtrace suitable
- to UUID calculation. */
- char *backtrace_path = concat_path_file(pDebugDumpDir, FILENAME_BACKTRACE);
- 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] = backtrace_path;
- args[6] = NULL;
-
- int pipeout[2];
- xpipe(pipeout); /* stdout of abrt-backtrace */
-
- fflush(NULL);
- pid_t child = fork();
- if (child == -1)
- perror_msg_and_die("fork");
- if (child == 0)
- {
- VERB1 log("Executing %s", args[0]);
-
- 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);
- 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);
- }
-
- free(backtrace_path);
- 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]);
-
- /* 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 == 79) /* EX_PARSINGFAILED */
- {
- /* abrt-backtrace returns alternative backtrace
- representation in this case, so everything will work
- as expected except worse duplication detection */
- log_msg("abrt-backtrace failed to parse the backtrace");
- }
- else if (exit_status == 80) /* EX_THREADDETECTIONFAILED */
- {
- /* abrt-backtrace returns backtrace with all threads
- in this case, so everything will work as expected
- except worse duplication detection */
- log_msg("abrt-backtrace failed to determine crash frame");
- }
- else if (exit_status != 0)
- {
- /* this is unexpected problem and it should be investigated */
- error_msg("abrt-backtrace run failed, exit value: %d",
- exit_status);
- }
- }
-
- /*VERB1 log("abrt-backtrace result: %s", independent_backtrace.c_str());*/
- }
- /* else: no backtrace, independent_backtrace == ""
- no backtrace => rating = 0
- */
- else
- {
- dd_save_text(dd, FILENAME_RATING, "0");
- }
- dd_close(dd);
-
- char *hash_str = xasprintf("%s%s%s", package, executable, independent_backtrace.c_str());
- free(package);
- free(executable);
-
- char hash_str2[SHA1_RESULT_LEN*2 + 1];
- create_hash(hash_str2, hash_str);
- free(hash_str);
-
- return hash_str2;
- }
-}
-
/*
this is just a workaround until kernel changes it's behavior
when handling pipes in core_pattern