Update iso14651_t1_common file to ISO14651_2016_TABLE1_en.txt [BZ #14095]
[glibc.git] / debug / backtrace-tst.c
blobcc46c33c3cf682bee9ec2febc14be44e2d6dc223
1 #include <execinfo.h>
2 #include <inttypes.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <stdint.h>
8 static int
9 compare (const void *p1, const void *p2)
11 void *ba[20];
12 int n = backtrace (ba, sizeof (ba) / sizeof (ba[0]));
13 if (n != 0)
15 char **names = backtrace_symbols (ba, n);
16 if (names != NULL)
18 int i;
19 printf ("called from %s\n", names[0]);
20 for (i = 1; i < n; ++i)
21 printf (" %s\n", names[i]);
22 free (names);
26 return *(const uint32_t *) p1 - *(const uint32_t *) p2;
30 int
31 main (int argc, char *argv[])
33 uint32_t arr[20];
34 size_t cnt;
36 for (cnt = 0; cnt < sizeof (arr) / sizeof (arr[0]); ++cnt)
37 arr[cnt] = random ();
39 qsort (arr, sizeof (arr) / sizeof (arr[0]), sizeof (arr[0]), compare);
41 for (cnt = 0; cnt < sizeof (arr) / sizeof (arr[0]); ++cnt)
42 printf ("%" PRIx32 "\n", arr[cnt]);
44 return 0;