From 01d4432d9c051e5381aa4ebca6b945d30f1075b8 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 27 Sep 2004 13:19:53 +0000 Subject: Remove the hack, and just use the libc function for it. Thanks to Crispin 2004-09-27 Christian Persch * 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. --- lib/ephy-debug.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'lib/ephy-debug.c') 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 #include -#include #include +#include +#include +#include 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"); -- cgit v1.2.3