多语言源程序函数调用关系图的生成方法Construction of function calls relationship graph for multi-language source code
王亚刚;徐成华;
摘要(Abstract):
为了实现源码分析工具对多语言的支持,克服目前构建分析工具重用率低和实现复杂的弊端,提出一种多语言源程序函数调用关系图的生成方法。利用GNU编译器集合(GCC)的插件在GCC中间表示层Call-graph上提取函数调用关系,并将调用关系转换成图形描述语言,然后利用Graphviz画出函数调用关系图。所提方法与前端语言无关,可支持多种语言源程序函数关系的提取,且无需改动GCC编译器内部结构。实验结果表明,同Egypt方法相比,新方法在处理时间和存储代价方面都有明显的降低。
关键词(KeyWords): 编译器;源码分析;函数调用;插件
基金项目(Foundation): 国家自然科学基金重点资助项目(61136002)
作者(Author): 王亚刚;徐成华;
Email:
DOI: 10.13682/j.issn.2095-6533.2013.06.024
参考文献(References):
- [1]古辉,李荣荣.一种静态的Java程序函数调用关系图的构建方法[J].计算机系统应用,2012,21(5):209-212.
- [2]Ryder B G.Constructing the call graph of a program[J].IEEE Transactions on Software Engineering,1979(3):216-226.
- [3]Necula G C,Mcpeak S,Rahul S P,et al.CIL:Intermediate language and tools for analysis and transformation of C programs[C]//Compiler Construction.Berlin:Springer Berlin Heidelberg,2002:213-228.
- [4]Sxanth.NCC:The new generation C compiler[EB/OL].(2009-07-14)[2013-08-10].http://students.ceid.upatras.gr/~sxanth/ncc.
- [5]Stallman R.The GNU project[EB/OL].(2013-08-09)[2013-08-10].http://www.gnu.org.
- [6]逄龙,王甜甜,苏小红,等.支持多程序语言的静态信息提取方法[J].哈尔滨工业大学学报,2011,43(3):62-66.
- [7]林立,王毅刚,叶飞.基于GCC的C/C++源程序静态信息提取技术[J].计算机与数字工程,2011,39(2):152-155.
- [8]Gustafsson A.Egypt:create call graph from gcc RTL dump[EB/OL].(2012-04-14)[2013-08-10].http://www.gson.org/egypt/egypt.html.
- [9]Stallman R M.GNU Compiler Collection[EB/OL].(2013-08-09)[2013-08-10].http://gcc.gnu.org/GNU compiler.
- [10]Glek T,Mandelin D.Using gcc instead of grep and sed[C]//Proceedings of the GCC Developers’Summit.Ottawa,Ontario Canada:GCC Summit,2008:21-32.
- [11]Platform GNU.Plugins-GCC Wiki[EB/OL].(2013-07-14)[2013-08-10].http://gcc.gnu.org/wiki/plugins.
- [12]何涛,周会平,贾丽丽,等.GCC编译器中间代码层控制流扩充研究[J].计算机工程与科学,2012,34(2):73-77.
- [13]Merrill J.Generic and gimple:A new tree representation for entire functions[C]//Proceedings of the 2003GCC Developers’Summit.Ottawa,Ontario Canada:GCC Summit.2003:171-179.
- [14]Stallman R M.GNU compiler collection internals[EB/OL].(2013-08-08)[2013-08-12].http://gcc.gnu.org/onlinedocs/gccint/.
- [15]Wikipedia.DOT(graph description language)Wiki[EBOL].(2013-08-06)[2013-08-13].http://en.wikipedia.org/wiki/DOT_(graph_description_language).
- [16]Danial A.CLOC-Count Lines of Code[EB/OL].(2013-08-14)[2013-08-18].http://cloc.sourceforge.net.