通过调用栈提取当前调用上文信息,对传统的静态程序切片约简,可获得基于调用栈的程序切片,进行有效的程序调试.针对目前该切片计算需构造系统依赖图(SDG)而造成大程序分析效率较低等问题,提出相关子程序分析算法,通过仅分析程序中部分与切片标准相关的子程序,而不是所有子程序来提高分析效率,同时提出一种组合式基于调用栈的程序切片方法进行切片计算.组合式程序切片方法以子程序为依赖性分析单位,程序依赖图由相互独立的子程序依赖图组合而成,子程序对外接口由参数间依赖关系实现,通过实参和形参之间的映射实现子程序间的分析.对3个不同规模的程序进行实验,相关子程序平均数为总子程序数的0.03%~17.1%,表明该方法可有效减少分析时间,提高调试响应速度.
Slicing based on call stacks reduces the size of static slice by leveraging the information of call stacks and then extracting current calling context.It is an effective technique to debug programs.In the traditional slicing method,system dependence graph is required to be constructed,which leads to high time overhead,especially for large programs.To enhance analysis efficiency,it is proposed that only partial procedures relevant to slicing criteria,instead of all procedures,are analyzed.An algorithm for identifying procedures related to slicing criteria is first presented and then a combinational slicing approach based on call stacks.During the slicing process,procedure is basic unit for dependence analysis and program dependence graph is a combination of dependence graphs for all independent procedures.Interfaces between procedures are realized by dependences among parameters and inter-procedure analysis is obtained by mapping actual to formal parameters or vice versa.This approach was applied to three programs with different size.Average ratio of the number of relevant procedures to that of the total is 0.03% to 17.1%.It shows that our approach is beneficial for reducing analysis time and hence improved debugging response effectively.