c ++:生成函数调用树 [英] c++: generate function call tree

查看:440
本文介绍了c ++:生成函数调用树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想解析一个项目中的当前c ++文件,并列出其中的所有方法/函数,然后生成函数调用和调用程序树。
F.g.你可以参考doxygen如何生成调用树。

I want to parse current c++ files in a project and list out all the methods/functions in it and then generate the function call and caller trees. F.g. you can refer how doxygen generates the call tree.

我已经检查了gccxml,但没有列出从另一个函数调用的函数。

I have checked gccxml but it doesn't list the functions called from another function.

请给我建议一些我可以使用的轻量级工具(开源)。

Please suggest me some lightweight tools (open source) which I can use it.

谢谢!

推荐答案

静态调用树不一定是运行时调用树。回调和虚函数泥泞的水。所以静态分析只能给你部分的答案。

The static call tree isn't necessarily the runtime call tree. Callbacks and virtual functions muddy the water. So static analysis can only give you part of the answer.

我曾经能够得到一个可靠的调用树的唯一方法是在编译的可执行文件上运行gprof 。输出可以被按摩成非常精确的调用树。

The only way I've ever been able to get a reliable call tree was to run gprof on the compiled executable. The output can be massaged into a very accurate call tree.

这篇关于c ++:生成函数调用树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