]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 27 Apr 2006 21:56:09 +0000 (21:56 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 27 Apr 2006 21:56:09 +0000 (21:56 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1283 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_ivrtest/mod_ivrtest.c
src/switch_core.c

index 26173959994023832459c2ced0764b2d32c60d8b..10738d9dcf927f25febd5a3a3e3df6ae2fb3179f 100644 (file)
@@ -51,7 +51,9 @@ static switch_status on_dtmf(switch_core_session *session, char *dtmf, void *buf
 
 static void disast_function(switch_core_session *session, char *data)
 {
-       printf("%s WOOHOO\n", (char *) 42);
+       void *x = NULL;
+       memset((void *) x, 0, 1000);
+       //printf("%s WOOHOO\n", (char *) 42);
 }
 
 
index f2fcd439f1e959d981d8f02f3d64ce556371c82a..f8721abf0a917316734d51317b740c87b3404138 100644 (file)
@@ -1813,12 +1813,46 @@ SWITCH_DECLARE(unsigned int) switch_core_session_runing(switch_core_session *ses
        return session->thread_running;
 }
 
+#ifdef __GNUC__
+#include <execinfo.h>
+#include <stdio.h>
+#include <stdlib.h>
+#define STACK_LEN 10
+
+/* Obtain a backtrace and print it to stdout. */
+static void print_trace (void)
+{
+       void *array[STACK_LEN];
+       size_t size;
+       char **strings;
+       size_t i;
+
+       size = backtrace (array, STACK_LEN);
+       strings = backtrace_symbols (array, size);
+
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Obtained %zd stack frames.\n", size);
+       
+       for (i = 0; i < size; i++) {
+               switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CRIT, "%s\n", strings[i]);
+       }
+
+       free (strings);
+}
+#else
+static void print_trace (void)
+{
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Trace not avaliable =(\n");
+}
+#endif
+
+
 static int handle_fatality(int sig)
 {
        switch_thread_id thread_id;
        jmp_buf *env;
 
        if (sig && (thread_id = switch_thread_self()) && (env = (jmp_buf *) apr_hash_get(runtime.stack_table, &thread_id, sizeof(thread_id)))) {
+               print_trace();
                longjmp(*env, sig);
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Caught SEGV for unmapped thread!");