From 270c7d5aa13d3effa9a56a72bc1434dfd98801fd Mon Sep 17 00:00:00 2001 From: fiplox Date: Wed, 19 Jan 2022 16:45:15 +0100 Subject: [PATCH] was used for test, not anymore --- backtrace.c | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 backtrace.c diff --git a/backtrace.c b/backtrace.c deleted file mode 100644 index beff75b..0000000 --- a/backtrace.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -#include - -void myfunc3(void) -{ - int j, nptrs; -#define SIZE 100 - void *buffer[100]; - char **strings; - - nptrs = backtrace(buffer, SIZE); - printf("backtrace() returned %d addresses\n", nptrs); - - /* The call backtrace_symbols_fd(buffer, nptrs, STDOUT_FILENO) - would produce similar output to the following: */ - - strings = backtrace_symbols(buffer, nptrs); - if (strings == NULL) { - perror("backtrace_symbols"); - exit(EXIT_FAILURE); - } - - for (j = 0; j < nptrs; j++) - printf("%s\n", strings[j]); - - free(strings); -} - -static void myfunc2(void) -{ - myfunc3(); -} - -void myfunc(int ncalls) -{ - if (ncalls > 1) - myfunc(ncalls - 1); - else - myfunc2(); -} - -int main(int argc, char *argv[]) -{ - if (argc != 2) { - fprintf(stderr, "%s num-calls\n", argv[0]); - exit(EXIT_FAILURE); - } - myfunc(atoi(argv[1])); - exit(EXIT_SUCCESS); -}