Download presentation
Presentation is loading. Please wait.
Published byΆδωνις Διδασκάλου Modified over 6 years ago
1
A Survey of Program Slicing Techniques: Section 4
Methods for Dynamic Slicing Krunal M. Jadeja
2
What is Program Slicing?
In computer programming, 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 debugging to locate source of errors more easily Other uses include software maintenance, optimization, program analysis and information flow control
3
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. Korel and Laski introduce how Dynamic slices can be computed
4
Basic Algorithms for Dynamic Slicing
Dynamic Flow Concepts Dynamic Dependence Relations Dependence Graphs
5
Dynamic Flow Concepts A dynamic slicing criterion is specified as a triple (x, Iq , V), where x denotes input of program, statement occurrence Iq is the qth element of the trajectory, and V is subset of variables of the program A dynamic slice is defined as an executable program that is obtained from original program by deleting zero or one statements
6
Requirements imposed on Dynamic Slice
The Statement corresponding to criterion Iq occurs in slice If a loop occurs in the slice, it is traversed the same number of times as in the original program
7
Example Trajectory for input n=2, (n=2, 81, {x})
8
Types of Dynamic Flow Concepts
The Definition Use(DU) relation associates a use of a variable with its last definition The Test Control(TC) relation associates the most recent occurrence of a control predicate with the statement occurrences in the trajectory that are control dependent on it. The symmetric Identity(IR) relation associates occurrences of same statements.
9
Example of types of Dynamic Flow Concepts
10
Dynamic Dependence Relations
Dynamic versions of Bergeretti and Carre’s information flow are introduced by Gopal For empty statements, assignments, and statement sequences, Gopal’s Dependence relations are same as static case For Dynamic Dependence relations, however, only the dependences that arise in a branch that is actually executed are taken into account.
11
Example of Dynamic Dependence Relations
Dynamic Slice computed w.r.to n=1
12
Dependence Graphs Agrawal and horgan developed an approach for using dependence graphs to compute dynamic slices They proposed two algorithms though they are inaccurate In first algorithm, the dynamic slice is computed by computing a static slice in subgraph of PDG that is induced by marked vertices This slice only contains vertices that were executed
13
Inaccurate as all vertices are marked, though x=18 is irrelevant
Example of Algorithm 1(PDG) Inaccurate as all vertices are marked, though x=18 is irrelevant
14
Dependence Graphs(contd.)
The second algorithm consists of marking edges as corresponding dependences arise during execution This method is still produces imprecise slices as it marks edges during loop executions, though it will recur or not This algorithm produces identical results as algorithm proposed by korel and laski
15
Solution to imprecise PDG algorithms
A third approach was taken into account which creates a distinct vertex in dependence graph for each occurrence of statement in execution history This is also called Dynamic Dependence Graph(DDG) A dynamic slicing criterion is identified with a vertex in the DDG, and dynamic slice can be computed by determining all vertices from where criterion can be reached
16
Example of DDG
17
Reduced DDG(RDDG) Disadvantage of DDG is number of vertices equals number of statements executed. Reduced DDG was proposed to reduce vertices in DDG Vertices for which transitive dependences map to same statements are merged RDDG have same preciseness as DDGs
18
Interprocedural Dynamic Slicing
Dynamic Dependence Summary graph is constructed during execution. The vertices of graph are referred to as procedure instances The edges of graph refer to procedure calls or summary dependences Slicing criterion is defined as a pair consisting of procedure instance and an input or output parameter of associated procedure
19
Interprocedural Dynamic Slicing(contd.)
Three approaches are considered for creating summary graphs Static Dynamic Combined Static/Dynamic
20
Approaches for creating Summary Graphs
Static: Intraprocedural data dependences are determined statically, which may be inaccurate in presence of conditionals Dynamic: Dependences are determined at run time, but requires re computation every time when procedure P is called Combined Static/Dynamic: Attempts to make use of efficiency of static approach with accuracy of dynamic approach. It computes dependencies statically inside block while computing inter-block dependencies dynamically
21
Dynamic Slicing of Distributed Programs
A dynamic slicing criterion of a distributed program specifies: Input of each task A distributed program path P A task w A statement occurrence q in trajectory of w A variable v A dynamic slice with respect to such criterion is executable projection of program
22
Dynamic Slicing of Distributed Programs(contd.)
A distributed program P consists of a set of processes P1,…,Pn. Communication between processes is assumed to be synchronous and non deterministic and is expressed by way of send and receive statements. A dynamic slice criterion (I1,X1), (I2,X2),…, (In,Xn) specifies process Pi, its input Ii, and set of statements Xi. A distributed dynamic slice S is executable set of processes P1’,…,Pn’
23
Overview of Dynamic Slicing Methods
24
References http://en.wikipedia.org/wiki/Program_slicing
F. Tip, A Survey of Program Slicing Techniques, CS-R9438, Computer Science/Department of Software Technology, 1994
25
QUESTIONS
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.