12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697(**************************************************************************)(* *)(* SPDX-License-Identifier LGPL-2.1 *)(* Copyright (C) *)(* CEA (Commissariat à l'énergie atomique et aux énergies alternatives) *)(* *)(**************************************************************************)letname="callgraph"includePlugin.Register(structletname=nameletshortname="cg"lethelp="automatically compute the callgraph of the program. \
Using Eva might improve the precision of this plug-in"end)moduleFilename=Filepath(structletoption_name="-cg"letarg_name="filename"letfile_kind="DOT"letexistence=Fclib.Filepath.Indifferentlethelp="dump the callgraph to the file \
<filename> in dot format"end)moduleServices=True(structletoption_name="-cg-services"lethelp="compute and display services (groups of related \
functions which seem to provide common functionalities) \
from the callgraph"end)moduleRoots=Kernel_function_set(structletoption_name="-cg-roots"letarg_name=""lethelp="if not empty, display only the functions of the callgraph \
reachable from the given functions"end)moduleService_roots=Kernel_function_set(structletoption_name="-cg-service-roots"letarg_name=""lethelp="when computing callgraph services (see "^Services.option_name^"), use the given functions (and their immediate children) \
as service roots. If none, use the main function if any; \
else use every uncalled function"end)moduleFunction_pointers=True(structletoption_name="-cg-function-pointers"lethelp="when Eva has not been computed, safely over-approximate \
callees in presence of function pointers; \
always done when Eva has been previously computed."end)moduleUncalled=True(structletoption_name="-cg-uncalled"lethelp="add the uncalled functions to the callgraph \
(the main function is always added anyway)"end)moduleUncalled_leaf=False(structletoption_name="-cg-uncalled-leaf"lethelp="add to the callgraph the uncalled functions that, \
themselves, do not call any function"end)letdumpoutputg=letfile=Filename.get()infeedback~level:2"dumping the graph into file %a"Fclib.Filepath.prettyfile;tryletcout=open_out(Fclib.Filepath.to_string_absfile)inoutputcoutg;close_outcoutwithe->error"error while dumping the syntactic callgraph: %s"(Printexc.to_stringe)