Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
有一个 clang 静态分析器,它是 llvm 的 clang 前端的一部分,但我不知道它对于 C/C++ 的效果如何。看起来他们的大部分精力都花在了 Objective-C 上。
http://clang-analyzer.llvm.org/
Doxygen 非常适合调用图,你'您需要安装 GraphViz 并使用 doxywizard 在图表部分中选择调用图和由图调用复选框(专家模式点部分中的 CALL_GRAPH 和 CALLER_GRAPH。)
There is the clang static analyzer which is part of the clang front end for llvm, but I don't know how well it works for C/C++. It seems most of their effort is going towards Objective-C.
http://clang-analyzer.llvm.org/
Doxygen is good for call graphs, you'll want to have GraphViz installed and use doxywizard to select the Call graphs and Called by graphs tick boxes in the Diagrams section (CALL_GRAPH and CALLER_GRAPH in the expert mode Dot section.)
您可能会发现 SourceMonitor 有助于对代码进行更多统计分析,而且它是免费的:)
You might find SourceMonitor helpful for more statistical analysis for code, plus its free :)
尝试 Klocwork。它包含您可能需要的有关 C/C++ 源代码的所有细节以及更多内容。
Try Klocwork. It has every gory detail you could ever need about C/C++ source code plus much much more.
我们的 DMS 软件再工程工具包及其 C 前端 和 C++前端可以提供很多关于C和C++程序的信息。
具有 C 前端的 DMS 可以解析大量 C 源文件,构建完整的 AST(甚至捕获注释)和符号表,并提供 控制和数据流分析,带有指向分析和调用图。 C++ 前端构建 AST 和完整符号表,但尚未提供所有流分析信息。
DMS 提供调用解析器/流分析器的工具;您提供一些自定义代码来提取您想要的信息。
它具有修改 AST 和重新生成可编译源代码的附加功能。
我想您会发现,没有一个可以提取精确自定义数据的工具是“容易”使用的;由于复杂的语言语义,您提出的问题和答案的本质有很多复杂性。
Our DMS Software Reengineering Toolkit with its C front end and C++ Front End can provide a lot of information about C and C++ programs.
DMS with the C front end can parse large sets of C source files, build complete ASTs (even capturing comments) and symbol tables, and provide control and data flow analysis, with points-to analysis and call graphs. The C++ front end builds ASTs and full symbol tables, but does not yet provide all the flow analysis information.
DMS provides facilities to invoke the parsers/flow analyzers; you provide some custom code to extract the information you want.
It has the additional capability of modifying the ASTs and regenerating compilable source code.
I think you'll find that no tools for which you can extract precise custom data are "easy" to use; the very nature of the questions you ask and the answers have lots of complications caused by the complex language semantics.
您可以尝试基于 CLang 的CppDepend。这是一个很好的工具。
它提供了 60 个指标(当然包括您需要的函数:函数/类列表、调用者、被调用者、依赖图……)。
You can try CppDepend based on CLang. It is a good tool.
It gives 60 metrics (including of course the functions you need : list of functions/classes, callers, callees, dependency graph,...).
Sonar 是一个非常好的 Java 项目分析器。它现在支持一些其他语言,包括 .网。在这篇博文的最后,你可以看到一个C插件即将发布......
Sonar is a really good Java projects analyzer. It now supports some other languages, including .Net. At the end of this blog post, you can see that a C plugin will be released soon...
Polyspace静态分析工具可以显示函数、调用者、被调用者、变量引用、全局变量读/写。您能够深入了解数据结构以确定访问发生的位置。信息以文本和图形格式显示。可变范围信息也被确定。更多信息请参见在线用户指南。链接到下面给出的部分之一:
http: //www.mathworks.com/help/toolbox/polyspace/c_ug/brz384r-12.html#brz384r-17
免责声明:我在 MathWorks 工作,MathWorks 是 Polyspace 静态分析工具的制造商。
The Polyspace static analysis tool can display functions, callers, callees, variable references, global variable reads/writes. You have the ability to drill down into data structures to determine where the access occurs. Information is displayed in both text and graphical format. Variable range information is also determined. More information in the online user guide. Link to one of the sections given below:
http://www.mathworks.com/help/toolbox/polyspace/c_ug/brz384r-12.html#brz384r-17
Disclaimer: I work for MathWorks, the makers of the Polyspace static analysis tool.