Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Program slicing by kumari nutan
1. KUMARI NUTAN
O901206358
UNDER THE GUIDANCE OF
ER. RAJESH KU. SAHOO
Seminar on:
pROGRAM SLICING TECHNIQUE
Represented by
AJAY BINAY INSTITUTE OF TECHNOLOGY, CUTTACK
BPUT, ODISHA
2. ABSTRACT
Slicing is a program analysis technique for
debugging and understanding programs.
Program slicing is potentially useful analysis for
aiding program understanding.
A program slice consists of the parts of a program
that potentially affect the values computed at some
point of interest. The task of computing program
slices is called program slicing.
3. CONTENTS
Introduction
Program Slicing basic idea..
Slices & Slicing criteria
Why program slicing useful?
How?
Intermediate Representation of programs for slicing
Slicing classification
Slicing properties
Applications of slicing
Characteristics
Conclusion
References
4. INTRODUCTION
Program slice is a subset of program .
Program slicing enables programmers to view
subsets of program.
Proposed as an approach to aid program
understanding task.
Original concept was introduced by “Mark Weiser”
in his Ph. D thesis (1979).
5. PROGRAM SLICING BASIC IDEA…..
Method used for abstracting from programs.
• Start with a subset of a program’s behaviour and
reduce it to a minimal from that still produces that
behavoiur.
The reduced program is called a “SLICE”.
Finding a slice is in general unsolvable .
6. SLICES & SLICING CRITERIA
Slicing criterion – a pair <i, v>
“i” is the number of the statement & “v” is the set
of variables to be observed at statement “i”.
Desirable properties of a slice:
Must have been got from the actual program by
deletion.
Must be syntactically correct .
Behavior of slice must corresponds to original
program behavior.
7. WHY PROGRAM SLICING USEFUL?
Debugging:
Slicing visualizes control and data
dependencies
It highlights statements influencing the slice
Testing:
Tests may be decomposed and test- work
gets faster and more efficient.
Software measurement & maintEnance , …..
9. HOW?
A slice is constructed by deleting those parts of a
program which is irrelevant to the program with
respect to the chosen set of variables at the chosen
point.
A slice is taken from a program with the slicing
criterion <s , v>, which specifies a location
(Statement s) and a variable (v).
10. slicing criterion is provided by the user
Source program Resulting
slice
Slice
Slicing
Criterion
indirectly
relevant
FLOW DIAGRAM
11. Intermediate Representation of programs for slicing:
Control Flow Graph (CFG)
Data Flow equations are solved
Program Dependence Graph (PDG)
Slice is computed as graph reachability
problem
12. Entry
x=1 i=0 while i<2
i++ if i<2
x=2 x=3
z=x
Control dependence edges
Data dependence edges
PROGRAM DEPENDENCE GRAPH
1. x=1;
2. i=0;
3. while (i<2) {
4. i++;
5. if (i<2)
6. x=2;
else
7. x=3;
8. z=x;
}
13. SLICING CLASSIFICATIONS
Types of slices
Static
Dynamic
Direction of slicing
Backward
Forward
Executability of slice
Executable
Closure
Levels of slices
Intraprocedural
Intrprocedural
14. SLICING PROPERTIES
Static Slicing
Slices derived from the source code for all possible
input values
No assumptions made on input
May leads to relatively big slice
Contains all statements that may affect a variable
for every possible execution
Result may not be usefull
15. SLICING PROPERTIES
Dynamic Slicing
Computed on a given input
Deterministic instead of Probabilistic
Useful for applications that are input driven
(debugging, testing)
16. BACKWARD STATIC SLICING
A backward slice of a program with respect to a
program point p and set of program variables V
consists of all statements and predicates in the
program that may affect the value of variables in V
at p
17. FORWARD STATIC SLICING
A forward slice of a program with respect to a
program point p and set of program variables V
consists of all statements and predicates in the
program that may be affected by the value of
variables in V at p
18. APPLICATIONS OF SLICING
Differencing
Debugging
Testing
Program understanding
Software maintenance
Complexity measurement
Program integration
Reverse engineering
Software Quality Assurance
19. CHARACTERISTICS
Advantages
Very easy and fast to compute a dynamic slice at
any execution point.
Disadvantages
Dynamic dependence graph is very large for real
programs…so, this scheme is not practical.