Is there a compiler feature to inject custom function entry and exit code?

后端 未结 4 1821
无人及你
无人及你 2020-12-10 15:19

Currently coding on Windows with VS2005 (but wouldn\'t mind knowing if there are options for other compilers and platforms. I\'m most interested in OSX as an alternative pl

4条回答
  •  情深已故
    2020-12-10 15:42

    GCC has the -finstrument-functions flag which allows you to define two functions that will be called at the beginning and end of each function call:

    void __cyg_profile_func_enter(void *this_fn, void *call_site);
    void __cyg_profile_func_exit(void *this_fn, void *call_site);
    

提交回复
热议问题