引用本文: | 封战胜,苏小红,马培军.从GCC的AST文本提取C源程序静态信息的方法[J].哈尔滨工业大学学报,2010,42(7):1100.DOI:10.11918/j.issn.0367-6234.2010.07.020 |
| FENG Zhan-sheng,SU Xiao-hong,MA Pei-jun.Extraction of static information of C program from GCC abstract syntax tree text[J].Journal of Harbin Institute of Technology,2010,42(7):1100.DOI:10.11918/j.issn.0367-6234.2010.07.020 |
|
摘要: |
为了能够正确的分析源程序的控制依赖关系和数据依赖关系,以便在此基础上进行程序切片及冗余代码和重复代码检测,提出一种利用GCC抽象语法树(AST)文本来提取源程序静态信息的方法.首先,对GCCAST文本进行标准化及消除文本中与控制流分析和数据流分析无关的结点信息;其次,构建控制依赖子图;同时如果需要数据流分析,在控制依赖子图的基础上构建控制流图,在控制流图的基础上构建数据流子图;最后通过引入过程间分析来完善系统依赖图.实验结果表明,这种方法基本能正确的分析源程序的控制依赖和数据依赖关系,具有更好的适应性和灵活性. |
关键词: 程序静态分析 AST 控制依赖 数据依赖 控制流图 系统依赖图 |
DOI:10.11918/j.issn.0367-6234.2010.07.020 |
分类号:TP391.1 |
基金项目:国家自然科学基金资助项目(60673035) |
|
Extraction of static information of C program from GCC abstract syntax tree text |
FENG Zhan-sheng, SU Xiao-hong, MA Pei-jun
|
School of Computer Science and Technology,Harbin Institute of Technology,Harbin 150001,China
|
Abstract: |
In order to correctly analyze the control dependence and data dependence relations of C program,and then carry out the program slicing,code redundancy and code duplication detection,a method to extract the static information of C program from GCC AST text was put forward.Firstly,the GCC AST text was standardized and the nodes unrelated to control dependence and data dependence analysis were eliminated.Secondly,control dependence subgraph was constructed.If data flow analysis was necessary,control flow graph was constructed based on control dependence subgraph and data dependence subgraph was constructed based on control flow graph.At last,by the introduction of inter-process analysis,system dependence graph was improved.It is indicated that the research can correctly analyze the control dependence and data dependence relations. |
Key words: program static analysis abstract syntax tree(AST) control dependence data dependence control flow graph system dependence graph |