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

51,695

Solution 1

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.

Solution 2

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.

Solution 3

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

Solution 4

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

Solution 5

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.

Share:
51,695

Related videos on Youtube

user501138
Author by

user501138

Updated on July 12, 2021

Comments

  • user501138
    user501138 almost 3 years

    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.

    • Neox
      Neox over 12 years
      Can you please add the output from doxygen
  • user501138
    user501138 over 12 years
    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.
  • pezcode
    pezcode over 12 years
    If for some reason doxygen can't find dot, you can manually set the path via DOT_PATH in your Doxyfile.
  • Sridhar Sarnobat
    Sridhar Sarnobat over 10 years
    This worked for me too. I'm disappointed that the Doxygen developers haven't thought through the default configuration values more carefully.
  • flyrain
    flyrain over 10 years
    EXTRACT_ALL and EXTRACT_STATIC worked for me too.
  • Sridhar Sarnobat
    Sridhar Sarnobat about 10 years
    Yes, EXTRACT_* were also missing in mine.
  • thomasa88
    thomasa88 over 7 years
    Sweet! Found them under Expert->Dot in doxywizard. Had to enable HAVE_DOT first.