Dummy dl-procinfo.c file for platforms which don't have one.
[glibc.git] / manual / examples / execinfo.c
blob5a049019575d7676c3dba27db9c00f0daf05df05
1 #include <execinfo.h>
2 #include <stdio.h>
3 #include <stdlib.h>
5 /* Obtain a backtrace and print it to @code{stdout}. */
6 void
7 print_trace (void)
9 void *array[10];
10 size_t size;
11 char **strings;
12 size_t i;
14 size = backtrace (array, 10);
15 strings = backtrace_symbols (array, size);
17 printf ("Obtained %zd stack frames.\n", size);
19 for (i = 0; i < size; i++)
20 printf ("%s\n", strings[i]);
22 free (strings);
25 /* A dummy function to make the backtrace more interesting. */
26 void
27 dummy_function (void)
29 print_trace ();
32 int
33 main (void)
35 dummy_function ();
36 return 0;