A game engine for top-down 2D RPG games.
rpg
game-engine
raylib
c99
1#include <keraforge.h>
2
3#if KF_GNU
4#include <execinfo.h>
5#endif
6
7
8void kf_printbacktrace(FILE *file)
9{
10#if KF_GNU
11 static const int maxtracelen = 128;
12 void *trace[maxtracelen];
13
14 int size = backtrace(trace, maxtracelen);
15 char **strings = backtrace_symbols(trace, size);
16 if (strings)
17 {
18 fprintf(file, "backtrace: (%d frames)\n", size);
19 for (int i = 0 ; i < size ; i++)
20 fprintf(file, " %d: %s\n", size-i, strings[i]);
21 }
22 else
23 {
24 fprintf(file, "failed to obtain backtrace\n");
25 }
26
27 free(strings);
28#else
29 fprintf(file, "kf_printbacktrace requires GNU extensions (execinfo.h)\n");
30#endif
31}