| | 485 | #if 0 |
| | 486 | |
| | 487 | #include <execinfo.h> |
| | 488 | |
| | 489 | static void maketrace() |
| | 490 | { |
| | 491 | void *array[20]; //only care about last 17 functions (3 taken with tracing support) |
| | 492 | size_t size; |
| | 493 | char **strings; |
| | 494 | size_t i; |
| | 495 | |
| | 496 | size = backtrace (array, 20); |
| | 497 | strings = backtrace_symbols (array, size); //Need -rdynamic gcc (linker) flag for this to work |
| | 498 | |
| | 499 | for (i = 0; i < size; i++) //skip useless functions |
| | 500 | cout<<strings[i]<<"\n"; |
| | 501 | cout<<"--"<<endl; |
| | 502 | } |
| | 503 | |
| | 504 | extern "C" { |
| | 505 | int gettimeofday (struct timeval *__restrict __tv, |
| | 506 | __timezone_ptr_t __tz) |
| | 507 | { |
| | 508 | maketrace(); |
| | 509 | return 0; |
| | 510 | } |
| | 511 | |
| | 512 | } |
| | 513 | #endif |
| | 514 | |