c++ - Detect specific function calls in the source codes with objdump -


i need way detect places, specific function called. e.g.:

myprint(): main.c, line 28 utils.c, line 89 

the point is, need function calls, not definitions or declarations. , need not "simple" c-like identifiers, class methods, functions defined in namespaces etc., because i'll use program c++.


my attempts

  1. gtags - detects identifiers pretty well, there's no way differentiate function calls definitions etc.

  2. cscope - c, fails c++

  3. objdump + addr2line - described more in detail below

i'm trying use objdump addr2line way:

objdump --disassemble-all binary | grep 'nameoffunction' 

output looks this:

5834c3: e8 e8 79 00 00          callq  58aeb0 <_zn7espreso14itersolverbase24solve_regcg_singular_domerns_10clustercpuerst6vectoris3_idsaideesais5_ee> 58bef4: e8 57 45 00 00          callq  590450 <_zzn7espreso14itersolverbase24solve_regcg_singular_domerns_10clustercpuerst6vectoris3_idsaideesais5_eeenkulie_clei> 58bf43: e8 08 45 00 00          callq  590450 <_zzn7espreso14itersolverbase24solve_regcg_singular_domerns_10clustercpuerst6vectoris3_idsaideesais5_eeenkulie_clei> 58bf7c: e8 cf 44 00 00          callq  590450 <_zzn7espreso14itersolverbase24solve_regcg_singular_domerns_10clustercpuerst6vectoris3_idsaideesais5_eeenkulie_clei> 

and take number first column , try physical location in code this:

addr2line -e binary 5834c3 

sometimes finds function call correctly, finds different (i guess kind of reference etc.).

and so, question - possible detect findings function calls? see, there callq in output, i'm not sure it's function call in code.


Comments