使用Doxygen + Graphviz可视化一个巨大的C ++项目 [英] Visualizing a huge C++ project using Doxygen + Graphviz

查看:150
本文介绍了使用Doxygen + Graphviz可视化一个巨大的C ++项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承了一个大型C ++项目,需要将其移植到Linux.该项目中有200,000行源代码,分布在300多个文件中.为该项目引用一个可视化的依赖项/包含树将非常有帮助,这样我就可以对应用程序的内部结构有一个大致的了解.这也将帮助我在核心模块和Windows头文件之间找到故障线",以便以后将其存根.

I've inherited a large C++ project which I need to port to Linux. There are over 200,000 lines of source in this project spread across more than 300 files. It would be tremendously helpful to have a visual dependency/include tree to refer to for this project so that I can get a general feel for the application's internal structure. This would also help me to locate the "fault lines" between the core modules and Windows header files so that I can stub them out later.

Visual Studio中的类查看器根本无法实现.我四处阅读,并了解到Doxygen是列出依赖项的常用工具.我更像一个有视觉感的人,发现这并没有那么大的帮助.幸运的是,我学习了Graphviz插件,它使用一种称为点"的东西使我能够为零件生成依赖关系树.不幸的是,为特定文件生成了数百个较小的依赖树,而不是像我希望的那样拥有一大棵.这里有几个例子:

The class viewer in Visual Studio simply isn't cutting it. I was reading around, and learned that Doxygen is a commonly used tool for listing dependencies. I'm much more of a visual person, and found that this wasn't so helpful. Fortunately, I learned about the Graphviz plugin, using something called "Dot" that has enabled me to generate dependency trees for parts. Unfortunately, hundreds of smaller dependency trees are generated for specific files, rather than having one large one as I'd hoped for. Here are a couple of examples:

如您所见(我希望),当图形过大并使子节点变灰时,Doxygen/GraphViz似乎放弃了.然后,如果我想查看树下的内容,则必须转到该特定节点的图.这不仅限制了图形的视觉帮助,而且如果子节点依赖于原始图形中的任何节点,这些节点将再次显示.这导致大量重复的连接,这使得从概念上将图与任何给定文件隔离非常困难.结果,我觉得自己放大"了,但仍然看不到整个图片.

As you can see (I hope), Doxygen/GraphViz seem to give up when the graph gets too large and gray out the child nodes. I then have to go to the graph for that specific node if I want to see what's further down the tree. Not only does this limit the visual helpfulness of the graph, but if the child node depends on any of the nodes from the original graph, these nodes will be shown again. This is leading to lots of duplicate connections that make it very hard to conceptually isolate the graph from any given file. As a result, I feel like I'm "zoomed in" and still can't see the whole picture.

我尝试在Doxygen的专家"视图中使用DOT_GRAPH_MAX_NODES设置,但这似乎并不影响所生成图形的范围.从任何给定运行生成的输出中,似乎Doxygen本身正在生成数百个图形文件,而Graphviz只是忠实地为每个图形文件生成图形.有什么已知方法可以使Doxygen生成一个大图形文件而不是数百个较小的图形文件?

I've tried playing around with the DOT_GRAPH_MAX_NODES setting in the Expert view in Doxygen, but this doesn't seem to affect the scope of the graphs that are being generated. From the output generated from any given run, it seems like Doxygen itself is generating hundreds of graph files, and Graphviz is just faithfully generating graphs for each one. Is there any known way to make Doxygen generate one large graph file instead of hundreds of smaller ones?

或者,有没有免费的可视图形解决方案,它们知道如何使用嵌套的预处理程序指令,MIDL接口以及Doxygen手动定义的包含路径来处理复杂的C ++项目文件?

Alternatively, are there any free visual graphing solutions out there which know how to handle complicated C++ project files with nested pre-processor directives, MIDL interfaces, and manually defined include paths the way Doxygen does?

我的搜索正在找到通用的绘图实用程序(或有关它们的问题),但没有特定于 large C ++项目的内容.当然,多年来的所有编码工作都必须有人使用这种工具!

My searches are finding general graphing utilities (or questions about them), but nothing specific to large C++ projects. Surely with all the coding that's been done over the years somebody must have such a tool!

谢谢,-亚历克斯

推荐答案

您可以使用doxygen生成的XML文件,并将它们合并为单个巨型点格式图形文件(使用xml样式表或类似文件),然后运行graphviz在上面.

You can use the XML files generated by doxygen, and merge them into a single giant dot-format graph file (using xml stylesheet or similar), then run graphviz on it.

当图表数量很大时,Doxygen自动调用graphviz最为有用.对于单个图形,自动创建内容很重要,但是自动调用 dot 并不是那么重要.

Doxygen automatically invoking graphviz is most useful when the number of graphs is high. For a single graph, automatically creating the content is important, but automatically calling dot, not so much.

这篇关于使用Doxygen + Graphviz可视化一个巨大的C ++项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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