arrfab / rpms / abrt

Forked from rpms/abrt 5 years ago
Clone

Blame SOURCES/0152-abrt-hook-ccpp-save-core_backtrace-from-hook.patch

baab13
From 48c53164aebf9c07606e08f7108d0f7272d48d70 Mon Sep 17 00:00:00 2001
baab13
From: Richard Marko <rmarko@fedoraproject.org>
baab13
Date: Fri, 17 Jul 2015 13:52:35 +0200
baab13
Subject: [PATCH] abrt-hook-ccpp: save core_backtrace from hook
baab13
baab13
Don't use satyr for saving the file.
baab13
baab13
Signed-off-by: Richard Marko <rmarko@fedoraproject.org>
baab13
---
baab13
 src/hooks/abrt-hook-ccpp.c | 14 +++++++++-----
baab13
 1 file changed, 9 insertions(+), 5 deletions(-)
baab13
baab13
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
baab13
index d95228f..6759fc0 100644
baab13
--- a/src/hooks/abrt-hook-ccpp.c
baab13
+++ b/src/hooks/abrt-hook-ccpp.c
baab13
@@ -585,21 +585,25 @@ static int create_or_die(const char *filename, int user_core_fd)
baab13
     perror_msg_and_die("Can't open '%s'", filename);
baab13
 }
baab13
 
baab13
-static void create_core_backtrace(pid_t tid, const char *executable, int signal_no, const char *dd_path)
baab13
+static void create_core_backtrace(pid_t tid, const char *executable, int signal_no, struct dump_dir *dd)
baab13
 {
baab13
 #ifdef ENABLE_DUMP_TIME_UNWIND
baab13
     if (g_verbose > 1)
baab13
         sr_debug_parser = true;
baab13
 
baab13
     char *error_message = NULL;
baab13
-    bool success = sr_abrt_create_core_stacktrace_from_core_hook(dd_path, tid, executable,
baab13
-                                                                 signal_no, &error_message);
baab13
+    char *core_bt = sr_abrt_get_core_stacktrace_from_core_hook(tid, executable,
baab13
+                                                               signal_no, &error_message);
baab13
 
baab13
-    if (!success)
baab13
+    if (core_bt == NULL)
baab13
     {
baab13
         log("Failed to create core_backtrace: %s", error_message);
baab13
         free(error_message);
baab13
+        return;
baab13
     }
baab13
+
baab13
+    dd_save_text(dd, FILENAME_CORE_BACKTRACE, core_bt);
baab13
+    free(core_bt);
baab13
 #endif /* ENABLE_DUMP_TIME_UNWIND */
baab13
 }
baab13
 
baab13
@@ -1028,7 +1032,7 @@ int main(int argc, char** argv)
baab13
 
baab13
         /* Perform crash-time unwind of the guilty thread. */
baab13
         if (tid > 0 && setting_CreateCoreBacktrace)
baab13
-            create_core_backtrace(tid, executable, signal_no, dd->dd_dirname);
baab13
+            create_core_backtrace(tid, executable, signal_no, dd);
baab13
 
baab13
         /* We close dumpdir before we start catering for crash storm case.
baab13
          * Otherwise, delete_dump_dir's from other concurrent
baab13
-- 
baab13
2.4.3
baab13