|
From: Martin B. <Mar...@se...> - 2016-08-30 12:25:39
|
To Whom it may concern, is it possible to detect all calls of some specific function in the code with Callgrind? Let's say I have some project and I know, that there's function SparseSolver () used several times and I need to know where specifically (caller function/file + line number, so I'd be able to find calls in the source code). Is it possible to find this out with Callgrind? I know about CScope, which has this functionality (http://stackoverflow.com/questions/36178082/use- cscope-to-find-function-calls-not-definitions-c-c), but it's just for C and I need to look in C++ and Fortran too. Thank you very much for your response. Best regards, Martin Beseda |
|
From: John R. <jr...@bi...> - 2016-08-30 12:41:58
|
> is it possible to detect all calls of some specific function in the code with Callgrind? > > Let's say I have some project and I know, that there's function SparseSolver() used several times and I need to know where specifically (caller function/file + line number, so I'd be able to find calls in the source code). > > Is it possible to find this out with Callgrind? I know about CScope, which has this functionality (http://stackoverflow.com/questions/36178082/use-cscope-to-find-function-calls-not-definitions-c-c), but it's just for C and I need to look in C++ and Fortran too. Why not use objdump --disassemble-all my_program.exe | grep SparseSolver then 'addr2line'? That way you don't require constructing the input data that is required to exercise all the call paths, nor must you run the program 30 times slower than normal. Of course, any method is unlikely to find all the calls that have been inlined by the compiler or specialized+merged using constant propagation and link-time optimization. |
|
From: Ivo R. <iv...@iv...> - 2016-08-30 13:15:37
|
2016-08-30 14:41 GMT+02:00 John Reiser <jr...@bi...>: > > is it possible to detect all calls of some specific function in the code > with Callgrind? > > > > Let's say I have some project and I know, that there's function > SparseSolver() used several times and I need to know where specifically > (caller function/file + line number, so I'd be able to find calls in the > source code). > > > > Is it possible to find this out with Callgrind? I know about CScope, > which has this functionality (http://stackoverflow.com/ > questions/36178082/use-cscope-to-find-function-calls-not-definitions-c-c), > but it's just for C and I need to look in C++ and Fortran too. > > Why not use > > objdump --disassemble-all my_program.exe | grep SparseSolver > > then 'addr2line'? That way you don't require constructing the input data > that is required to exercise all the call paths, nor must you run the > program > 30 times slower than normal. Of course, any method is unlikely to find > all the calls that have been inlined by the compiler or specialized+merged > using constant propagation and link-time optimization. > A modern alternative to csope is OpenGrok [1]. I. [1] https://opengrok.github.io/OpenGrok/ |