Code instrumentation with GCC

Jan-Benedict Glaw jbglaw@lug-owl.de
Thu May 29 12:09:00 GMT 2008


On Thu, 2008-05-29 12:03:05 +0000, Narech K <narechk@gmail.com> wrote:
> Is there a way to make GCC to instrument every function it compiles with a 
> prologue/epilogue call to a user defined code a la MSVC's _penter and 
> _pexit, e.g.:
> 
> http://msdn.microsoft.com/en-us/library/c63a9b7h.aspx
> http://msdn.microsoft.com/en-us/library/xc11y76y.aspx
> 
> If not, can anyone suggest a place in GCC's source to look at if one was to add
> such functionality self.

I think that could be done by defining these two functions:

void __cyg_profile_func_enter (void *func_address, void *call_site) __attribute__ ((no_instrument_function));
void __cyg_profile_func_exit (void *func_address, void *call_site) __attribute__ ((no_instrument_function));

...and compile with -finstrument-functions .

MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of: They that give up essential liberty to obtain temporary safety,
the second  : deserve neither liberty nor safety.  (Ben Franklin)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20080529/9e6d16aa/attachment.sig>


More information about the Gcc mailing list