博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
program slicing
阅读量:5810 次
发布时间:2019-06-18

本文共 4554 字,大约阅读时间需要 15 分钟。

切片技术是程序中正向工程和逆向工程都比较常用的一种技术,低端的有程序切片,高端的有架构切片、模型切片

In , program slicing is the computation of the set of programs statements, the program slice, that may affect the values at some point of interest, referred to as a slicing criterion. Program slicing can be used in  to locate source of errors more easily. Other applications of slicing include , , , and .

Slicing techniques have been seeing a rapid development since the original definition by . At first, slicing was only static, i.e., applied on the source code with no other information than the source code.  and  introduced dynamic slicing, which works on a specific execution of the program (for a given execution trace). Other forms of slicing exist, for instance path slicing.

Contents

 
 [] 

Static slicing 

Based on the original definition of Weiser, informally, a static program slice S consists of all statements in program P that may affect the value of variable v at some point p. The slice is defined for a slicing criterion C=(x,V), where x is a statement in program P and V is a subset of variables in P. A static slice includes all the statements that affect variable v for a set of all possible inputs at the point of interest (i.e., at the statement x). Static slices are computed by finding consecutive sets of indirectly relevant statements, according to  and control dependencies.

静态切片的技术方法: 

As mentioned above slicing techniques are always based on some kind of dependence graph.Typical such structures are control flow graphs(CFG) and program dependence graphs (PDG)和interface dependence graphs(IDG)

静态切片技术的分析过程:

Example 

int i;int sum = 0;int product = 1;for(i = 0; i < N; ++i) {
sum = sum + i; product = product *i;}write(sum);write(product);

This new program is a valid slicing of the above program with respect to the criterion (write(sum),{sum}):

int i;int sum = 0; for(i = 0; i < N; ++i) {
sum = sum + i; }write(sum);

In fact, most static slicing techniques, including Weiser's own technique, will also remove the write(sum) statement. Indeed, at the statement write(sum), the value of sumis not dependent on the statement itself.

Dynamic slicing

Makes use of information about a particular execution of a program. A dynamic slice contains all statements that actually affect the value of a variable at a program point for a particular execution of the program rather than all statements that may have affected the value of a variable at a program point for any arbitrary execution of the program.

An example to clarify the difference between static and dynamic slicing. Consider a small piece of a program unit, in which there is an iteration block containing an if-else block. There are a few statements in both the if and else blocks that have an effect on a variable. In the case of static slicing, since the whole program unit is looked at irrespective of a particular execution of the program, the affected statements in both blocks would be included in the slice. But, in the case of dynamic slicing we consider a particular execution of the program, wherein the if block gets executed and the affected statements in the else block do not get executed. So, in this particular execution case, the dynamic slice would contain only the statements in the if block.

See also

  •  a tool which implements slicing algorithms on .

References 

  • . "Program slicing". Proceedings of the 5th International Conference on Software Engineering, pages 439–449,  Press, March 1981.
  • . "Program slicing". IEEE Transactions on Software Engineering, Volume 10, Issue 4, pages 352–357,  Press, July 1984.
  • Frank Tip. "A survey of program slicing techniques". Journal of Programming Languages, Volume 3, Issue 3, pages 121–189, September 1995.
  • David Binkley and Keith Brian Gallagher. "Program slicing". Advances in Computers, Volume 43, pages 1–50, , 1996.
  • Andrea de Lucia. "Program slicing: Methods and applications", International Workshop on Source Code Analysis and Manipulation, pages 142-149, 2001,  Press.
  • Mark Harman and Robert Hierons. "An overview of program slicing", Software Focus, Volume 2, Issue 3, pages 85–92, January 2001.
  • David Binkley and Mark Harman. "A survey of empirical results on program slicing", Advances in Computers, Volume 62, pages 105-178, , 2004.
  • Jens Krinke. "Program Slicing", In Handbook of Software Engineering and Knowledge Engineering, Volume 3: Recent Advances. , 2005

External links

  •  (part of Bandera checker)
  •  Extracting Business Rules/Program Slices from COBOL programs. (Web: )

转载于:https://www.cnblogs.com/maifengqiang/archive/2013/05/21/3090194.html

你可能感兴趣的文章
基于webservice实现的安全通讯架构
查看>>
java并发编程--Executor框架
查看>>
Java代理设计模式(Proxy)的四种具体实现:静态代理和动态代理
查看>>
android jni 引用第三方库
查看>>
List集合就这么简单【源码剖析】
查看>>
python多线程
查看>>
Django基本命令及modules举例
查看>>
云数据库RDS存储能力进化解析!
查看>>
环境变量PATH 、which命令、cp命令 、mv命令、文档查看cat/more/less/head/tail
查看>>
solidity开发以太坊智能合约时memory和storage的不同
查看>>
基于MaxCompute的数仓数据质量管理
查看>>
总是在路上
查看>>
JMeter - 利用 Ultimate Thread Group 的 Threads Schedule 配置压测场景计划
查看>>
十年架构师不到400行手写一个Spring MVC
查看>>
oracle 10g 创建新实例后,没有创建em的解决方案
查看>>
MongoDB基础知识
查看>>
Android学习笔记(一):TabHost存放多个Activity
查看>>
SystemClock简介
查看>>
vue多项目引用公共组件包传送门
查看>>
并行复制(MTS:enhanced Multi-threaded slave)
查看>>