Generate Call-Tree from cscope database

后端 未结 5 1983
我寻月下人不归
我寻月下人不归 2021-02-05 20:28

I want to generate Full and Partially Call Trees from cscope database of c and c++ projects in Linux.

The project is rather large, so it can be not easy to work with the

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-05 20:50

    I got this cscope-based Bash script to work in Cygwin & Windows: http://toolchainguru.blogspot.com/2011/03/c-calltrees-in-bash-revisited.html

    See example call "graph" (I've been calling it a call "tree", whoops). See example from the Linux kernel.

    It requires cscope (of course) and graphviz. It is able to do upstream and downstream graphs, as well as combined up & down graphs (see example).

    I haven't demonstrated it here but this method works really quite well on large projects where the same function might be defined in multiple directories. There will just be one node drawn for the same function name (so one "main" node even if you have multiple main()'s defined in your directory structure)---and you'll have multiple edges emanating from such a node, with file/line indicators. I found this aspect to be more useful than GNU cflow, which insisted on picking only one directory to look in. (The Jason Nyberg Bash script as is doesn't play well with threading, which GNU cflow handles nicely; something to keep in mind.)

提交回复
热议问题