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

June 2024 ยท 3 minute read

Basically I want tools which generate source code visualization like:

3

7 Answers

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.

3

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

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

For the free version:

2

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).

0

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

Try doxygen

Example output from Xerces

Might be a duplication, but check out ollydbg, IDA Pro and this website has a whole bunch of resources with some very sexy images.

In addition to written tools above, you may try understand. But, it is not free.

1

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJoaXBwZWx8pHnCZqqoraKYsm6vzp2cZq6ZqMKiuMizmK2hn6M%3D