| 388 | struct signalbinder |
| 389 | { |
| 390 | static void stackdumper(int sig) |
| 391 | { |
| 392 | printf("stacktrace:\n"); |
| 393 | #if !defined(STANDALONE) |
| 394 | if(clientlogfile) clientlogfile->printf("stacktrace\n"); |
| 395 | #endif |
| 396 | const int BTSIZE = 25; |
| 397 | void *array[BTSIZE]; |
| 398 | int n = backtrace(array, BTSIZE); |
| 399 | char **symbols = backtrace_symbols(array, n); |
| 400 | for(int i = 0; i < n; i++) |
| 401 | { |
| 402 | printf("%s\n", symbols[i]); |
| 403 | #if !defined(STANDALONE) |
| 404 | if(clientlogfile) clientlogfile->printf("%s\n", symbols[i]); |
| 405 | #endif |
| 406 | } |
| 407 | free(symbols); |
| 408 | |
| 409 | fatal("AssaultCube error (%d)", sig); |
| 410 | |
| 411 | } |
| 412 | |
| 413 | signalbinder() |
| 414 | { |