diff --git a/common.c b/common.c index 1e42cb731..0b7a26aed 100644 --- a/common.c +++ b/common.c @@ -44,6 +44,10 @@ parts of fish. #include #include +#ifdef HAVE_EXECINFO_H +#include +#endif + #ifndef HOST_NAME_MAX /** Maximum length of hostname return. It is ok if this is too short, @@ -110,6 +114,28 @@ static struct winsize termsize; */ static string_buffer_t *setlocale_buff=0; + +void show_stackframe() +{ + void *trace[32]; + char **messages = (char **)NULL; + int i, trace_size = 0; + + trace_size = backtrace(trace, 32); + messages = backtrace_symbols(trace, trace_size); + + if( messages ) + { + debug( 0, L"Backtrace:" ); + for( i=0; i