Hi everyone,
I have a interesting segmentation fault in this code
http://pastebin.com/rP86ZLcr
I cannot find root cause, so any idea would be more than welcome.
You never use swerrBuff, so all that formatting and sprintf() effort
just goes off into the ether-bits.
You do not check to be sure that swerrBuff is long enough until *after*
you have written to it. You should check before.
You forgot to call backtrace() to fill your void pointer list with
symbols.
Here is a sample of how to use it:
#include <stdlib.h>
#include <stdio.h>
/* System specific header, may not work on your system: */
#include <execinfo.h>
void print_trace (void)
{
void *array[10];
int size;
char **strings;
int i;
size = backtrace (array, 10);
strings = backtrace_symbols (array, size);
printf ("Obtained %i stack frames.\n", size);
for (i = 0; i < size; i++)
printf ("%s\n", strings
);
free (strings);
}