#include <execinfo.h>
void my_backtrace()
{
void *buffer[100] = {NULL};
char **trace = NULL;
int i = 0;
int size = 0;
size = backtrace(buffer, 100);
trace = backtrace_symbols(buffer, size);
if (NULL == trace)
{
return;
}
for (i = 0; i < size; ++i)
{
printf("%s ", trace[i]);
}
free(trace);
printf("----------done---------- ");
}