A package for analyzing source-code callgraphs, particularly of Julia's
The main motivation for this package was to aid in finding all functions that might
trigger garbage collection by directly or indirectly calling
the package has broader uses.
You'll also need to have
clang++ installed, as well at the corresponding
On the author's machine,
opt is called
Analyzing a source repository
Extracting the callgraph
An example script is
callgraph_jlsrc.bash, which is set to analyze julia's
It should be called from within that directory. You may need to change the
to match your system. This script can be modified to analyze other code repositories.
This writes a series of
*.dot files. These
*.dot files are then analyzed by
the julia code in this repository.
Analyzing the callgraph
The most general approach is
using CallGraphs cgs = parsedots() # or supply the dirname calls, calledby = combine(cgs...)
This will merge data from all the
*.dot files in the directory into a single
combine are both described in online help.
If your main interest is analyzing the callgraph of julia's garbage collection, you will likely be more interested in
using CallGraphs gcnames = findgc() highlight(srcfilename, gcnames)
which produces output that looks like this:
Shown in red are all functions that might trigger a call to
The general principle is to look for cases where one line's allocation is not protected from
a later garbage-collection.
You can save a (crude) emacs highlighting file with
which you can
M-x load-file after opening a C file.