cscope
step by step example
Go to the base directory of your project, and run:
cscope -Rb
This generates a cscope.out
file which contains the parsed information. Generation is reasonably fast, even for huge projects like the Linux kernel.
Note that cscope
is not designed to work with other languages other than C. Sometimes it does work for other C-like syntax languages like Python, and you can force it to recognize those files with hacks such as cscope -Rb -s *
and others mentioned at: Using cscope to browse Python code with VIM? but it won't work as well as for C.
Open vim, and run:
:cs add cscope.out
:cs find s my_func
s
is a mnemonic for symbol
. The other cscope
provided queries are also possible.
The cscope interface (ouside Vim) also has a variable assignment query (subset of symbol occurrences) which Vim does not seem to offer (?)
This adds a list of the callers to the quickfix list, which you can open with:
:copen
Go to the line that interests you and hit enter to jump there.
See also: