Archive for October, 2012

Using cscope and cctree to analyze your C source code

Suppose you have your source in /my/sourcedir.

The simplest way to get a cscope database:
cd /my/sourcedir
cscope -R

This will create a cscope.out file which cscope can use as a database.

A more complicated but sometimes more useful way to create a cscope database:

  • Create a file called cscope.files in some directory (say /my/cscopedir) and put in the (preferably absolute paths of the files you want to be scanned by cscope, probably using find to automatically add files with a certain extension).
  • Do the following:

cd /my cscopedir
cscope -b

You can add a -q option to cscope to make a reverse lookup list which makes certain lookups a lot faster.

Tuesday, October 2nd, 2012 Uncategorized No Comments