1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-23 07:57:38 +01:00
libunwind-eh_elf/tests/test-varargs.c

53 lines
624 B
C
Raw Normal View History

2002-11-09 04:59:27 +01:00
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
extern int backtrace (void **, int);
static void
b (void)
{
void *v[20];
int i, n;
n = backtrace(v, 20);
for (i = 0; i < n; ++i)
printf ("[%d] %p\n", i, v[i]);
}
static void
c (void)
{
b ();
}
static void
a (int d, ...)
{
switch (d)
{
case 5:
a (4, 2,4);
break;
case 4:
a (3, 1,3,5);
break;
case 3:
a (2, 11, 13, 17, 23);
break;
case 2:
a (1);
break;
case 1:
c ();
}
}
int
main (int argc, char **argv)
{
a (5, 3, 4, 5, 6);
return 0;
}