diff options
| author | Karel Klic <kklic@redhat.com> | 2010-08-19 11:11:58 +0200 |
|---|---|---|
| committer | Karel Klic <kklic@redhat.com> | 2010-08-19 11:11:58 +0200 |
| commit | d6f6a7a98b83de0d0aa3792fb187b66d9d15953d (patch) | |
| tree | 3f88861519c32e3180d506507f1de3f8e34dfe45 /lib/plugins/CCpp.cpp | |
| parent | 8b22e91dc2ac3e73d628486c91f83da5a0e5ec44 (diff) | |
| parent | 96071530ea85635cf87a6bf650b7f5ddbd219f44 (diff) | |
| download | abrt-d6f6a7a98b83de0d0aa3792fb187b66d9d15953d.tar.gz abrt-d6f6a7a98b83de0d0aa3792fb187b66d9d15953d.tar.xz abrt-d6f6a7a98b83de0d0aa3792fb187b66d9d15953d.zip | |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'lib/plugins/CCpp.cpp')
| -rw-r--r-- | lib/plugins/CCpp.cpp | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/lib/plugins/CCpp.cpp b/lib/plugins/CCpp.cpp index 629da665..2e8b9177 100644 --- a/lib/plugins/CCpp.cpp +++ b/lib/plugins/CCpp.cpp @@ -178,7 +178,7 @@ static int ExecVP(char **pArgs, uid_t uid, int redirect_stderr, string& pOutput) return status; } -static void GetBacktrace(const char *pDebugDumpDir, +static bool GetBacktrace(const char *pDebugDumpDir, const char *pDebugInfoDirs, string& pBacktrace) { @@ -186,13 +186,17 @@ static void GetBacktrace(const char *pDebugDumpDir, string UID; string executable; + CDebugDump dd; + if (!dd.Open(pDebugDumpDir)) { - CDebugDump dd; - dd.Open(pDebugDumpDir); - dd.LoadText(FILENAME_EXECUTABLE, executable); - dd.LoadText(CD_UID, UID); + VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir); + return false; } + dd.LoadText(FILENAME_EXECUTABLE, executable); + dd.LoadText(CD_UID, UID); + dd.Close(); + // Workaround for // http://sourceware.org/bugzilla/show_bug.cgi?id=9622 unsetenv("TERM"); @@ -276,7 +280,7 @@ static void GetBacktrace(const char *pDebugDumpDir, pBacktrace = ""; ExecVP(args, xatoi_u(UID.c_str()), /*redirect_stderr:*/ 1, pBacktrace); if (bt_depth <= 64 || pBacktrace.size() < 256*1024) - return; + return true; bt_depth /= 2; if (bt_depth <= 64 && thread_apply_all[0] != '\0') { @@ -323,12 +327,16 @@ static void GetIndependentBuildIdPC(const char *unstrip_n_output, static string run_unstrip_n(const char *pDebugDumpDir) { string UID; + CDebugDump dd; + if (!dd.Open(pDebugDumpDir)) { - CDebugDump dd; - dd.Open(pDebugDumpDir); - dd.LoadText(CD_UID, UID); + VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir); + return string(""); } + dd.LoadText(CD_UID, UID); + dd.Close(); + char* args[4]; args[0] = (char*)"eu-unstrip"; args[1] = xasprintf("--core=%s/"FILENAME_COREDUMP, pDebugDumpDir); @@ -506,13 +514,17 @@ string CAnalyzerCCpp::GetLocalUUID(const char *pDebugDumpDir) { string executable; string package; + CDebugDump dd; + if (!dd.Open(pDebugDumpDir)) { - CDebugDump dd; - dd.Open(pDebugDumpDir); - dd.LoadText(FILENAME_EXECUTABLE, executable); - dd.LoadText(FILENAME_PACKAGE, package); + VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir); + return string(""); } + dd.LoadText(FILENAME_EXECUTABLE, executable); + dd.LoadText(FILENAME_PACKAGE, package); + dd.Close(); + string unstrip_n_output = run_unstrip_n(pDebugDumpDir); string independentBuildIdPC; GetIndependentBuildIdPC(unstrip_n_output.c_str(), independentBuildIdPC); @@ -552,11 +564,17 @@ string CAnalyzerCCpp::GetLocalUUID(const char *pDebugDumpDir) string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir) { CDebugDump dd; - dd.Open(pDebugDumpDir); + if (!dd.Open(pDebugDumpDir)) + { + VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir); + return string(""); + } + if (dd.Exist(FILENAME_GLOBAL_UUID)) { string uuid; dd.LoadText(FILENAME_GLOBAL_UUID, uuid); + dd.Close(); return uuid; } else @@ -670,6 +688,7 @@ string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir) { dd.SaveText(FILENAME_RATING, "0"); } + dd.Close(); string hash_base = package + executable + independent_backtrace; return create_hash(hash_base.c_str()); @@ -710,7 +729,11 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force) string package, executable, UID; CDebugDump dd; - dd.Open(pDebugDumpDir); + if (!dd.Open(pDebugDumpDir)) + { + VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir); + return; + } /* Skip remote crashes. */ if (dd.Exist(FILENAME_REMOTE)) @@ -750,7 +773,12 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force) /* Create and store backtrace. */ string backtrace_str; GetBacktrace(pDebugDumpDir, m_sDebugInfoDirs.c_str(), backtrace_str); - dd.Open(pDebugDumpDir); + if (!dd.Open(pDebugDumpDir)) + { + VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir); + return; + } + dd.SaveText(FILENAME_BACKTRACE, (backtrace_str + build_ids).c_str()); if (m_bMemoryMap) |
