user501138
user501138

Reputation: 899

how to get doxygen to produce call & caller graphs for c functions

I've spent some time reviewing the docs and going through my doxy config file from end to end. I cut doxygen loose on my config file and it produces documentation and indices for structs and cpp classes but I don't see call or caller graphs for the multitude of c functions in my source tree.

Can anybody tell me how to configure doxygen to produces these call and caller trees ? I do have graphviz installed.

Upvotes: 56

Views: 65987

Answers (5)

Trees
Trees

Reputation: 1283

For MacOS users:

Install Doxygen and Graphviz as:

brew install doxygen
brew install graphviz

Go to your project folder, and from Terminal set to this path run

doxygen -g

A doxygen file will be generated, named as Doxyfile. Go ahead and open up this file in any editor and find these parameters and replace their values to YES at their locations:

HAVE_DOT               = YES
EXTRACT_ALL            = YES
EXTRACT_PRIVATE        = YES
EXTRACT_STATIC         = YES
CALL_GRAPH             = YES
CALLER_GRAPH           = YES
DISABLE_INDEX          = YES 
GENERATE_TREEVIEW      = YES
RECURSIVE              = YES

You can also set name of your project in this Doxyfile. Save the file and then run this command in the terminal:

doxygen Doxyfile

This will generate two more folders named as html and latex. Go to the html folder and open annotated.html to view all details of your project. You will also view png images of the call graphs embedded in the html that are relevant (to some functions/classes for example).

Upvotes: 13

kikeenrique
kikeenrique

Reputation: 2669

doxywizard is also useful. It gives you all the options in a GUI. Selecting any option shows quick help about that option.

You might also be interested in COLLABORATION_GRAPH or GRAPHICAL_HIERARCHY.

Quite convenient.

Upvotes: 6

Michael Fayad
Michael Fayad

Reputation: 1336

I had the same problem for my C global functions. Enabling CLANG_ASSISTED_PARSING did help display callgraphs for some functions, yet not all of them.

Upvotes: 1

mckillip
mckillip

Reputation: 61

Setting the path to "dot" (/usr/local/bin/) via the "Expert" tab controls in the GUI did the trick!

Upvotes: 6

pezcode
pezcode

Reputation: 5759

You have to set HAVE_DOT, CALL_GRAPH and CALLER_GRAPH to YES. Also make sure the path to dot is in your PATH variable.

If that still doesn't work, you might have to set EXTRACT_ALL and/or EXTRACT_STATIC, depending on your functions.

Upvotes: 66

Related Questions