[ABRT PATCHv2 1/2] Update satyr support, drop btparser compatibility

Martin Milata mmilata at redhat.com
Tue Jul 9 16:16:21 UTC 2013


Closes abrt/satyr#88.

Signed-off-by: Martin Milata <mmilata at redhat.com>
---
 configure.ac                                      |  14 +-
 doc/abrt-action-generate-core-backtrace.txt       |  50 +-----
 src/daemon/abrt-handle-event.c                    |  81 +++++-----
 src/include/Makefile.am                           |   1 -
 src/include/satyr-compat.h                        | 171 --------------------
 src/plugins/abrt-action-analyze-backtrace.c       |  41 +++--
 src/plugins/abrt-action-generate-core-backtrace.c | 180 ++--------------------
 src/plugins/koops_event.conf                      |   1 -
 src/plugins/python_event.conf                     |   1 -
 src/plugins/vmcore_event.conf                     |   1 -
 10 files changed, 92 insertions(+), 449 deletions(-)
 delete mode 100644 src/include/satyr-compat.h

diff --git a/configure.ac b/configure.ac
index ccd3901..7b32618 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,11 +92,6 @@ PYTHON_LIBS=`python-config --libs 2> /dev/null`
 AC_SUBST(PYTHON_CFLAGS)
 AC_SUBST(PYTHON_LIBS)
 
-AC_ARG_WITH([satyr],
-    AS_HELP_STRING([--with-satyr],
-        [use satyr instead of btparser (default is no)]),
-    [], [with_satyr=no])
-
 PKG_CHECK_MODULES([GTK], [gtk+-3.0])
 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.21])
 PKG_CHECK_MODULES([DBUS], [dbus-1])
@@ -109,14 +104,7 @@ PKG_CHECK_MODULES([LIBREPORT_GTK], [libreport-gtk])
 PKG_CHECK_MODULES([LIBREPORT_WEB], [libreport-web])
 PKG_CHECK_MODULES([POLKIT], [polkit-gobject-1])
 PKG_CHECK_MODULES([GIO], [gio-2.0])
