#include <execinfo.h>
     #include <stdio.h>
     #include <stdlib.h>


     /* Obtain a backtrace and print it to stdout. */
     void
     print_trace (void)
     {
       void *array[10];
       size_t size;
       char **strings;
       size_t i;

       size = backtrace (array, 10);
       strings = backtrace_symbols (array, size);


       free (strings);
     }

     /* A dummy function to make the backtrace more interesting. */
     void
     dummy_function (void)
     {
      print_trace ();
     }

     int
     main (void)
     {
        long i;
       for (i=0;i<10000;i++)
        dummy_function ();
       return 0;
     }

