[ABRT PATCH] a-a-g-c-b: Unwind using GDB
Martin Milata
mmilata at redhat.com
Wed Jul 24 15:20:32 UTC 2013
Related to the fact that some distributions don't have libunwind nor
elfutils unwinder and we have to fall back to GDB.
Signed-off-by: Martin Milata <mmilata at redhat.com>
---
configure.ac | 13 +++++++++++
src/plugins/abrt-action-generate-core-backtrace.c | 28 ++++++++++++++++++++---
2 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4e69519..d54c715 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,6 +170,19 @@ fi
AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test "$enable_doxygen_docs" = "yes")
+# Make satyr use GDB or elfutils/libunwind for unwinding?
+
+AC_ARG_ENABLE([native-unwinder],
+ AS_HELP_STRING([--enable-native-unwinder],
+ [use native unwinder (libunwind or elfutils) instead of GDB (default is no)]),
+ [], [enable_native_unwinder=no])
+
+[if test "$enable_native_unwinder" = "yes"]
+[then]
+ AC_DEFINE([ENABLE_NATIVE_UNWINDER], [1], [Use elfutils/libunwind for unwinding instead of GDB.])
+[fi]
+
+
AC_SUBST(CONF_DIR)
AC_SUBST(VAR_RUN)
AC_SUBST(PLUGINS_CONF_DIR)
diff --git a/src/plugins/abrt-action-generate-core-backtrace.c b/src/plugins/abrt-action-generate-core-backtrace.c
index a549a53..c4f384e 100644
--- a/src/plugins/abrt-action-generate-core-backtrace.c
+++ b/src/plugins/abrt-action-generate-core-backtrace.c
@@ -64,9 +64,31 @@ int main(int argc, char **argv)
log(_("Generating core_backtrace"));
char *error_message = NULL;
- bool success = sr_abrt_create_core_stacktrace(dump_dir_name,
- !raw_fingerprints,
- &error_message);
+ bool success;
+
+#ifdef ENABLE_NATIVE_UNWINDER
+
+ success = sr_abrt_create_core_stacktrace(dump_dir_name, !raw_fingerprints,
+ &error_message);
+#else /* ENABLE_NATIVE_UNWINDER */
+
+ /* The value 240 was taken from abrt-action-generate-backtrace.c. */
+ int exec_timeout_sec = 240;
+
+ char *gdb_output = get_backtrace(dump_dir_name, exec_timeout_sec, NULL);
+ if (!gdb_output)
+ {
+ log(_("Error: GDB did not return any data"));
+ return 1;
+ }
+
+ success = sr_abrt_create_core_stacktrace_from_gdb(dump_dir_name,
+ gdb_output,
+ !raw_fingerprints,
+ &error_message);
+ free(gdb_output);
+
+#endif /* ENABLE_NATIVE_UNWINDER */
if (!success)
{
--
1.7.11.7
More information about the Crash-catcher
mailing list