生成调用图形对于C

生成调用图形对于C

本文介绍了生成调用图形对于C code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个工具,我需要生成一些C项目的调用图。
我可以使用铛生成一个文件的调用图,但我无法找出如何产生跨越包含几十头文件和源文件整个项目的调用图。

I'm writing a tool and I need to generate the callgraph for some C projects.I was able to generate the callgraph of one file using clang, but I was not able to find out how to generate the call graph across the whole project which contains tens of header and source files.

不限工具,可以生成调用图以可解析将细的文件。一个可用的库会更好。

Any tool that can generate the callgraph to a file that can be parsed will be fine. A usable library will be better.

推荐答案

另外值得一提的是,优秀的:

Also worth mentioning, the excellent GNU cflow:

GNU cflow的分析的C源文件的集合,并打印图形,图表程序中的控制流。

GNU cflow的是能够产生直接和反相flowgraphs对于C源。任选可以生成一个交叉引用列表。两种输出格式中实现:POSIX和GNU(扩展)

GNU cflow is able to produce both direct and inverted flowgraphs for C sources. Optionally a cross-reference listing can be generated. Two output formats are implemented: POSIX and GNU (extended).

输入文件可任选分析之前pprocessed $ P $。

Input files can optionally be preprocessed before analyzing.

修改

至于库请求。你可能会想调整 output.c 键,而不是印刷去做别的事情与数据。内部流程分为输出处理程序,所以我觉得写自己的处理程序已经可以做的伎俩。这不是现成的虽然。

Edit
As for the library request. You might like to "tweak" output.c and instead of printing do something else with the data. The internal flow is organised into output handlers, so I think writing your own handler could already do the trick. It's not out of the box though.

这篇关于生成调用图形对于C code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 03:41