Why doesn't `-finstrument-functions` work for me?

前端 未结 3 614
甜味超标
甜味超标 2020-12-15 12:37

According to this answer,it should print all function names:

[root@ test]# cat hw.c
#include 

int func(void)
{  
  return 1;
}
int main(void)         


        
3条回答
  •  没有蜡笔的小新
    2020-12-15 12:58

    You didn't actually implement any instrumentation. The -finstrument-functions switch just tells gcc to call some function at entry and exit to each function. But you have to define these functions yourself (normally this is done by linking a profiler library in).

提交回复
热议问题