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

5

55

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.

Karlynkarma answered 16/1, 2012 at 23:34 Comment(1)
Can you please add the output from doxygenStreamway
P
65

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.

Profile answered 17/1, 2012 at 2:19 Comment(5)
Apologies, I do have HAVE_DOT, CALL_GRAPH, and CALLER_GRAPH set to YES. By "PATH variable" I assume you mean in my shell because there doesn't appear to be one in my doxy cfg file. Yes, dot is in my path (i.e. 'which dot' works). I had not set EXTRACT_ALL or EXTRACT_STATIC. From the comments it doesn't seem like these would be relevant but I'm trying now. Thanks for your response.Karlynkarma
If for some reason doxygen can't find dot, you can manually set the path via DOT_PATH in your Doxyfile.Profile
This worked for me too. I'm disappointed that the Doxygen developers haven't thought through the default configuration values more carefully.Zacheryzack
EXTRACT_ALL and EXTRACT_STATIC worked for me too.Gradeigh
Yes, EXTRACT_* were also missing in mine.Zacheryzack
C
13

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

Chessman answered 12/7, 2021 at 4:51 Comment(0)
C
6

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

Caught answered 21/2, 2013 at 15:16 Comment(0)
A
6

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.

Affiche answered 3/7, 2013 at 10:45 Comment(1)
Sweet! Found them under Expert->Dot in doxywizard. Had to enable HAVE_DOT first.Froze
B
1

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.

Blunderbuss answered 22/7, 2016 at 19:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.