Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C/C++ source code visualization? [closed]

Doxygen is really excellent for this, although you will need to install GraphViz to get the the graphs to draw.

Once you've got everything installed, it's really rather simple to draw the graphs. Make sure you set EXTRACT_ALL and CALL_GRAPH to true and you should be good to go.

The full documentation on this function for doxygen is here.


I strongly recommend BOUML. It's a free UML modelling application, which:

  • is extremely fast (fastest UML tool ever created, check out benchmarks),
  • has rock solid C++ import support,
  • has great SVG export support, which is important, because viewing large graphs in vector format, which scales fast in e.g. Firefox, is very convenient (you can quickly switch between "birds eye" view and class detail view),
  • is full featured, impressively intensively developed (look at development history, it's hard to believe that so fast progress is possible).

So: import your code into BOUML and view it there, or export to SVG and view it in Firefox.

For the free version:

  • source is on Github as DoUML
  • Installers can be downloaded from http://www.bouml.fr/download.html

You can look at different tools for software design and modelling (Rational Rose, Sparx Enterprise Architect, Umbrello, etc). Majority of them have some functionality to reverse modeling by source code, and getting UML class diagrams, and sometimes even sequence diagrams (and this is very close to functions call graph).

But after you get some pictures on really big project code base you could realise that such graphs are rather hard to read and understand. Unfortunally visualization capabilities of complexity are very limited.

As for me, using a "divide and rule" idiom is more convinient approach. You can extract different functionality blocks or layers from your some code base (just sorting cpp-files by different folders sometimes enough). Another way is to use some scripts (bash, python) to create simple csv tables with interested parameters of files, classes or functions like "number of dependencies" etc).


If you use Visual Studio, the 2010 Ultimate release lets you generate sequence diagrams and dependency graphs. However, the release currently supports only .NET application projects.

The team has gotten lots of interest in supporting C++ in a future release, so you might want stay tuned. In the meantime, you can post in the VS 2010 Architectural Discovery & Modeling Tools forum at http://social.msdn.microsoft.com/Forums/en-US/vsarch/threads to request an update. I know the product team loves hearing customer feedback about the tools.

In the meantime, you can learn more about creating sequence diagrams and dependency diagrams from .NET code in the following topics:

How to: Find Code Using Architecture Explorer: http://msdn.microsoft.com/en-us/library/dd409431%28VS.100%29.aspx

How to: Generate Graph Documents from Code: http://msdn.microsoft.com/en-us/library/dd409453%28VS.100%29.aspx#SeeSpecificSource

How to: Explore Code with Sequence Diagrams: http://msdn.microsoft.com/en-us/library/ee317485%28VS.100%29.aspx

To try the RC release and provide feedback, download it at http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=457bab91-5eb2-4b36-b0f4-d6f34683c62a