/pidgin/main: e4618d775e0d: Add --enable-glib-errors-trace confi...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Sun Mar 16 21:56:58 EDT 2014
Changeset: e4618d775e0dcea4096372d30d6cd3034262cff2
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-03-17 02:56 +0100
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/e4618d775e0d
Description:
Add --enable-glib-errors-trace configure switch
diffstat:
configure.ac | 11 +++++++++++
pidgin/gtkdebug.c | 15 +++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
diffs (53 lines):
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1545,6 +1545,17 @@ if test "x$enable_clang_address_sanitize
CFLAGS="$CFLAGS -faddress-sanitizer -g -fno-omit-frame-pointer -fno-inline -fno-optimize-sibling-calls"
fi
+
+AC_ARG_ENABLE(glib-errors-trace, [AS_HELP_STRING([--enable-glib-errors-trace], [print backtraces for glib errors])], enable_glibtrace="$enableval", enable_glibtrace="no")
+if test "x$enable_glibtrace" = "xyes"; then
+ if test "x$have_clang" = "xyes"; then
+ AC_MSG_ERROR([--enable-glib-errors-trace doesn't work with clang])
+ fi
+ AC_DEFINE(ENABLE_GLIBTRACE, 1, [Define if backtraces should be printed for glib errors.])
+ dnl CFLAGS="$CFLAGS -rdynamic"
+ CFLAGS="$CFLAGS -rdynamic"
+fi
+
dnl #######################################################################
dnl # Check for D-Bus libraries
dnl #######################################################################
diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c
--- a/pidgin/gtkdebug.c
+++ b/pidgin/gtkdebug.c
@@ -32,6 +32,10 @@
#include "gtkwebview.h"
#include "pidginstock.h"
+#ifdef ENABLE_GLIBTRACE
+#include <execinfo.h>
+#endif
+
#include <gdk/gdkkeysyms.h>
#include "gtk3compat.h"
@@ -668,6 +672,17 @@ pidgin_glib_log_handler(const gchar *dom
if (new_msg != NULL)
{
+#ifdef ENABLE_GLIBTRACE
+ void *bt_buff[20];
+ size_t bt_size;
+
+ bt_size = backtrace(bt_buff, 20);
+ fprintf(stderr, "\nBacktrace for \"%s\" (%s):\n", new_msg,
+ new_domain != NULL ? new_domain : "g_log");
+ backtrace_symbols_fd(bt_buff, bt_size, STDERR_FILENO);
+ fprintf(stderr, "\n");
+#endif
+
purple_debug(level, (new_domain != NULL ? new_domain : "g_log"),
"%s\n", new_msg);
More information about the Commits
mailing list