南京大学学报(自然科学版)
南京大學學報(自然科學版)
남경대학학보(자연과학판)
JOURNAL OF NANJING UNIVERSITY(NATURAL SCIENCES)
2010年
1期
71-76
,共6页
审查%过程内数据流异常%有穷自动机%静态检测
審查%過程內數據流異常%有窮自動機%靜態檢測
심사%과정내수거류이상%유궁자동궤%정태검측
inspection%intra-procedural data flow anomaly%finite automaton%static detection
审查是预防代码缺陷的重要手段,但审查耗时,浪费人力,需要自动化工具对其进行辅助.数据流异常是审查中着重检查的缺陷之一,本文提出了一种基于有穷自动机的过程内数据流异常的检测方法.此方法首先对被测过程进行静态分析,得到被测过程的逻辑路径;而后基于有穷自动机和已获得的逻辑路径,通过每个数据项的状态迁移来判断数据流是否存在异常.本文介绍的方法面向审查,并不局限于某种特定的语言,并且一定程度上提高了数据流异常榆测和审查的效率.
審查是預防代碼缺陷的重要手段,但審查耗時,浪費人力,需要自動化工具對其進行輔助.數據流異常是審查中著重檢查的缺陷之一,本文提齣瞭一種基于有窮自動機的過程內數據流異常的檢測方法.此方法首先對被測過程進行靜態分析,得到被測過程的邏輯路徑;而後基于有窮自動機和已穫得的邏輯路徑,通過每箇數據項的狀態遷移來判斷數據流是否存在異常.本文介紹的方法麵嚮審查,併不跼限于某種特定的語言,併且一定程度上提高瞭數據流異常榆測和審查的效率.
심사시예방대마결함적중요수단,단심사모시,낭비인력,수요자동화공구대기진행보조.수거류이상시심사중착중검사적결함지일,본문제출료일충기우유궁자동궤적과정내수거류이상적검측방법.차방법수선대피측과정진행정태분석,득도피측과정적라집로경;이후기우유궁자동궤화이획득적라집로경,통과매개수거항적상태천이래판단수거류시부존재이상.본문개소적방법면향심사,병불국한우모충특정적어언,병차일정정도상제고료수거류이상유측화심사적효솔.
Code inspection plays an important role in constructing the quality of software product, but inspection wastes time and human resource, and needs assistant with some automated tools. Data flow anomalies is that the variable is used incorrectly in the code, and it means that there are potential errors in the code. Data flow anomalies is an important type of defects in the check list which is used during inspection, and it is also mainly focus on during inspection. Based on a review of data flow anomalies, the defects that relates with data flow anomalies can be found before running the program, and effectively improve software quality and reduce the cost of solving the software problems. Data flow anomaly should be inspected carefully during inspection, this paper issues a method for intra- procedural data flow anomaly auto-detection basing on finite automaton. First, data flow and variables in a program are closely related, there are three different kinds of method to use a variable: define, refer and kill. When the variables are used incorrectly, there are six types of data flow anomaly.Second, when the data flow anomalies in a code fragment are auto-reviewed, the code is analyzed statically and the abstract syntax tree of the code can be got. After that, from the syntax tree, there are some different logical paths that are made up of the statements in the code fragment, some of which are using variable.Finally, a finite automaton (Mealy) with four different states that is used to represent how a variable on the logical path is used is build. The automaton's input is the method with that the statement uses variable on the logical path and its output is whether the data flow anomaly exists. The state of the automaton will transfer if there are some inputs, and by the transition of the states, intra-procedural data flow anomaly should be found. The method introduced in the paper is language independent, faces to inspection, and improves the efficiency of Data flow anomaly detection and code inspection.