Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
chelpers.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "jl/name.h"
4 
5 #define print_stack FORTRAN_UNPREFIXED(print_stack, PRINT_STACK)
6 #define sizeOfLongInt FORTRAN_UNPREFIXED(sizeoflongint, SIZEOFLONGINT)
7 
8 #if defined __GLIBC__
9 
10 #include <execinfo.h>
11 /* Obtain a backtrace and print it to stdout. */
12 void print_stack(void)
13 {
14  void *bt[50];
15  int i;
16  int bt_size = backtrace(bt, 50);
17  char **symbols = backtrace_symbols(bt, bt_size);
18 
19  printf ("backtrace(): obtained %d stack frames.\n", bt_size);
20  for (i=0; i<bt_size; i++) printf("%s\n", symbols[i]);
21  free (symbols);
22 }
23 #else
24 void print_stack(){};
25 #endif
26 
28 {
29  return sizeof(long int);
30 }
#define print_stack
Definition: chelpers.c:5
#define sizeOfLongInt
Definition: chelpers.c:6
for i
Definition: xxt_test.m:74
establishes some macros to establish naming conventions