Cool Links‎ > ‎

C program Call Graph


Makes a C function call tree as Graphviz DOT file from CScope output.

Go to your sources root directory and do:
$find . -name "*.c" > cscope.files
    #that will recurse subdirectories and list all C files in cscope.files.

$cscope -b -c -R
    #(build the cross reference only, don't compress it, recurse);

$./tceetree -V -i cscope.out
    #run tceetree with cscope.out as input (default) to get tceetree.out (DOT language representation of function call tree);

$dot -Tpng -O tceetree.out
    #to get a graphical representation of the tree in tceetree.out.png.

There are a lot of options you can specify when invoking dot to customize the graph, for example:

  • you can change output format e.g. to pdf: 

$dot -Tpdf -O tceetree.out

  • you may modify layout from left to right instead of top to bottom:

$dot -Grankdir=LR -Tpng -O tceetree.out

  • you may modify graph, nodes and edges font:

$dot -Gfontname=Helvetica -Nfontname=Helvetica -Efontname=Helvetica -Tpng -O tceetree.out

  • see dot.1.pdf and dotguide.pdf within Graphviz documentation for many other options.