|
This article is cited in 2 scientific papers (total in 2 papers)
Analyzing C/C++ code entities and relations for program understanding
A. Belevantsev, E. Velesevich Institute for System Programming of the Russian Academy of Sciences
Abstract:
This paper describes the static analysis tool for finding program entities, their metrics, and relations between entities. Program entities are files/directories (physical structure) and classes/functions/methods/global variables (logical structure). Relations are connections between entities, such as calls, inheritance, aggregation, reading/writing, inclusion. The need for constructing such a tool arises from the program understanding problems. The basis of these problems’ solutions should be automatic extraction of necessary data from program source code. The tool implementing this extraction should support all C/C++ constructs and should scale to millions lines of code to be applicable to real life applications.
In the paper we concentrate on the methods for developing such a tool for C/C++ languages based on open source components: LLVM/Clang compiler infrastructure, GNU Binutils linker and archiver. The final whole-program analysis works on the LLVM internal representation (bitcode) level, so it is necessary to save the additional source level data in the bitcode files that is usually lost during compilation. We have made more than 400 patches to the Clang compiler in order to support this additional data storing and also to support many varieties of C/C++ dialects. For the main analyzer, the central component is a kind of linker that unifies the collected data for the same entities used in different program components (like an application and a library it uses). The correct entities unification performed by the linker allows to trace component relations more precisely.
Finally, we briefly present the results of testing our tool on Android OS.
Keywords:
program understanding, LLVM compiler, static analysis, code metrics.
Citation:
A. Belevantsev, E. Velesevich, “Analyzing C/C++ code entities and relations for program understanding”, Proceedings of ISP RAS, 27:2 (2015), 53–64
Linking options:
https://www.mathnet.ru/eng/tisp122 https://www.mathnet.ru/eng/tisp/v27/i2/p53
|
Statistics & downloads: |
Abstract page: | 234 | Full-text PDF : | 184 | References: | 37 |
|