diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-09-27 13:19:53 +0000 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-09-27 13:19:53 +0000 |
commit | 01d4432d9c051e5381aa4ebca6b945d30f1075b8 (patch) | |
tree | e3d8582dd6aee70e146deeed697b416a31a17047 /lib/ephy-debug.c | |
parent | 43e470f7461e38da9ec1894df5fbe619fb65ceb2 (diff) | |
download | epiphany-01d4432d9c051e5381aa4ebca6b945d30f1075b8.tar.gz |
Remove the hack, and just use the libc function for it. Thanks to Crispin
2004-09-27 Christian Persch <chpe@cvs.gnome.org>
* configure.ac:
* lib/ephy-debug.c: (trap_handler), (ephy_debug_init):
Remove the hack, and just use the libc function for it.
Thanks to Crispin for suggesting this.
Diffstat (limited to 'lib/ephy-debug.c')
-rw-r--r-- | lib/ephy-debug.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/ephy-debug.c b/lib/ephy-debug.c index b9f8386b6..2ea13bee4 100644 --- a/lib/ephy-debug.c +++ b/lib/ephy-debug.c @@ -28,18 +28,15 @@ #include <glib/gbacktrace.h> #include <string.h> -#include <stdio.h> #include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <execinfo.h> static GHashTable *ephy_profilers_hash = NULL; static const char *ephy_profile_modules = NULL; static const char *ephy_debug_break = NULL; -#ifdef HAVE_DUMPSTACKTOFILE -#define DumpStackToFile(f) _Z15DumpStackToFileP8_IO_FILE(f) -extern void _Z15DumpStackToFileP8_IO_FILE (FILE *f); -#endif - #endif #ifndef DISABLE_LOGGING @@ -85,6 +82,8 @@ log_module (const gchar *log_domain, } } +#define MAX_DEPTH 200 + static void trap_handler (const char *log_domain, GLogLevelFlags log_level, @@ -101,11 +100,11 @@ trap_handler (const char *log_domain, { if (strcmp (ephy_debug_break, "stack") == 0) { -#ifdef HAVE_DUMPSTACKTOFILE - DumpStackToFile (stderr); -#else - g_on_error_stack_trace (g_get_prgname ()); -#endif + void *array[MAX_DEPTH]; + size_t size; + + size = backtrace (array, MAX_DEPTH); + backtrace_symbols_fd (array, size, 2); } else if (strcmp (ephy_debug_break, "trap") == 0) { @@ -130,8 +129,6 @@ void ephy_debug_init (void) { #ifndef DISABLE_LOGGING - const char *debug_break; - ephy_log_modules = g_getenv ("EPHY_LOG_MODULES"); ephy_debug_break = g_getenv ("EPHY_DEBUG_BREAK"); |