Generate Call-Tree from cscope database

自闭症网瘾萝莉.ら 提交于 2019-12-03 05:55:20

if you want to do it using vim here is a way:

http://www.vim.org/scripts/script.php?script_id=2368

narcissist168

I've made an attempt to "fix" the call tree problem in cbrowser (see http://retprogbug.wordpress.com/2010/09/18/an-attempt-to-resuscitate-cbrowser-0-8/) though being a complete programming noob I make no guarantees.

kscope may be another option. I'm not sure if it will do everything specified, but it is fairly versatile for a GUI app.

Ubuntu users having trouble getting it running are advised to follow these instructions.

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.)

Circuitsoft

I'm not aware of any programs, other than cscope, that read cscope databases. Even vim's cstag functionality just starts a background cscope process which it queries.

As for call-graph generation, if you don't mind stepping outside cscope, I rather like what doxygen creates. They can be a little big, but it also generates the graph from almost all points, and it's incredibly easy to browse source directly in it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!