Is there a free and reliable tool similar to GNU cflow for Fortran that can generate call graphs? I am aware of Doxygen and profiling based workarounds using Valgrind Callgrind and KCachegrind (dynamic tools), but I would prefer static analysis tool, something like cflow that reads the source code directly and can generate Graphviz DOT output.
Thanks for sharing that. I have already read it, but my understanding is that it deals with dependencies. Whereas I am asking about generating call graphs: i.e., the function/subroutine call relationship extracted from the source code.
Edit: I’ve tested the NAG one before on the entire LAPACK and BLAS. I used some custom Python script for post-processing and plotting. Here showing the procedures as randomly positioned nodes with calls represented as edges between them (the arrows can’t be seen because of the poor image resolution; in case someone wants to create a string and nail art I can forward the SVG image , it would make a nice present for Jack Dongarra ).
Searching my list of Fortran tools, which has a Static Analysis category, for call.*graph gives the projects below. I don’t know how closely they meet your preferences.
fortrancallgraph: static source code analysis for Fortran, tracking variables in a routine’s callgraph, from fortesg fortran-callgraph: Tool to create call graphs from JULES source code FORTRAN_callgraph_browser: browsing tool that reads in a directory of Fortran code and displays it as an interactive graph, by Dan Ellis and Richard Rigby FortranTree: parses Fortran source code and creates a call tree graph with Python, by imaliyov. The code relies on pygraphviz and fparser.
Thank you for the suggestion. Actually, your repository was the first thing I looked at, but unfortunately I was disappointed because those tools seem unmaintained (last updated 5 years ago, and I doubt they are still reliable or even working).
creates a graph for RTL input, and “gfortran -fdump-rtl-expand” should generate RTL from Fortran. You would need Graphviz, gfortran, egypt, perl at least.
If you installed Intel OneAPI, you can run Intel Fortran under Visual Studio. In its debug mode, show ‘call stack‘, when you pause the code, it will generate the plot which is similar (or perhaps even better in my opinion) with what @davidpfister showed above.
Indeed and if you are to use the intel suite you can also go for vTune. It generates a flame chart that is a graphical representation of the call stack + elapsed time per function. But the method is dynamic and depends on the runtime option. The OP asked for something static though.