📅 2017-Aug-24 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cscope, ctags ⬩ 📚 Archive
Cscope is a classic source code explorer that can be used to explore a directory containing C source and header files. It can also be applied on C++ files, but do not expect much intelligence on C++ features. It indexes the source files, just like ctags, but provides more useful ways to query the code. It provides a simple commandline interface to query the codebase. You might want to configure Vim to use cscope for a more user-friendly interface.
$ sudo apt install cscope
$ cscope -R
This will produce a cscope.out file which is where the symbol cross-references are stored. In the interface, you can look up symbols, definition of a symbol, all instances of a function call and even do find-replace. To exit the interface, press Ctrl-D
.
$ cscope -R -b
$ cscope -b -f .some_cscope_file
$ cscope -i -b
$ cscope -i some_namefile -b
$ find -iregex '.*\.\(h\|hpp\|c\|cpp\|cu\)$' > .files_for_cscope
$ cscope -i .files_for_cscope -b
If you use these commands frequently, then wrap them up in a shell function for ease of use.
Tried with: Cscope 15.8b and Ubuntu 16.04