Inlining __cyg_profile_func_{enter,exit} ?

Bill Rugolsky Jr. brugolsky@yahoo.com
Tue Dec 11 09:18:00 GMT 2001


Hi,

I'd like to use the -finstrument-functions to do little more than stuff
a few values on a circular queue that will be read out by another
thread, and I was wondering whether there is any inherent obstacle 
in the current implementation to inlining __cyg_profile_func_{enter,exit}?

With gcc-2.94.3/gcc-3.0.1, if one compiles
[gcc -O3 -finstrument-functions] the code below, it does not have
the intended effect.

============================
   #include <stdio.h>
   int depth;

   inline void 
   __attribute__((__no_instrument_function__))
   __cyg_profile_func_enter(void *this_fn, void *call_site)
   {
      ++depth;
   }


   inline void 
   __attribute__((__no_instrument_function__))
   __cyg_profile_func_exit(void *this_fn, void *call_site)
   {
      --depth;
   }
   
   void
   foo(void)
   {
      printf("%ld\n",depth);
   }
   
   int
   main(int argc, char *argv)
   {
      foo();
      return 0;
   }

============================

Regards,

   Bill Rugolsky


PS: Please CC me on any replies; I'm not subscribed to the list.



More information about the Gcc mailing list