#include #include #include using namespace std; static set *functions=NULL; static int guard = 0; extern "C" void __cyg_profile_func_enter (void *this_fn, void *call_site) { if (guard) { // this is a pretty lame guard. gets run cos of operator new that's inlined everywhere, probly malloc too //printf("stuff up\n"); return; } guard = 1; if (!functions) functions = new set(); if (functions->find(this_fn) != functions->end()) { guard = 0; return; } functions->insert(this_fn); Dl_info info; dladdr(this_fn, &info); fprintf(stderr, "func_enter %s %x\n", info.dli_fname, ((unsigned long)this_fn) - (unsigned long)info.dli_fbase); guard = 0; }