summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2002-07-23 19:12:02 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-07-23 19:12:02 +0000
commit197c81178cc4de0ef8332082917892c096cad886 (patch)
tree8eb78f1e694cb093d58861203ea6e7ea71cf6f7e /src/util.c
parentdc73aaeb396a6e90bb18a53f5954cce73a774617 (diff)
downloadmetacity-197c81178cc4de0ef8332082917892c096cad886.tar.gz
handle NULL screen from screen_for_xwindow
2002-07-23 Havoc Pennington <hp@redhat.com> * src/keybindings.c (meta_display_process_key_event): handle NULL screen from screen_for_xwindow * src/display.c (meta_display_screen_for_xwindow): put an error trap around the XGetWindowAttributes(), should fix the popular "closing a window results in a crash" bug. * src/util.c (print_backtrace): support optional backtrace feature using gnu libc backtrace() call
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 3c5c9855..aff236e9 100644
--- a/src/util.c
+++ b/src/util.c
@@ -29,6 +29,37 @@
#include <errno.h>
#include <string.h>
+#ifdef HAVE_BACKTRACE
+#include <execinfo.h>
+static void
+print_backtrace (void)
+{
+ void *bt[500];
+ int bt_size;
+ int i;
+ char **syms;
+
+ bt_size = backtrace (bt, 500);
+
+ syms = backtrace_symbols (bt, bt_size);
+
+ i = 0;
+ while (i < bt_size)
+ {
+ meta_verbose (" %s\n", syms[i]);
+ ++i;
+ }
+
+ free (syms);
+}
+#else
+static void
+print_backtrace (void)
+{
+ meta_verbose ("Not compiled with backtrace support\n");
+}
+#endif
+
static gboolean is_verbose = FALSE;
static gboolean is_debugging = FALSE;
static gboolean replace_current = FALSE;
@@ -264,6 +295,8 @@ meta_bug (const char *format, ...)
g_free (str);
+ print_backtrace ();
+
/* stop us in a debugger */
abort ();
}