first, the problem arisesThe recent need to analyze a very old project source code, the content of the source code is complex, and can not find more familiar with this code people. Here I first want to analyze the call relationship between the functions below, and then search the following methods from the Web: using Doxygen and Graphviz to come from the call relationship between the dynamic analysis functions.
ii. introduction of ToolsDoxygen: (http://www.stack.nl/~dimitri/doxygen/index.html)
Doxygen is the de facto standard tool for generating documentation from annotated C + + sources, but it also supports other Popular programming languages such as C, Objective-c, C #, PHP, Java, Python, IDL (Corba, Microsoft, and Uno/openoffice FLA VORs), Fortran, VHDL, TCL, and to some extent D.
It is a standard tool for generating documents from tagged c + + source code, and also supports C,OBJECTIVE-C,C#,PHP,JAVA,PYTHON,IDL,FORTRAN,VHDL,TCL.
Graphviz: (http://www.graphviz.org/)
Graphviz is open source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. It has important applications in networking, bioinformatics, software engineering, database and Web design, machine learn ING, and in visual interfaces for the other technical domains.
is an open-source tool for presenting structured information as an abstraction and a network for web, bioinformatics, software engineering, database and Web design, machine learning, and other technical areas of visual interface.
c. Generate function Call GraphInstall the two tools, and then easily analyze the code to generate the corresponding function call graph.
1) Open Doxywizard, pop-up Doxygen configuration interface. 2 The following figure, marked the main need to set the options
STEP1: Set up the working directory for Doxygen, which is mainly to build Doxygen running directory STEP2: Option settings, Wizard and expert options can be set at the same time. Wizard tab, select Project name as the project name, and in the future it will appear in the title of the document, select Source code directory, and set the directory where the sources are located, destination directory to set up the document Select scan recursively to recursively parse the source code within subdirectories in the source code directory.
3) I need to set the Expert tab because I need to parse the function call relationship from the source code without any tags.
As shown in the figure, check the function-related options in the Build option, Extract_all must check
As shown in the figure, because of the use of Graphviz, so to set the DOT option, tick Have_dot, and set Dot_path as the Graphviz bin directory. Tick call_graph and caller_graph to generate the function call graph.
4 finally select the Run tab and click Run Doxygen to generate the document file. 5 Open the document file, in the analysis of the function can see the function call graph.
Iv. SummaryThese two tools allow you to make a preliminary preparation for parsing code, or you can generate a more complete document for tagged code.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.