Count function calls by name or signature. Gcc, C++

Posted by MajesticRa on Stack Overflow See other posts from Stack Overflow or by MajesticRa
Published on 2011-02-18T02:31:00Z Indexed on 2011/02/18 7:25 UTC
Read the original article Hit count: 140

Filed under:
|
|
|
|

I have some c++ written package. Linux, gcc. I can modify compilation process (change Makefile, flags, etc.), but can not change C++ source code.

One runs the package with different parameters, it does a job and exits.

How to count:
1) Number of calls of function with specific name?
2) Number of calls of functions with specific signature?
3) Number of calls of functions where one of the parameters is of specific type i.e. std::string (type is specified by signature)?
4) and extra Number of calls of functions of STL objects, i.e. std::string copy constructor?

(I mean count a number of calls during the run. )

I thought to do it with GDB, but I found it very tough to do (1) and have not found how to do (2)-(4) at all.


All acceptable answers I will write here for humanity.

© Stack Overflow or respective owner

Related posts about c++

Related posts about linux