views:

3234

answers:

9

Basically I want tools which generate function call graph, dependency graph etc.

+2  A: 

Try doxygen

Example output from Xerces

epatel
+2  A: 

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

Steve M
+21  A: 

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, and it also has a useful example.

Andrew Wilkinson
Sweet. Very straightforward to use. GraphViz modifies your system path, and doxygen uses it.
bobobobo
+1 I agree. Doxygen is a very useful tool when exploring existing code. Check the option that generate source code and you easily navigate through your codebase without opening your code-editor ...
neuro
+3  A: 

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

AndreyBark
+1 good remark.
neuro
+5  A: 

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.

+1 for a free UML tools that deserve to be tried.
neuro
+1  A: 

There is an old tool called CDOC that we still use to generate call trees.

epotter
+1  A: 

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

Esther Fan - MSFT
A: 

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

baris_a
A: 

CppDepend is very useful for this kind of needs, CppDepend provides a CQL language to query the code base like SQL, for example you can execute requests like:

WARN IF Count > 0 IN SELECT TOP 10 METHODS WHERE CyclomaticComplexity > 20 ORDER BY CyclomaticComplexity DESC

CppDepend provides also many useful views; like Dependency graph, matrix graph and metric view

Issam