欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

Doxygen with Graphviz to generate call graph on Mac

发布时间:2025/3/15 编程问答 30 豆豆
生活随笔 收集整理的这篇文章主要介绍了 Doxygen with Graphviz to generate call graph on Mac 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

Doxygen and Graphviz

Doxygen
Doxygen is a documentation generator primarily used for c++ code. More on doxygen can be found here. http://www.doxygen.nl/

Graghviz
Doxygen can use the “dot” tool from graphviz to generate more advanced diagrams and graphs. Graphviz is an open-source, cross-platform graph drawing toolkit and can be found at http://www.graphviz.org/. This can do a lot more things but I have used it for my c project so using it to generate the call graphs.

Steps to generate call/caller graph

Install doxygen and Graphviz. I was using mac os macOS Mojave

1. brew install doxygen 2. brew install graphviz

Generate Doxyfile. Goto the project folder and do

doxygen -g

Edit the doxygen file to add the below configs

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

Note:

RECURSIVE is to consider the subfolders in the project. DISABLE_INDEX and GENERATE_TREEVIEW is to get rid of the index view in the html file that will get generated and have a tree like view. I like it this way. If you are ok with the default setting, can get rid of this option.

Run Doxygen

doxygen Doxyfile

The HTML and latex folders are generated now. You can access the index.html file from the browser to see the results.

Here is the call graph created for the inotify_add_watch system call implementation in Linux kernel

inotify_add_watch

总结

以上是生活随笔为你收集整理的Doxygen with Graphviz to generate call graph on Mac的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。