I am working on a project which requires the understanding of llvm compiler source-code. To browse source code of llvm, I tried to use cscope with following command in the root directory of the source:
cscope -R *
But it doesn't work. As there are mainly .cpp and .h files but some .c files are also there. So now I don't have a clue how to make cscope work? Can someone please help?
I have following in my .bashrc which make things easier. Run
cscope_build()
to generate data base andcscope
to start cscope tool.Just because this is still the most popular entry. The stdin thingy may have been added in the meantime or not, but it makes it kind of elegant:
To cover our large code base I have a script that looks a bit like this to build cscope indexes. The reason I change to / is so that I have full file paths to the source files which makes things work a little smoother.
Also it may be worth checking out http://cscope.sourceforge.net/cscope_vim_tutorial.html
A convenient way to list all
C++
files in a project is to use the ack tool: a grep-like command optimized for source code searching (In some distributions, for instance Ubuntu, the tool is calledack-grep
). You can run it like this:The output are paths to all
.cpp
,.h
,.cc
.hpp
filesYou can use following commands to do the required task from the root directory of llvm source tree:
It would create cscope.out file which is used with cscope to browse the code. Hope it helps!