针对程序中异常处理代码难以测试和维护、影响软件的健壮性和可靠性的问题,提出了一种评测程序中异常处理策略的方法.通过简化程序的控制流图,得到一种描述大型程序中异常处理结构的方法——异常传播图,并用实例验证了其有效性.根据程序的异常传播图,可以检测出程序中不可达的异常处理代码、找到控制异常传播的最佳位置、修正不合理的异常处理策略等.并给出了异常传播图的构造算法,为该方法实现自动化处理提供基础.
To solve the problems that the exception handling code is hard to test and maintain and that it affects the robustness and reliability of software, a method for evaluating the exception handling of programs is presented. The exception propagation graph (EPG) that describes the large programs with exception handling constructs is proposed by simplifying the control flow graph and it is applied to a case to verify its validity. According to the EPG, the exception handling code that never executes is identified; the points that are the most critical to controlling exception propagation are found; and the irrational exception handling code is corrected. The constructing algorithm for the EPG is given; thus, this provides a basis for automatically constructing the EPG and automatically correcting the irrational exception handling code.