Mona Jalal Mona Jalal - 6 months ago 12
Linux Question

How to find the callers and callee of a function in C code in vi/vim?

I want to know how can I easily click (or maybe use some easy shortcuts) on a function name and find all its callee or open where it has been defined. Most of the web manuals in web are really hard to follow or don't happen to work out. Say I want to click on

allocuvm
and see where it has been defined?

uint newstk=allocuvm(pgdir, USERTOP-PGSIZE, USERTOP);

Answer

For that, Vim integrates with the cscope tool; see :help cscope for more information.