-
-[if test "$with_satyr" = "yes"]
-[then]
-    PKG_CHECK_MODULES([SATYR], [satyr])
-    AC_DEFINE([USE_SATYR], [1], [Use satyr instead of btparser])
-[else]
-    PKG_CHECK_MODULES([SATYR], [btparser])
-[fi]
+PKG_CHECK_MODULES([SATYR], [satyr])
 
 PKG_PROG_PKG_CONFIG
 AC_ARG_WITH([systemdsystemunitdir],
diff --git a/doc/abrt-action-generate-core-backtrace.txt b/doc/abrt-action-generate-core-backtrace.txt
index 0e68031..988327f 100644
--- a/doc/abrt-action-generate-core-backtrace.txt
+++ b/doc/abrt-action-generate-core-backtrace.txt
@@ -3,12 +3,11 @@ abrt-action-generate-core-backtrace(1)
 
 NAME
 ----
-abrt-action-generate-core-backtrace - Generates coredump-level (debuginfo-free)
-backtrace
+abrt-action-generate-core-backtrace - Generates coredump-level backtrace
 
 SYNOPSIS
 --------
-'abrt-action-generate-core-backtrace' [-v] [-d DIR]
+'abrt-action-generate-core-backtrace' [-v] [-r] [-d DIR]
 
 DESCRIPTION
 -----------
@@ -22,8 +21,7 @@ However, it only contains information that can be obtained from the coredump
 without debugging symbols available - mainly relative addresses of
 the stored instruction pointers. Such backtrace can still be useful
 for reporting and reproducing the bug and does not require debugging
-information files to be installed.  See <<X1,*FILE FORMAT*>> for the
-description of the generated file.
+information files to be installed.
 
 The result is saved in the problem directory in a file named
 'core_backtrace'.
@@ -45,48 +43,12 @@ OPTIONS
 -d DIR::
    Path to problem directory.
 
+-r::
+   Do not hash function fingerprints. Useful for debugging.
+
 -v::
    Be more verbose. Can be given multiple times.
 
-[[X1]]
-FILE FORMAT
------------
-
-The generated file is a text file containing one line for each stack frame of
-the thread that most likely caused the crash. The line has following format:
-
-------------
-BUILD_ID OFFSET SYMBOL MODNAME FINGERPRINT
-------------
-
-Where:
-
-*BUILD_ID*::
-  Build ID of the binary file the address is mapped to as a hexadecimal string.
-
-*OFFSET*::
-  Offset from the start of the executable section of aforementioned file the
-  stored instruction pointer points to. Number in hexadecimal format.
-
-*SYMBOL*::
-  Name of the function if it is present in the binary (which is often the case
-  for shared libraries).
-
-*MODNAME*::
-  Name of the module. Contains name of a library or *[exe]* if it is the
-  executable.
-
-*FINGERPRINT*::
-  Fingerprint of the function the instruction pointer points to (x86-64 only).
-  The fingerprint is generated from various aspects of the machine code of the
-  function in question. Its purpose is to supplant the BUILD_ID and OFFSET
-  pair in case they are not present and to allow for comparison of
-  coredump-level backtraces produced by two slightly different versions of a
-  program.
-
-Dash in place of any of the parts indicates that the part is unknown.
-
-
 
 AUTHORS
 -------
diff --git a/src/daemon/abrt-handle-event.c b/src/daemon/abrt-handle-event.c
index a426566..eadb058 100644
--- a/src/daemon/abrt-handle-event.c
+++ b/src/daemon/abrt-handle-event.c
@@ -16,22 +16,42 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
+#include <satyr/thread.h>
+#include <satyr/stacktrace.h>
+#include <satyr/distance.h>
+#include <satyr/abrt.h>
 
 #include "libabrt.h"
 #include <libreport/run_event.h>
-#include "satyr-compat.h"
+
+/* 70 % similarity */
+#define BACKTRACE_DUP_THRESHOLD 0.3
 
 static char *uid = NULL;
 static char *uuid = NULL;
-static struct sr_core_stacktrace *corebt = NULL;
+static struct sr_stacktrace *corebt = NULL;
+static char *analyzer = NULL;
 static char *crash_dump_dup_name = NULL;
 
-static int core_backtrace_is_duplicate(struct sr_core_stacktrace *bt1,
+static char* load_backtrace(const struct dump_dir *dd)
+{
+    const char *filename = FILENAME_BACKTRACE;
+    if (strcmp(analyzer, "CCpp") == 0)
+    {
+        filename = FILENAME_CORE_BACKTRACE;
+    }
+
+    return dd_load_text_ext(dd, filename,
+        DD_FAIL_QUIETLY_ENOENT|DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
+}
+
+static int core_backtrace_is_duplicate(struct sr_stacktrace *bt1,
                                        const char *bt2_text)
 {
     int result;
     char *error_message;
-    struct sr_core_stacktrace *bt2 = sr_core_stacktrace_from_json_text(bt2_text, &error_message);
+    struct sr_stacktrace *bt2 = sr_stacktrace_parse(sr_abrt_type_from_analyzer(analyzer),
+                                                    bt2_text, &error_message);
     if (bt2 == NULL)
     {
         VERB1 log("Failed to parse backtrace, considering it not duplicate: %s", error_message);
@@ -39,10 +59,10 @@ static int core_backtrace_is_duplicate(struct sr_core_stacktrace *bt1,
         return 0;
     }
 
-    struct sr_core_thread *thread1 = sr_core_stacktrace_find_crash_thread(bt1);
-    struct sr_core_thread *thread2 = sr_core_stacktrace_find_crash_thread(bt2);
+    struct sr_thread *thread1 = sr_stacktrace_find_crash_thread(bt1);
+    struct sr_thread *thread2 = sr_stacktrace_find_crash_thread(bt2);
 
-    int length2 = sr_core_thread_get_frame_count(thread2);
+    int length2 = sr_thread_frame_count(thread2);
 
     if (length2 <= 0)
     {
@@ -52,7 +72,7 @@ static int core_backtrace_is_duplicate(struct sr_core_stacktrace *bt1,
     }
 
     /* This is an ugly workaround for https://github.com/abrt/btparser/issues/6 */
-#ifndef USE_SATYR
+    /*
     int length1 = sr_core_thread_get_frame_count(thread1);
 
     if (length1 <= 2 || length2 <= 2)
@@ -61,23 +81,14 @@ static int core_backtrace_is_duplicate(struct sr_core_stacktrace *bt1,
         result = (sr_core_thread_cmp(thread1, thread2) == 0);
         goto end;
     }
-#endif
-
-    float distance = sr_distance_core(SR_DISTANCE_DAMERAU_LEVENSHTEIN,
-                                      thread1, thread2);
+    */
 
-    if (distance == -1)
-    {
-        result = 0;
-    }
-    else
-    {
-        VERB2 log("Distance between backtraces: %f", distance);
-        result = (distance <= BACKTRACE_DUP_THRESHOLD);
-    }
+    float distance = sr_distance(SR_DISTANCE_DAMERAU_LEVENSHTEIN, thread1, thread2);
+    VERB2 log("Distance between backtraces: %f", distance);
+    result = (distance <= BACKTRACE_DUP_THRESHOLD);
 
 end:
-    sr_core_stacktrace_free(bt2);
+    sr_stacktrace_free(bt2);
 
     return result;
 }
@@ -126,22 +137,17 @@ static void dup_uuid_fini(void)
 
 static void dup_corebt_init(const struct dump_dir *dd)
 {
-    char *corebt_text;
-
     if (corebt)
         return; /* already checked */
 
-    corebt_text = dd_load_text_ext(dd, FILENAME_CORE_BACKTRACE,
-                            DD_FAIL_QUIETLY_ENOENT | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE
-    );
-
+    char *corebt_text = load_backtrace(dd);
     if (!corebt_text)
         return; /* no backtrace */
 
+    /* sr_stacktrace_parse moves the pointer */
     char *error_message;
-    corebt = sr_core_stacktrace_from_json_text(corebt_text,
-                                                &error_message);
-
+    corebt = sr_stacktrace_parse(sr_abrt_type_from_analyzer(analyzer),
+                                 corebt_text, &error_message);
     if (!corebt)
     {
         VERB1 log("Failed to load core stacktrace: %s", error_message);
@@ -157,9 +163,8 @@ static int dup_corebt_compare(const struct dump_dir *dd)
         return 0;
 
     int isdup;
-    char *dd_corebt = dd_load_text_ext(dd, FILENAME_CORE_BACKTRACE,
-            DD_FAIL_QUIETLY_ENOENT | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
 
+    char *dd_corebt = load_backtrace(dd);
     if (!dd_corebt)
         return 0;
 
@@ -174,7 +179,7 @@ static int dup_corebt_compare(const struct dump_dir *dd)
 
 static void dup_corebt_fini(void)
 {
-    sr_core_stacktrace_free(corebt);
+    sr_stacktrace_free(corebt);
     corebt = NULL;
 }
 
@@ -208,13 +213,13 @@ static int is_crash_a_dup(const char *dump_dir_name, void *param)
     if (!dd)
         return 0; /* wtf? (error, but will be handled elsewhere later) */
 
-    dup_uuid_init(dd);
-    dup_corebt_init(dd);
-
-    char *analyzer = dd_load_text(dd, FILENAME_ANALYZER);
+    analyzer = dd_load_text(dd, FILENAME_ANALYZER);
     /* dump_dir_name can be relative */
     dump_dir_name = realpath(dump_dir_name, NULL);
 
+    dup_uuid_init(dd);
+    dup_corebt_init(dd);
+
     dd_close(dd);
 
     DIR *dir = opendir(g_settings_dump_location);
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index addbaa5..49a6f5c 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -5,5 +5,4 @@ libabrt_include_HEADERS = \
     libabrt.h \
     abrt-dbus.h \
     hooklib.h \
-    satyr-compat.h \
     problem_api.h
diff --git a/src/include/satyr-compat.h b/src/include/satyr-compat.h
deleted file mode 100644
index 23f6bb7..0000000
--- a/src/include/satyr-compat.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
-    Copyright (C) 2013 RedHat inc.
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-/*
- * Compatibility header for transition from btparser to satyr. When the
- * possibility to compile abrt against btparser is removed, delete this file
- * and include the relevant satyr headers instead.
- */
-#ifndef SATYR_COMPAT_H_
-#define SATYR_COMPAT_H_
-
-#include "config.h"
-
-#ifdef USE_SATYR
-/* Satyr is used, nothing to do, just include everything we may need. */
-
-#include <satyr/core_frame.h>
-#include <satyr/core_stacktrace.h>
-#include <satyr/core_thread.h>
-#include <satyr/distance.h>
-#include <satyr/gdb_frame.h>
-#include <satyr/gdb_stacktrace.h>
-#include <satyr/location.h>
-#include <satyr/metrics.h>
-#include <satyr/normalize.h>
-#include <satyr/sha1.h>
-#include <satyr/utils.h>
-
-#define BACKTRACE_DUP_THRESHOLD 0.3
-
-#else /* USE_SATYR */
-/* We use btparser. Wrap the calls to btparser in a satyr-compatible interface. */
-
-#include <btparser/frame.h>
-#include <btparser/thread.h>
-#include <btparser/normalize.h>
-#include <btparser/metrics.h>
-#include <btparser/core-backtrace.h>
-#include <btparser/backtrace.h>
-#include <btparser/frame.h>
-#include <btparser/location.h>
-#include "libabrt.h" /* xstrdup */
-
-#define BACKTRACE_DUP_THRESHOLD 2.0
-
-/* abrt-handle-event.c */
-#define sr_core_stacktrace btp_thread
-#define sr_core_thread btp_thread
-
-enum sr_distance_type
-{
-    SR_DISTANCE_DAMERAU_LEVENSHTEIN
-};
-
-/* The functions should be static but that generates unused function warnings.
- * We don't include this header in two compilation units that are then linked
- * together anyway, so this should work. And this file should be gone soon ...
- */
-struct sr_core_stacktrace *
-sr_core_stacktrace_from_json_text(const char *text,
-                                  char **error_message)
-{
-    struct btp_thread *thread = btp_load_core_backtrace(text);
-    if (!thread)
-    {
-        *error_message = xstrdup(
-            "Failed to parse backtrace, considering it not duplicate");
-        return NULL;
-    }
-    return btp_load_core_backtrace(text);
-}
-
-struct sr_core_thread *
-sr_core_stacktrace_find_crash_thread(struct sr_core_stacktrace *stacktrace)
-{
-    return stacktrace;
-}
-
-int
-sr_core_thread_get_frame_count(struct sr_core_thread *thread)
-{
-    return btp_thread_get_frame_count(thread);
-}
-
-int
-sr_core_thread_cmp(struct sr_core_thread *thread1,
-                   struct sr_core_thread *thread2)
-{
-    return btp_thread_cmp(thread1, thread2);
-}
-
-float
-sr_distance_core(enum sr_distance_type distance_type,
-                 struct sr_core_thread *thread1,
-                 struct sr_core_thread *thread2)
-{
-    return btp_thread_levenshtein_distance_custom(thread1, thread2, true,
-        btp_core_backtrace_frame_cmp);
-}
-
-void
-sr_core_stacktrace_free(struct sr_core_stacktrace *stacktrace)
-{
-    btp_free_core_backtrace(stacktrace);
-}
-
-/* abrt-action-analyze-backtrace.c */
-#define sr_location btp_location
-#define sr_gdb_stacktrace btp_backtrace
-#define sr_gdb_frame btp_frame
-
-void
-sr_location_init(struct sr_location *location)
-{
-    btp_location_init(location);
-}
-
-struct sr_gdb_stacktrace *
-sr_gdb_stacktrace_parse(const char **input,
-                        struct sr_location *location)
-{
-    return btp_backtrace_parse(input, location);
-}
-
-char *
-sr_gdb_stacktrace_get_duplication_hash(struct sr_gdb_stacktrace *stacktrace)
-{
-    return btp_backtrace_get_duplication_hash(stacktrace);
-}
-
-float
-sr_gdb_stacktrace_quality_complex(struct sr_gdb_stacktrace *stacktrace)
-{
-    return btp_backtrace_quality_complex(stacktrace);
-}
-
-struct sr_gdb_frame *
-sr_gdb_stacktrace_get_crash_frame(struct sr_gdb_stacktrace *stacktrace)
-{
-    return btp_backtrace_get_crash_frame(stacktrace);
-}
-
-void
-sr_gdb_frame_free(struct sr_gdb_frame *frame)
-{
-    btp_frame_free(frame);
-}
-
-void
-sr_gdb_stacktrace_free(struct sr_gdb_stacktrace *stacktrace)
-{
-    btp_backtrace_free(stacktrace);
-}
-
-#endif /* USE_SATYR */
-
-#endif /* SATYR_COMPAT_H_ */
diff --git a/src/plugins/abrt-action-analyze-backtrace.c b/src/plugins/abrt-action-analyze-backtrace.c
index a980213..9348195 100644
--- a/src/plugins/abrt-action-analyze-backtrace.c
+++ b/src/plugins/abrt-action-analyze-backtrace.c
@@ -15,7 +15,11 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "satyr-compat.h"
+#include <satyr/location.h>
+#include <satyr/thread.h>
+#include <satyr/gdb/frame.h>
+#include <satyr/gdb/stacktrace.h>
+
 #include "libabrt.h"
 
 static const char *dump_dir_name = ".";
@@ -130,18 +134,29 @@ int main(int argc, char **argv)
     }
 
     /* Compute duplication hash. */
-    char *str_hash_core = sr_gdb_stacktrace_get_duplication_hash(backtrace);
-    struct strbuf *str_hash = strbuf_new();
-    strbuf_append_str(str_hash, component);
-    strbuf_append_str(str_hash, str_hash_core);
-
-    VERB3 log("Generating duphash: %s", str_hash->buf);
-    char hash_str[SHA1_RESULT_LEN*2 + 1];
-    create_hash(hash_str, str_hash->buf);
-
-    dd_save_text(dd, FILENAME_DUPHASH, hash_str);
-    strbuf_free(str_hash);
-    free(str_hash_core);
+    struct sr_thread *crash_thread =
+        (struct sr_thread *)sr_gdb_stacktrace_find_crash_thread(backtrace);
+
+    if (crash_thread)
+    {
+        char *hash_str;
+
+        if (g_verbose >= 3)
+        {
+            hash_str = sr_thread_get_duphash(crash_thread, 3, component,
+                                             SR_DUPHASH_NOHASH);
+            log("Generating duphash: %s", hash_str);
+            free(hash_str);
+        }
+
+        hash_str = sr_thread_get_duphash(crash_thread, 3, component,
+                                         SR_DUPHASH_NORMAL);
+        dd_save_text(dd, FILENAME_DUPHASH, hash_str);
+        free(hash_str);
+    }
+    else
+        log(_("Crash thread not found"));
+
 
     /* Compute the backtrace rating. */
     float quality = sr_gdb_stacktrace_quality_complex(backtrace);
diff --git a/src/plugins/abrt-action-generate-core-backtrace.c b/src/plugins/abrt-action-generate-core-backtrace.c
index 24d69cb..a549a53 100644
--- a/src/plugins/abrt-action-generate-core-backtrace.c
+++ b/src/plugins/abrt-action-generate-core-backtrace.c
@@ -16,74 +16,10 @@
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
-#include "libabrt.h"
-
-#ifdef USE_SATYR
-/* If satyr is used, just run "satyr abrt-create-core-stacktrace" on the dump directory.
- */
-
-#include <unistd.h>
-
-int main(int argc, char **argv)
-{
-    VERB1 log("Running 'satyr abrt-create-core-stacktrace .'");
-    execlp("satyr", "satyr", "abrt-create-core-stacktrace", ".", NULL);
-    perror_msg_and_die("Can't execute satyr");
-
-    return 0;
-}
-
-#else /* USE_SATYR */
-/* Btparser is used. Once the support is removed, this whole file can be
- * deleted and ccpp_event.conf modified accordingly.
- */
+#include <satyr/abrt.h>
+#include <satyr/utils.h>
 
-#include <btparser/hash_sha1.h>
-#include <btparser/utils.h>
-#include <btparser/core-backtrace.h>
-#include <btparser/core-backtrace-python.h>
-#include <btparser/core-backtrace-oops.h>
-
-static bool raw_fingerprints = false;
-
-/* add the information about '?' flag to fingerprint field
-   fingerprint is otherwise always empty for kerneloops */
-static void oops_add_question_marks(GList *backtrace)
-{
-    GList *elem = backtrace;
-    struct backtrace_entry *entry;
-    while (elem)
-    {
-        entry = (struct backtrace_entry *)elem->data;
-        if (entry->function_initial_loc)
-            entry->fingerprint = btp_strdup("?");
-
-        elem = g_list_next(elem);
-    }
-}
-
-static void hash_fingerprints(GList *backtrace)
-{
-    GList *elem = backtrace;
-    struct backtrace_entry *entry;
-    char bin_hash[BTP_SHA1_RESULT_BIN_LEN], hash[BTP_SHA1_RESULT_LEN];
-    btp_sha1_ctx_t ctx;
-    while (elem)
-    {
-        entry = (struct backtrace_entry *)elem->data;
-        if (entry->fingerprint)
-        {
-            btp_sha1_begin(&ctx);
-            btp_sha1_hash(&ctx, entry->fingerprint, strlen(entry->fingerprint));
-            btp_sha1_end(&ctx, bin_hash);
-            btp_bin2hex(hash, bin_hash, sizeof(bin_hash))[0] = '\0';
-
-            free(entry->fingerprint);
-            entry->fingerprint = btp_strndup(hash, sizeof(hash));
-        }
-        elem = g_list_next(elem);
-    }
-}
+#include "libabrt.h"
 
 int main(int argc, char **argv)
 {
@@ -97,12 +33,11 @@ int main(int argc, char **argv)
     abrt_init(argv);
 
     const char *dump_dir_name = ".";
-    /* 60 seconds was too limiting on slow machines */
-    const int exec_timeout_sec = 240;
+    bool raw_fingerprints = false;
 
     /* Can't keep these strings/structs static: _() doesn't support that */
     const char *program_usage_string = _(
-        "& [-v] -d DIR\n"
+        "& [-v] [-r] -d DIR\n"
         "\n"
         "Creates coredump-level backtrace from core dump and corresponding binary"
     );
@@ -123,109 +58,22 @@ int main(int argc, char **argv)
     export_abrt_envvars(0);
 
     if (g_verbose > 1)
-        btp_debug_parser = true;
+        sr_debug_parser = true;
 
     /* Let user know what's going on */
     log(_("Generating core_backtrace"));
 
-    /* Get the executable name -- unstrip doesn't know it. */
-    struct dump_dir *dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY);
-    if (!dd)
-        xfunc_die(); /* dd_opendir already printed error msg */
-    char *analyzer = dd_load_text(dd, FILENAME_ANALYZER);
-    char *executable = dd_load_text_ext(dd, FILENAME_EXECUTABLE,
-                                        DD_FAIL_QUIETLY_ENOENT);
-    char *txt_backtrace = dd_load_text_ext(dd, FILENAME_BACKTRACE,
-                                           DD_FAIL_QUIETLY_ENOENT);
-    char *kernel = dd_load_text_ext(dd, FILENAME_KERNEL,
-                                    DD_FAIL_QUIETLY_ENOENT |
-                                    DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
-    dd_close(dd);
-
-    /* Parse addresses and eventual symbols from the output */
-    GList *backtrace;
-    if (strcmp(analyzer, "CCpp") == 0)
-    {
-        char *gdb_out = get_backtrace(dump_dir_name, exec_timeout_sec, NULL);
-        if (gdb_out == NULL)
-            xfunc_die();
-
-        /* We observed a case when we were stuck for 36 minutes after emitting
-         * "Generating backtrace" message (in get_backtrace).
-         * We don't know whether we finished bt generation
-         * and were stuck somewhere below this point, or we were stuck
-         * in get_backtrace(). For now, we emit this message
-         * even in non-verbose mode to aid in future debugging:
-         */
-        log(_("Backtrace is generated, %u bytes"), (int)strlen(gdb_out));
-
-        backtrace = btp_backtrace_extract_addresses(gdb_out);
-        VERB1 log("Extracted %d frames from the backtrace", g_list_length(backtrace));
-        free(gdb_out);
+    char *error_message = NULL;
+    bool success = sr_abrt_create_core_stacktrace(dump_dir_name,
+                                                  !raw_fingerprints,
+                                                  &error_message);
 
-        VERB1 log("Running eu-unstrip -n to obtain build ids");
-        /* Run eu-unstrip -n to obtain the ids. This should be rewritten to read
-         * them directly from the core. */
-        char *unstrip_output = run_unstrip_n(dump_dir_name, /*timeout_sec:*/ 30);
-        if (unstrip_output == NULL)
-            error_msg_and_die("Running eu-unstrip failed");
-        btp_core_assign_build_ids(backtrace, unstrip_output, executable);
-        free(unstrip_output);
-
-        /* Remove empty lines from the backtrace. */
-        GList *loop = backtrace;
-        while (loop != NULL)
-        {
-            struct backtrace_entry *entry = loop->data;
-            GList *const tmp_next = g_list_next(loop);
-            if (!entry->build_id && !entry->filename && !entry->modname)
-                backtrace = g_list_delete_link(backtrace, loop);
-            loop = tmp_next;
-        }
-
-        /* Extract address ranges from all the executables in the backtrace */
-        VERB1 log("Computing function fingerprints");
-        btp_core_backtrace_fingerprint(backtrace);
-        if (!raw_fingerprints)
-            hash_fingerprints(backtrace);
-    }
-    else if (strcmp(analyzer, "Python") == 0)
-        backtrace = btp_parse_python_backtrace(txt_backtrace);
-    else if (strcmp(analyzer, "Kerneloops") == 0 || strcmp(analyzer, "vmcore") == 0)
+    if (!success)
     {
-        /* btp_parse_kerneloops() accepts NULL in the kernelver argument. It is not
-         * documented, but it is true. */
-        if (kernel != NULL)
-        {
-            char *space = strchr(kernel, ' ');
-            if (space)
-                *space = '\0';
-        }
-
-        backtrace = btp_parse_kerneloops(txt_backtrace, kernel);
-        oops_add_question_marks(backtrace);
+        log(_("Error: %s"), error_message);
+        free(error_message);
+        return 1;
     }
-    else
-        error_msg_and_die(_("Core-backtraces are not supported for '%s'"), analyzer);
-
-    free(txt_backtrace);
-    free(kernel);
-    free(executable);
-    free(analyzer);
 
-    char *formatted_backtrace = btp_core_backtrace_fmt(backtrace);
-
-    dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
-    if (!dd)
-        xfunc_die();
-    dd_save_text(dd, FILENAME_CORE_BACKTRACE, formatted_backtrace);
-    dd_close(dd);
-
-    log(_("Core backtrace is generated and saved, %u bytes"), (int)strlen(formatted_backtrace));
-
-    free(formatted_backtrace);
-    btp_core_backtrace_free(backtrace);
     return 0;
 }
-
-#endif /* USE_SATYR */
diff --git a/src/plugins/koops_event.conf b/src/plugins/koops_event.conf
index 7409922..9966775 100644
--- a/src/plugins/koops_event.conf
+++ b/src/plugins/koops_event.conf
@@ -3,7 +3,6 @@ EVENT=post-create analyzer=Kerneloops
         # >> instead of > is due to bugzilla.redhat.com/show_bug.cgi?id=854266
         abrt-action-analyze-oops &&
         dmesg >>dmesg &&
-        abrt-action-generate-core-backtrace
         abrt-action-save-kernel-data
 
 # If you want behavior similar to one provided by kerneloops daemon
diff --git a/src/plugins/python_event.conf b/src/plugins/python_event.conf
index 1aa0e99..3a45373 100644
--- a/src/plugins/python_event.conf
+++ b/src/plugins/python_event.conf
@@ -8,7 +8,6 @@ EVENT=post-create analyzer=Python
             exit 1
         fi
         abrt-action-analyze-python
-        abrt-action-generate-core-backtrace
 
 EVENT=report_Bugzilla analyzer=Python component!=anaconda
         test -f component || abrt-action-save-package-data
diff --git a/src/plugins/vmcore_event.conf b/src/plugins/vmcore_event.conf
index f6e260e..5d2d099 100644
--- a/src/plugins/vmcore_event.conf
+++ b/src/plugins/vmcore_event.conf
@@ -2,7 +2,6 @@
 EVENT=analyze_VMcore analyzer=vmcore
         abrt-action-analyze-vmcore &&
         abrt-action-analyze-oops &&
-        abrt-action-generate-core-backtrace &&
         abrt-action-save-kernel-data
 
 # If you want behavior similar to one provided by kerneloops daemon
-- 
1.7.11.7



More information about the Crash-catcher mailing list