针对程序非崩溃错误难以被发现的问题,提出一种基于程序断言与切片技术的程序执行监测方法:根据程序执行过程中断言是否被违反来检测程序异常,并根据断言违反信息对反馈的程序异常进行自动分类;在程序切片技术的帮助下,对分类后的程序异常进行分析,判断程序是否真的出错并找到程序错误来源.实验结果表明,该方法可以有效地发现程序执行过程中发生的非崩溃错误,对程序异常进行合理的分类,约简程序代码和不变量,并将程序错误来源定位到具体的汇编指令,从而帮助程序员快速方便地找到错误来源.
To cope with the problem that non-crashing failures can hardly be detected, this paper proposes a novel program execution monitoring method based on program assertion and slicing technique. Program anomaly is detected by judging whether assertions are violated in the program execution process, and detected program anomalies are classified by assertion violation information. In addi- tion, with the assistance of program slicing, programmers can analyze the classified program anomalies, determine whether real fail- ures have happened, and find the source of failure. The experiment results show that the proposed method can effectively detect pro- gram non-crashing failures, reasonably classify program anomalies, reduce source code and invariants, and locate the source of failure to specific assembly statements, helping programmers to find the source of failure fast and easily.