SlideShare a Scribd company logo
Indian Institute of Technology, Kharagpur
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Presented By-
Ankur Jain (13CS60D02)
Programmer’s Nightmare…
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
If I change this statement in program:
What other statements would be affected?
(Impact analysis)
What other statement needs to be tested?
(Regression test)
The values live at this statement:
Defined where?
Modified Where?
(Manual Checking)
How can I abstract code?
Studies show….
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Software testing contributes more then
50% of cost and time of SDLC
Maintainers spend nearly 50% of their
time trying to understand the program
Source: http://www.ece.cmu.edu/~koopman/des_s99/sw_testing/
Try...
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Program Slicing!
Outline
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
 Introduction
 Types of Slicing
 Program Models
 Flow based
 Dependency based
 Slicing Algorithms
 Challenges
 Directions of research
Proposed by…
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
 Proposed by Mark Weiser in 1981
 Chief scientist at Xerox PARC
 As his PhD thesis
 Father of ubiquitous computing
Mark D. Weiser
(July 23, 1952 - April 27, 1999)
Basic Concepts…
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
“For statement S and variable V, the slice of program P
includes only those statements of P needed to capture the
behavior of V at S.”
Slicing Criterion (SC):
<S, V>
S = Point of interest in the program (statement)
V = Subset of variables used in the program
A program slice is a subset of a program
Example…
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
1 begin
2 read(x, y)
3 total := 0.0
4 sum := 0.0
5 if x <= 1
6 then sum := y
7 else begin
8 read(z)
9 total := x*y*z
10 end
11 write(total, sum)
12 end
SC = <11, sum>
2 read(x, y)
4 sum := 0.0
5 if x <= 1
6 then sum := y
Slicing Criterion
Why is Program Slicing Useful?
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
• Program slices are more manageable for
testing and debugging
• During testing, debugging, or understanding a program,
most of the code in the program is irrelevant to what you
are interested in.
• Program slicing provides a convenient way of filtering out
“irrelevant” code.
Slice Variants…
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Types of slices:
 Static
 Dynamic
Direction of slice:
 Forward
 Backward
Executability of slice:
 Executable
 Non-executable
Amorphous, etc.
Froward Slices Vs Backward Slices
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Statements which might affect
the value of variables in V
Statements which might be
affected by the values of
variables in V
int i, sum, prd;
1. read(i);
2. prd = 1;
3. sum = 0;
4. while (i<10)
5. sum = sum + i;
6. prd = prd * i;
7. i = i + 1;
8. write(sum);
9. write(prd);For SC = <9, prd>
Slice: {1, 2, 4, 6, 7}
For SC = <2, prd>
Slice: {6, 9}
Backward Slices:
Froward Slices
Static Slice | Dynamic Slice
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Using dynamic information
(an execution trace)
Debugging
Set of all statements that actually
affect the value of a variable at a
program point
Using static information
(a source program)
Regression Testing
Set of all statements that may
affect the value of a variable at a
program point
Example…
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
int i, sum, prd;
1. read(i);
2. prd = 1;
3. sum = 0;
4. while (i<10)
5. sum = sum + i;
6. prd = prd * i;
7. i = i + 1;
8. write(sum);
9. write(prd);
Static Slice
{1, 2, 4, 6, 7}
Dynamic Slice
For Input ‘i’ = 15
{2}
For Slicing Criteria [SC] = <9, prd>
Flow based model:
Control flow
 Data flow
Dependency based model:
 Data Dependency
 Control Dependency
Slicing Criterion
Dependency Based Model
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Program Code
Control Flow
Graph
(CFG)
Data
Dependency
Graph (DDG)
Program
Dependency
Graph (PDG)
Forward
Dominance Tree
Control
Dependency
Graph (CDG)
Data Dependency Graph (DDG)
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
int a, b, sum;
1. read(a);
2. read(b);
3. sum = 0;
4. while(a<8)
5. sum = sum + b;
6. a = a + 1;
7. write(sum);
8. sum = b;
9. write(sum);
4 5
6
7
8
9
21 3
Data Dependency Graph
Control Flow Graph (CFG)
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
int a, b, sum;
1. read(a);
2. read(b);
3. sum = 0;
4. while(a<8)
5. sum = sum + b;
6. a = a + 1;
7. write(sum);
8. sum = b;
9. write(sum);
Start
1
Stop
4
5
3
6
2
8
7
9
True
False
True
True
True
True
True
True
True
True
True
Dominance
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Let X and Y be two nodes in a Control flow graph
X dominates Y
If and only if
Every path from Start to Y passes through X
Y forward dominates X
The forward Dominance Tree (FDT)
1. Vertices represent statement
2. Root node of tree is exit node of the CFG
3. Arcs represent immediate forward dominance
Forward Dominance Tree (FDT): Using CFG
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
9
4 6
7
5
8
2
3
1
Start
1
Stop
4
5
3
6
2
8
7
9
True
False
True
True
True
True
True
True
True
True
True
Control Dependency Graph: Using CFG & FDT
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
4
5 6
7
8
9
2
1
3
S
1. Y is control dependent on X
2. Path in the CFG from X to Y
3. Doesn’t contain the
immediate forward
dominator of X
Y
X
X
Ifdom(4)=7
X
Y
Control Dependency Graph (CDG)
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
int a, b, sum;
1. read(a);
2. read(b);
3. sum = 0;
4. while(a<8)
5. sum = sum + b;
6. a = a + 1;
7. write(sum);
8. sum = b;
9. write(sum);
4
5 6
7
8
9
2
1
3
S
Program Dependency Graph (PDG)
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
int a, b, sum;
1. read(a);
2. read(b);
3. sum = 0;
4. while(a<8)
5. sum = sum + b;
6. a = a + 1;
7. write(sum);
8. sum = b;
9. write(sum);
Union of CDG and DDG
1
4
6
5
8
29
3
7
Data dependence
Control dependence
Limitation: A PDG can model programs with a single
function Not suitable for inter-procedural slicing
System Dependency Graph Model: by- Horwitz
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Basic Idea:
Connect PDGs with auxiliary dependence edges
• Parse source code - one procedure at a time.
– Construct the CDG for each procedure including main.
• Add actual and formal parameter nodes:
– Connect using parameter-in, parameter-out edges
• Represent function calls
– Using call edges
• Find data dependencies:
– Perform data flow analysis of the CDGs
– Connect data dependence edges
• Add summary edges
Steps in SDG Construction
System Dependency Graph (SDG)
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Control Dependence
Data Dependence
Call, Parameter−in,
Parameter−out
Summary Edge
bin = b
ain = a
entry add
Entry main
a = 0
b = 1
add(a, b)
a =ain
b = bin
a = a+b
c = aout
aout = a
main(){
int a, b;
a = 0;
b = 1;
c=add(a, b);
}
void add(int a, int b)
{
a = a + b;
return a;
}
Slicing an SDG: Two phase algorithm
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Proposed by Horwitz et al
• Pass1: From the slice point:
• Traverse backward along all edges except
parameter-out edges
• Mark the reached vertices
• Pass 2: From vertices marked in Pass 1
• Traverse backwards along all edges:
• Except call and parameter-in edges
Slicing an SDG: Pass-1
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Control Dependence
Data Dependence
Call, Parameter−in,
Parameter−out
Summary Edge
main(){
int a, b;
a = 0;
b = 1;
c=add(a, b);
}
void add(int a, int b)
{
a = a + b;
return a;
}
entry main
a = 0
b = 1
add(a, b)
entry add
a =ain
b = bin
a = a+b
aout = a
c = aout
bin = b
ain = a
Slice Point
Except parameter-out edges
Slicing an SDG: Pass-2
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Control Dependence
Data Dependence
Call, Parameter−in,
Parameter−out
Summary Edge
main(){
int a, b;
a = 0;
b = 1;
c=add(a, b);
}
void add(int a, int b)
{
a = a + b;
return a;
}
entry
main
a = 0
b = 1 add(a, b)
entry add
a =ain
b = bin
a = a+b
aout = a
c = aout
bin = b
ain = a
Slice Point
Except call and parameter-in edges
Dynamic Slicing: Example cont…
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Consider the following program:
Computing:
product of odd (p), sum of even (s)
Execution Trace, N=3
1,2,3,4 //intial
5,6,8,9 //i=1
5,6,7,9 //i=2
5,10 //i=3, end
Which part of the
program is responsible
for computing sum?
Dynamic Slicing: Example cont…
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
We need to compute a backward slice with slicing criterion
<(10, s)>
Dependencies:
Dynamic Data Dependence:
which variable assignment was propagated to the value of `s' ?
Dynamic Control Dependence:
which are the conditional branches that executed till line 10
and in what order?
Dynamic Slicing: Example cont…
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
For N=3
The Dynamic Slice w.r.t. (10,s)
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Slicing Tools
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
• Unravel : Static slicing tool for ANSI C
• WET : Whole Execution Traces, dynamic slicing
• CodeSurfer : Commercial static slicing tool for C
• Performs data flow and control dependence analysis
• Indus : Static slicer for Java
• Available for Eclipse via Kaveri plugin
• JSlice : Dynamic slicing tool for Java
• SPYDER: Debugging tool
• Performs both static and dynamic slice
Further Reduction in Size of Slice…
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Amorphous Slice:
 No Syntax Preservation
 Retaining the semantic property
Applications:
 Re-engineering
 Component Re-use
 Program Comprehension
 Testing & Maintenance
 Program Integration
Amorphous Slice: Example
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
for(i = 0,sum = a[0], biggest = sum; i<19; sum = a[++i])
if (a[i+1] > biggest)
{
biggest = a[i+1];
average = sum/20;
}
Amorphous slice
for(i = 1, biggest = a[0]; i<20; ++i)
{
if (a[i]>biggest)
biggest = a[i];
}
Traditional slice
for(i = 0,sum = a[0], biggest = sum; i<19;
sum = a[++i])
if (a[i+1] > biggest)
{
biggest = a[i+1];
}
Slicing Criterion
Loop unrolling
Challenges: For further reading…
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
 Slicing Object-Oriented Programs
 Effect of Exceptions on Control Flow
 Slicing UML Models
 Slicing of threaded programs
 Slicing Concurrent and Distributed Programs
Directions of Research
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
A Novel Fault Localization Technique
References
[1] M Weiser. 1984. “Program slicing”
IEEE Transactions on Software Engineering 10(4):352–57
[2] F. Tip. 1995. A survey of program slicing techniques. Journal of
Programming Languages 3(3): 121–89
[3] D. P.Mohapatra, R.Mall, and R. Kumar. 2006.
“ An overview of slicing techniques for object-oriented
programs” Informatica 30(2):253–77
[4] G. B.Mund, R.Mall, and S. Sarkar. 2003. “Computation of intra-procedural
dynamic program slices. Information and Software Technology 45(8):499–512.
Indian Institute of Technology, Kharagpur
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Questions
Indian Institute of Technology, Kharagpur
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Indian Institute of Technology, Kharagpur
Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
Ad

More Related Content

What's hot (20)

Library Management System
Library Management SystemLibrary Management System
Library Management System
Bijay Chaurasiya
 
Software engineering mca
Software engineering mcaSoftware engineering mca
Software engineering mca
Aman Adhikari
 
Adaptive software development
Adaptive software developmentAdaptive software development
Adaptive software development
Jenita lamichhane
 
Software engineering a practitioners approach 8th edition pressman solutions ...
Software engineering a practitioners approach 8th edition pressman solutions ...Software engineering a practitioners approach 8th edition pressman solutions ...
Software engineering a practitioners approach 8th edition pressman solutions ...
Drusilla918
 
Sequence diagram for employee management system(EMS)
Sequence diagram for employee management system(EMS)Sequence diagram for employee management system(EMS)
Sequence diagram for employee management system(EMS)
Achal (अचल) Porwal
 
Sequnce diagram for ONLINE EXAMINATION SYSTEM
Sequnce diagram for ONLINE EXAMINATION SYSTEMSequnce diagram for ONLINE EXAMINATION SYSTEM
Sequnce diagram for ONLINE EXAMINATION SYSTEM
COMSATS Institute of Information Technology
 
CPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An IntroductionCPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An Introduction
Dilum Bandara
 
Simulation in terminated system
Simulation in terminated system Simulation in terminated system
Simulation in terminated system
Saleem Almaqashi
 
WORKFLOW OF THE PROCESS IN SPM
 WORKFLOW OF THE PROCESS IN SPM WORKFLOW OF THE PROCESS IN SPM
WORKFLOW OF THE PROCESS IN SPM
garishma bhatia
 
First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)
nikeAthena
 
Model Based Software Architectures
Model Based Software ArchitecturesModel Based Software Architectures
Model Based Software Architectures
Munazza-Mah-Jabeen
 
Software configuration management
Software configuration managementSoftware configuration management
Software configuration management
fizamustanser
 
A new approach of program slicing
A new approach of program slicingA new approach of program slicing
A new approach of program slicing
Dr Sandeep Kumar Poonia
 
Software Engineering ppt
Software Engineering pptSoftware Engineering ppt
Software Engineering ppt
shruths2890
 
Statistical Software Quality Assurance.pptx
Statistical Software Quality Assurance.pptxStatistical Software Quality Assurance.pptx
Statistical Software Quality Assurance.pptx
KarthigaiSelviS3
 
Computer aided software engineering
Computer aided software engineeringComputer aided software engineering
Computer aided software engineering
ČhauÐhařÿ Faísal Ãlï
 
Deep learning.pptx
Deep learning.pptxDeep learning.pptx
Deep learning.pptx
MdMahfoozAlam5
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
Vehicle management system
Vehicle management systemVehicle management system
Vehicle management system
Mohd Saddam
 
Chapter 01 software engineering pressman
Chapter 01  software engineering pressmanChapter 01  software engineering pressman
Chapter 01 software engineering pressman
RohitGoyal183
 
Software engineering mca
Software engineering mcaSoftware engineering mca
Software engineering mca
Aman Adhikari
 
Adaptive software development
Adaptive software developmentAdaptive software development
Adaptive software development
Jenita lamichhane
 
Software engineering a practitioners approach 8th edition pressman solutions ...
Software engineering a practitioners approach 8th edition pressman solutions ...Software engineering a practitioners approach 8th edition pressman solutions ...
Software engineering a practitioners approach 8th edition pressman solutions ...
Drusilla918
 
Sequence diagram for employee management system(EMS)
Sequence diagram for employee management system(EMS)Sequence diagram for employee management system(EMS)
Sequence diagram for employee management system(EMS)
Achal (अचल) Porwal
 
CPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An IntroductionCPU Pipelining and Hazards - An Introduction
CPU Pipelining and Hazards - An Introduction
Dilum Bandara
 
Simulation in terminated system
Simulation in terminated system Simulation in terminated system
Simulation in terminated system
Saleem Almaqashi
 
WORKFLOW OF THE PROCESS IN SPM
 WORKFLOW OF THE PROCESS IN SPM WORKFLOW OF THE PROCESS IN SPM
WORKFLOW OF THE PROCESS IN SPM
garishma bhatia
 
First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)
nikeAthena
 
Model Based Software Architectures
Model Based Software ArchitecturesModel Based Software Architectures
Model Based Software Architectures
Munazza-Mah-Jabeen
 
Software configuration management
Software configuration managementSoftware configuration management
Software configuration management
fizamustanser
 
Software Engineering ppt
Software Engineering pptSoftware Engineering ppt
Software Engineering ppt
shruths2890
 
Statistical Software Quality Assurance.pptx
Statistical Software Quality Assurance.pptxStatistical Software Quality Assurance.pptx
Statistical Software Quality Assurance.pptx
KarthigaiSelviS3
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
Vehicle management system
Vehicle management systemVehicle management system
Vehicle management system
Mohd Saddam
 
Chapter 01 software engineering pressman
Chapter 01  software engineering pressmanChapter 01  software engineering pressman
Chapter 01 software engineering pressman
RohitGoyal183
 

Viewers also liked (20)

SPRINT3R-MY-CITY
SPRINT3R-MY-CITYSPRINT3R-MY-CITY
SPRINT3R-MY-CITY
Prathan Dansakulcharoenkit
 
Automated Debugging: Are We There Yet?
Automated Debugging: Are We There Yet?Automated Debugging: Are We There Yet?
Automated Debugging: Are We There Yet?
Alex Orso
 
The HercuLeS HLS Environment
The HercuLeS HLS EnvironmentThe HercuLeS HLS Environment
The HercuLeS HLS Environment
kaveirious
 
Umesh
UmeshUmesh
Umesh
Umesh Mali
 
Model Slicing
Model SlicingModel Slicing
Model Slicing
ClarkTony
 
Prepare b sc_project_-_presentatipn.ppt[1]
Prepare b sc_project_-_presentatipn.ppt[1]Prepare b sc_project_-_presentatipn.ppt[1]
Prepare b sc_project_-_presentatipn.ppt[1]
Bornface Lizang'a
 
Reverse Engineering Web Applications
Reverse Engineering Web ApplicationsReverse Engineering Web Applications
Reverse Engineering Web Applications
Porfirio Tramontana
 
Slicing of Object-Oriented Programs
Slicing of Object-Oriented ProgramsSlicing of Object-Oriented Programs
Slicing of Object-Oriented Programs
Praveen Penumathsa
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
Sangheethaa Sukumaran
 
Graal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them AllGraal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them All
Thomas Wuerthinger
 
Online Examination System Report
Online Examination System ReportOnline Examination System Report
Online Examination System Report
Ankan Banerjee
 
online examination portal project presentation
online examination portal project presentationonline examination portal project presentation
online examination portal project presentation
Shobhit Jain
 
Finaldocumentation
FinaldocumentationFinaldocumentation
Finaldocumentation
asuadma
 
Unit 3 Control Flow Testing
Unit 3   Control Flow TestingUnit 3   Control Flow Testing
Unit 3 Control Flow Testing
ravikhimani
 
Control Flow Testing
Control Flow TestingControl Flow Testing
Control Flow Testing
Hirra Sultan
 
Project report on online examination system
Project report on online examination systemProject report on online examination system
Project report on online examination system
Mo Irshad Ansari
 
Online examination system Documentation
Online examination system DocumentationOnline examination system Documentation
Online examination system Documentation
LehlohonoloMakoti
 
Interm codegen
Interm codegenInterm codegen
Interm codegen
Anshul Sharma
 
Online examination system
Online examination systemOnline examination system
Online examination system
Mr. Vikram Singh Slathia
 
Chapter 9 software maintenance
Chapter 9 software maintenanceChapter 9 software maintenance
Chapter 9 software maintenance
despicable me
 
Automated Debugging: Are We There Yet?
Automated Debugging: Are We There Yet?Automated Debugging: Are We There Yet?
Automated Debugging: Are We There Yet?
Alex Orso
 
The HercuLeS HLS Environment
The HercuLeS HLS EnvironmentThe HercuLeS HLS Environment
The HercuLeS HLS Environment
kaveirious
 
Model Slicing
Model SlicingModel Slicing
Model Slicing
ClarkTony
 
Prepare b sc_project_-_presentatipn.ppt[1]
Prepare b sc_project_-_presentatipn.ppt[1]Prepare b sc_project_-_presentatipn.ppt[1]
Prepare b sc_project_-_presentatipn.ppt[1]
Bornface Lizang'a
 
Reverse Engineering Web Applications
Reverse Engineering Web ApplicationsReverse Engineering Web Applications
Reverse Engineering Web Applications
Porfirio Tramontana
 
Slicing of Object-Oriented Programs
Slicing of Object-Oriented ProgramsSlicing of Object-Oriented Programs
Slicing of Object-Oriented Programs
Praveen Penumathsa
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
Sangheethaa Sukumaran
 
Graal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them AllGraal and Truffle: One VM to Rule Them All
Graal and Truffle: One VM to Rule Them All
Thomas Wuerthinger
 
Online Examination System Report
Online Examination System ReportOnline Examination System Report
Online Examination System Report
Ankan Banerjee
 
online examination portal project presentation
online examination portal project presentationonline examination portal project presentation
online examination portal project presentation
Shobhit Jain
 
Finaldocumentation
FinaldocumentationFinaldocumentation
Finaldocumentation
asuadma
 
Unit 3 Control Flow Testing
Unit 3   Control Flow TestingUnit 3   Control Flow Testing
Unit 3 Control Flow Testing
ravikhimani
 
Control Flow Testing
Control Flow TestingControl Flow Testing
Control Flow Testing
Hirra Sultan
 
Project report on online examination system
Project report on online examination systemProject report on online examination system
Project report on online examination system
Mo Irshad Ansari
 
Online examination system Documentation
Online examination system DocumentationOnline examination system Documentation
Online examination system Documentation
LehlohonoloMakoti
 
Chapter 9 software maintenance
Chapter 9 software maintenanceChapter 9 software maintenance
Chapter 9 software maintenance
despicable me
 
Ad

Similar to Programing Slicing and Its applications (20)

Water Quality Index Calculation of River Ganga using Decision Tree Algorithm
Water Quality Index Calculation of River Ganga using Decision Tree AlgorithmWater Quality Index Calculation of River Ganga using Decision Tree Algorithm
Water Quality Index Calculation of River Ganga using Decision Tree Algorithm
IRJET Journal
 
Software estimation techniques
Software estimation techniquesSoftware estimation techniques
Software estimation techniques
Tan Tran
 
Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours? Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours?
Rogue Wave Software
 
Real Estate Investment Advising Using Machine Learning
Real Estate Investment Advising Using Machine LearningReal Estate Investment Advising Using Machine Learning
Real Estate Investment Advising Using Machine Learning
IRJET Journal
 
IRJET - Automated Fraud Detection Framework in Examination Halls
 IRJET - Automated Fraud Detection Framework in Examination Halls IRJET - Automated Fraud Detection Framework in Examination Halls
IRJET - Automated Fraud Detection Framework in Examination Halls
IRJET Journal
 
IRJET- Deep Learning Model to Predict Hardware Performance
IRJET- Deep Learning Model to Predict Hardware PerformanceIRJET- Deep Learning Model to Predict Hardware Performance
IRJET- Deep Learning Model to Predict Hardware Performance
IRJET Journal
 
IRJET- Analysis of PV Fed Vector Controlled Induction Motor Drive
IRJET- Analysis of PV Fed Vector Controlled Induction Motor DriveIRJET- Analysis of PV Fed Vector Controlled Induction Motor Drive
IRJET- Analysis of PV Fed Vector Controlled Induction Motor Drive
IRJET Journal
 
Static Slicing Technique with Algorithmic Approach
Static Slicing Technique with Algorithmic ApproachStatic Slicing Technique with Algorithmic Approach
Static Slicing Technique with Algorithmic Approach
IOSR Journals
 
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
ijsrd.com
 
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
ijsrd.com
 
A Firefly based improved clustering algorithm
A Firefly based improved clustering algorithmA Firefly based improved clustering algorithm
A Firefly based improved clustering algorithm
IRJET Journal
 
[Paper Review] Personalized Top-N Sequential Recommendation via Convolutional...
[Paper Review] Personalized Top-N Sequential Recommendation via Convolutional...[Paper Review] Personalized Top-N Sequential Recommendation via Convolutional...
[Paper Review] Personalized Top-N Sequential Recommendation via Convolutional...
Jihoo Kim
 
From sensor readings to prediction: on the process of developing practical so...
From sensor readings to prediction: on the process of developing practical so...From sensor readings to prediction: on the process of developing practical so...
From sensor readings to prediction: on the process of developing practical so...
Manuel Martín
 
AIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTIONAIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTION
IRJET Journal
 
Integration of Principal Component Analysis and Support Vector Regression fo...
 Integration of Principal Component Analysis and Support Vector Regression fo... Integration of Principal Component Analysis and Support Vector Regression fo...
Integration of Principal Component Analysis and Support Vector Regression fo...
IJCSIS Research Publications
 
IRJET- Unabridged Review of Supervised Machine Learning Regression and Classi...
IRJET- Unabridged Review of Supervised Machine Learning Regression and Classi...IRJET- Unabridged Review of Supervised Machine Learning Regression and Classi...
IRJET- Unabridged Review of Supervised Machine Learning Regression and Classi...
IRJET Journal
 
Se exe 6
Se exe 6Se exe 6
Se exe 6
grandhiprasuna
 
Ppig2014 problem solvingpaths
Ppig2014 problem solvingpathsPpig2014 problem solvingpaths
Ppig2014 problem solvingpaths
Roya Hosseini
 
Machine Learning, K-means Algorithm Implementation with R
Machine Learning, K-means Algorithm Implementation with RMachine Learning, K-means Algorithm Implementation with R
Machine Learning, K-means Algorithm Implementation with R
IRJET Journal
 
Python Programming Unit 4 Problem Solving and Data Analysis
Python Programming Unit 4 Problem Solving and Data AnalysisPython Programming Unit 4 Problem Solving and Data Analysis
Python Programming Unit 4 Problem Solving and Data Analysis
priyanshi25121980
 
Water Quality Index Calculation of River Ganga using Decision Tree Algorithm
Water Quality Index Calculation of River Ganga using Decision Tree AlgorithmWater Quality Index Calculation of River Ganga using Decision Tree Algorithm
Water Quality Index Calculation of River Ganga using Decision Tree Algorithm
IRJET Journal
 
Software estimation techniques
Software estimation techniquesSoftware estimation techniques
Software estimation techniques
Tan Tran
 
Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours? Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours?
Rogue Wave Software
 
Real Estate Investment Advising Using Machine Learning
Real Estate Investment Advising Using Machine LearningReal Estate Investment Advising Using Machine Learning
Real Estate Investment Advising Using Machine Learning
IRJET Journal
 
IRJET - Automated Fraud Detection Framework in Examination Halls
 IRJET - Automated Fraud Detection Framework in Examination Halls IRJET - Automated Fraud Detection Framework in Examination Halls
IRJET - Automated Fraud Detection Framework in Examination Halls
IRJET Journal
 
IRJET- Deep Learning Model to Predict Hardware Performance
IRJET- Deep Learning Model to Predict Hardware PerformanceIRJET- Deep Learning Model to Predict Hardware Performance
IRJET- Deep Learning Model to Predict Hardware Performance
IRJET Journal
 
IRJET- Analysis of PV Fed Vector Controlled Induction Motor Drive
IRJET- Analysis of PV Fed Vector Controlled Induction Motor DriveIRJET- Analysis of PV Fed Vector Controlled Induction Motor Drive
IRJET- Analysis of PV Fed Vector Controlled Induction Motor Drive
IRJET Journal
 
Static Slicing Technique with Algorithmic Approach
Static Slicing Technique with Algorithmic ApproachStatic Slicing Technique with Algorithmic Approach
Static Slicing Technique with Algorithmic Approach
IOSR Journals
 
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
ijsrd.com
 
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
Artificial Neural Network Based Graphical User Interface for Estimation of Fa...
ijsrd.com
 
A Firefly based improved clustering algorithm
A Firefly based improved clustering algorithmA Firefly based improved clustering algorithm
A Firefly based improved clustering algorithm
IRJET Journal
 
[Paper Review] Personalized Top-N Sequential Recommendation via Convolutional...
[Paper Review] Personalized Top-N Sequential Recommendation via Convolutional...[Paper Review] Personalized Top-N Sequential Recommendation via Convolutional...
[Paper Review] Personalized Top-N Sequential Recommendation via Convolutional...
Jihoo Kim
 
From sensor readings to prediction: on the process of developing practical so...
From sensor readings to prediction: on the process of developing practical so...From sensor readings to prediction: on the process of developing practical so...
From sensor readings to prediction: on the process of developing practical so...
Manuel Martín
 
AIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTIONAIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTION
IRJET Journal
 
Integration of Principal Component Analysis and Support Vector Regression fo...
 Integration of Principal Component Analysis and Support Vector Regression fo... Integration of Principal Component Analysis and Support Vector Regression fo...
Integration of Principal Component Analysis and Support Vector Regression fo...
IJCSIS Research Publications
 
IRJET- Unabridged Review of Supervised Machine Learning Regression and Classi...
IRJET- Unabridged Review of Supervised Machine Learning Regression and Classi...IRJET- Unabridged Review of Supervised Machine Learning Regression and Classi...
IRJET- Unabridged Review of Supervised Machine Learning Regression and Classi...
IRJET Journal
 
Ppig2014 problem solvingpaths
Ppig2014 problem solvingpathsPpig2014 problem solvingpaths
Ppig2014 problem solvingpaths
Roya Hosseini
 
Machine Learning, K-means Algorithm Implementation with R
Machine Learning, K-means Algorithm Implementation with RMachine Learning, K-means Algorithm Implementation with R
Machine Learning, K-means Algorithm Implementation with R
IRJET Journal
 
Python Programming Unit 4 Problem Solving and Data Analysis
Python Programming Unit 4 Problem Solving and Data AnalysisPython Programming Unit 4 Problem Solving and Data Analysis
Python Programming Unit 4 Problem Solving and Data Analysis
priyanshi25121980
 
Ad

Recently uploaded (20)

How I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetryHow I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetry
Cees Bos
 
Why CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Why CoTester Is the AI Testing Tool QA Teams Can’t IgnoreWhy CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Why CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Shubham Joshi
 
Albert Pintoy - A Distinguished Software Engineer
Albert Pintoy - A Distinguished Software EngineerAlbert Pintoy - A Distinguished Software Engineer
Albert Pintoy - A Distinguished Software Engineer
Albert Pintoy
 
NYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdfNYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdf
AUGNYC
 
Best HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRMBest HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRM
accordHRM
 
Bridging Sales & Marketing Gaps with IInfotanks’ Salesforce Account Engagemen...
Bridging Sales & Marketing Gaps with IInfotanks’ Salesforce Account Engagemen...Bridging Sales & Marketing Gaps with IInfotanks’ Salesforce Account Engagemen...
Bridging Sales & Marketing Gaps with IInfotanks’ Salesforce Account Engagemen...
jamesmartin143256
 
UI/UX Design & Development and Servicess
UI/UX Design & Development and ServicessUI/UX Design & Development and Servicess
UI/UX Design & Development and Servicess
marketing810348
 
Hyper Casual Game Developers Company
Hyper  Casual  Game  Developers  CompanyHyper  Casual  Game  Developers  Company
Hyper Casual Game Developers Company
Nova Carter
 
Hydraulic Modeling And Simulation Software Solutions.pptx
Hydraulic Modeling And Simulation Software Solutions.pptxHydraulic Modeling And Simulation Software Solutions.pptx
Hydraulic Modeling And Simulation Software Solutions.pptx
julia smits
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
Passkeys and cbSecurity Led by Eric Peterson.pdf
Passkeys and cbSecurity Led by Eric Peterson.pdfPasskeys and cbSecurity Led by Eric Peterson.pdf
Passkeys and cbSecurity Led by Eric Peterson.pdf
Ortus Solutions, Corp
 
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-RuntimeReinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Natan Silnitsky
 
Wilcom Embroidery Studio Crack Free Latest 2025
Wilcom Embroidery Studio Crack Free Latest 2025Wilcom Embroidery Studio Crack Free Latest 2025
Wilcom Embroidery Studio Crack Free Latest 2025
Web Designer
 
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.pptPassive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
IES VE
 
Applying AI in Marketo: Practical Strategies and Implementation
Applying AI in Marketo: Practical Strategies and ImplementationApplying AI in Marketo: Practical Strategies and Implementation
Applying AI in Marketo: Practical Strategies and Implementation
BradBedford3
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
SamFw Tool v4.9 Samsung Frp Tool Free Download
SamFw Tool v4.9 Samsung Frp Tool Free DownloadSamFw Tool v4.9 Samsung Frp Tool Free Download
SamFw Tool v4.9 Samsung Frp Tool Free Download
Iobit Uninstaller Pro Crack
 
Aligning Projects to Strategy During Economic Uncertainty
Aligning Projects to Strategy During Economic UncertaintyAligning Projects to Strategy During Economic Uncertainty
Aligning Projects to Strategy During Economic Uncertainty
OnePlan Solutions
 
Lumion Pro Crack + 2025 Activation Key Free Code
Lumion Pro Crack + 2025 Activation Key Free CodeLumion Pro Crack + 2025 Activation Key Free Code
Lumion Pro Crack + 2025 Activation Key Free Code
raheemk1122g
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
How I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetryHow I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetry
Cees Bos
 
Why CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Why CoTester Is the AI Testing Tool QA Teams Can’t IgnoreWhy CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Why CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Shubham Joshi
 
Albert Pintoy - A Distinguished Software Engineer
Albert Pintoy - A Distinguished Software EngineerAlbert Pintoy - A Distinguished Software Engineer
Albert Pintoy - A Distinguished Software Engineer
Albert Pintoy
 
NYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdfNYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdf
AUGNYC
 
Best HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRMBest HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRM
accordHRM
 
Bridging Sales & Marketing Gaps with IInfotanks’ Salesforce Account Engagemen...
Bridging Sales & Marketing Gaps with IInfotanks’ Salesforce Account Engagemen...Bridging Sales & Marketing Gaps with IInfotanks’ Salesforce Account Engagemen...
Bridging Sales & Marketing Gaps with IInfotanks’ Salesforce Account Engagemen...
jamesmartin143256
 
UI/UX Design & Development and Servicess
UI/UX Design & Development and ServicessUI/UX Design & Development and Servicess
UI/UX Design & Development and Servicess
marketing810348
 
Hyper Casual Game Developers Company
Hyper  Casual  Game  Developers  CompanyHyper  Casual  Game  Developers  Company
Hyper Casual Game Developers Company
Nova Carter
 
Hydraulic Modeling And Simulation Software Solutions.pptx
Hydraulic Modeling And Simulation Software Solutions.pptxHydraulic Modeling And Simulation Software Solutions.pptx
Hydraulic Modeling And Simulation Software Solutions.pptx
julia smits
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
Passkeys and cbSecurity Led by Eric Peterson.pdf
Passkeys and cbSecurity Led by Eric Peterson.pdfPasskeys and cbSecurity Led by Eric Peterson.pdf
Passkeys and cbSecurity Led by Eric Peterson.pdf
Ortus Solutions, Corp
 
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-RuntimeReinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Natan Silnitsky
 
Wilcom Embroidery Studio Crack Free Latest 2025
Wilcom Embroidery Studio Crack Free Latest 2025Wilcom Embroidery Studio Crack Free Latest 2025
Wilcom Embroidery Studio Crack Free Latest 2025
Web Designer
 
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.pptPassive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
IES VE
 
Applying AI in Marketo: Practical Strategies and Implementation
Applying AI in Marketo: Practical Strategies and ImplementationApplying AI in Marketo: Practical Strategies and Implementation
Applying AI in Marketo: Practical Strategies and Implementation
BradBedford3
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
Aligning Projects to Strategy During Economic Uncertainty
Aligning Projects to Strategy During Economic UncertaintyAligning Projects to Strategy During Economic Uncertainty
Aligning Projects to Strategy During Economic Uncertainty
OnePlan Solutions
 
Lumion Pro Crack + 2025 Activation Key Free Code
Lumion Pro Crack + 2025 Activation Key Free CodeLumion Pro Crack + 2025 Activation Key Free Code
Lumion Pro Crack + 2025 Activation Key Free Code
raheemk1122g
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 

Programing Slicing and Its applications

  • 1. Indian Institute of Technology, Kharagpur Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Presented By- Ankur Jain (13CS60D02)
  • 2. Programmer’s Nightmare… Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp If I change this statement in program: What other statements would be affected? (Impact analysis) What other statement needs to be tested? (Regression test) The values live at this statement: Defined where? Modified Where? (Manual Checking) How can I abstract code?
  • 3. Studies show…. Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Software testing contributes more then 50% of cost and time of SDLC Maintainers spend nearly 50% of their time trying to understand the program Source: http://www.ece.cmu.edu/~koopman/des_s99/sw_testing/
  • 4. Try... Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Program Slicing!
  • 5. Outline Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp  Introduction  Types of Slicing  Program Models  Flow based  Dependency based  Slicing Algorithms  Challenges  Directions of research
  • 6. Proposed by… Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp  Proposed by Mark Weiser in 1981  Chief scientist at Xerox PARC  As his PhD thesis  Father of ubiquitous computing Mark D. Weiser (July 23, 1952 - April 27, 1999)
  • 7. Basic Concepts… Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp “For statement S and variable V, the slice of program P includes only those statements of P needed to capture the behavior of V at S.” Slicing Criterion (SC): <S, V> S = Point of interest in the program (statement) V = Subset of variables used in the program A program slice is a subset of a program
  • 8. Example… Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp 1 begin 2 read(x, y) 3 total := 0.0 4 sum := 0.0 5 if x <= 1 6 then sum := y 7 else begin 8 read(z) 9 total := x*y*z 10 end 11 write(total, sum) 12 end SC = <11, sum> 2 read(x, y) 4 sum := 0.0 5 if x <= 1 6 then sum := y Slicing Criterion
  • 9. Why is Program Slicing Useful? Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp • Program slices are more manageable for testing and debugging • During testing, debugging, or understanding a program, most of the code in the program is irrelevant to what you are interested in. • Program slicing provides a convenient way of filtering out “irrelevant” code.
  • 10. Slice Variants… Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Types of slices:  Static  Dynamic Direction of slice:  Forward  Backward Executability of slice:  Executable  Non-executable Amorphous, etc.
  • 11. Froward Slices Vs Backward Slices Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Statements which might affect the value of variables in V Statements which might be affected by the values of variables in V int i, sum, prd; 1. read(i); 2. prd = 1; 3. sum = 0; 4. while (i<10) 5. sum = sum + i; 6. prd = prd * i; 7. i = i + 1; 8. write(sum); 9. write(prd);For SC = <9, prd> Slice: {1, 2, 4, 6, 7} For SC = <2, prd> Slice: {6, 9} Backward Slices: Froward Slices
  • 12. Static Slice | Dynamic Slice Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Using dynamic information (an execution trace) Debugging Set of all statements that actually affect the value of a variable at a program point Using static information (a source program) Regression Testing Set of all statements that may affect the value of a variable at a program point
  • 13. Example… Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp int i, sum, prd; 1. read(i); 2. prd = 1; 3. sum = 0; 4. while (i<10) 5. sum = sum + i; 6. prd = prd * i; 7. i = i + 1; 8. write(sum); 9. write(prd); Static Slice {1, 2, 4, 6, 7} Dynamic Slice For Input ‘i’ = 15 {2} For Slicing Criteria [SC] = <9, prd> Flow based model: Control flow  Data flow Dependency based model:  Data Dependency  Control Dependency Slicing Criterion
  • 14. Dependency Based Model Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Program Code Control Flow Graph (CFG) Data Dependency Graph (DDG) Program Dependency Graph (PDG) Forward Dominance Tree Control Dependency Graph (CDG)
  • 15. Data Dependency Graph (DDG) Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp int a, b, sum; 1. read(a); 2. read(b); 3. sum = 0; 4. while(a<8) 5. sum = sum + b; 6. a = a + 1; 7. write(sum); 8. sum = b; 9. write(sum); 4 5 6 7 8 9 21 3 Data Dependency Graph
  • 16. Control Flow Graph (CFG) Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp int a, b, sum; 1. read(a); 2. read(b); 3. sum = 0; 4. while(a<8) 5. sum = sum + b; 6. a = a + 1; 7. write(sum); 8. sum = b; 9. write(sum); Start 1 Stop 4 5 3 6 2 8 7 9 True False True True True True True True True True True
  • 17. Dominance Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Let X and Y be two nodes in a Control flow graph X dominates Y If and only if Every path from Start to Y passes through X Y forward dominates X The forward Dominance Tree (FDT) 1. Vertices represent statement 2. Root node of tree is exit node of the CFG 3. Arcs represent immediate forward dominance
  • 18. Forward Dominance Tree (FDT): Using CFG Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp 9 4 6 7 5 8 2 3 1 Start 1 Stop 4 5 3 6 2 8 7 9 True False True True True True True True True True True
  • 19. Control Dependency Graph: Using CFG & FDT Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp 4 5 6 7 8 9 2 1 3 S 1. Y is control dependent on X 2. Path in the CFG from X to Y 3. Doesn’t contain the immediate forward dominator of X Y X X Ifdom(4)=7 X Y
  • 20. Control Dependency Graph (CDG) Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp int a, b, sum; 1. read(a); 2. read(b); 3. sum = 0; 4. while(a<8) 5. sum = sum + b; 6. a = a + 1; 7. write(sum); 8. sum = b; 9. write(sum); 4 5 6 7 8 9 2 1 3 S
  • 21. Program Dependency Graph (PDG) Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp int a, b, sum; 1. read(a); 2. read(b); 3. sum = 0; 4. while(a<8) 5. sum = sum + b; 6. a = a + 1; 7. write(sum); 8. sum = b; 9. write(sum); Union of CDG and DDG 1 4 6 5 8 29 3 7 Data dependence Control dependence Limitation: A PDG can model programs with a single function Not suitable for inter-procedural slicing
  • 22. System Dependency Graph Model: by- Horwitz Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Basic Idea: Connect PDGs with auxiliary dependence edges • Parse source code - one procedure at a time. – Construct the CDG for each procedure including main. • Add actual and formal parameter nodes: – Connect using parameter-in, parameter-out edges • Represent function calls – Using call edges • Find data dependencies: – Perform data flow analysis of the CDGs – Connect data dependence edges • Add summary edges Steps in SDG Construction
  • 23. System Dependency Graph (SDG) Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Control Dependence Data Dependence Call, Parameter−in, Parameter−out Summary Edge bin = b ain = a entry add Entry main a = 0 b = 1 add(a, b) a =ain b = bin a = a+b c = aout aout = a main(){ int a, b; a = 0; b = 1; c=add(a, b); } void add(int a, int b) { a = a + b; return a; }
  • 24. Slicing an SDG: Two phase algorithm Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Proposed by Horwitz et al • Pass1: From the slice point: • Traverse backward along all edges except parameter-out edges • Mark the reached vertices • Pass 2: From vertices marked in Pass 1 • Traverse backwards along all edges: • Except call and parameter-in edges
  • 25. Slicing an SDG: Pass-1 Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Control Dependence Data Dependence Call, Parameter−in, Parameter−out Summary Edge main(){ int a, b; a = 0; b = 1; c=add(a, b); } void add(int a, int b) { a = a + b; return a; } entry main a = 0 b = 1 add(a, b) entry add a =ain b = bin a = a+b aout = a c = aout bin = b ain = a Slice Point Except parameter-out edges
  • 26. Slicing an SDG: Pass-2 Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Control Dependence Data Dependence Call, Parameter−in, Parameter−out Summary Edge main(){ int a, b; a = 0; b = 1; c=add(a, b); } void add(int a, int b) { a = a + b; return a; } entry main a = 0 b = 1 add(a, b) entry add a =ain b = bin a = a+b aout = a c = aout bin = b ain = a Slice Point Except call and parameter-in edges
  • 27. Dynamic Slicing: Example cont… Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Consider the following program: Computing: product of odd (p), sum of even (s) Execution Trace, N=3 1,2,3,4 //intial 5,6,8,9 //i=1 5,6,7,9 //i=2 5,10 //i=3, end Which part of the program is responsible for computing sum?
  • 28. Dynamic Slicing: Example cont… Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp We need to compute a backward slice with slicing criterion <(10, s)> Dependencies: Dynamic Data Dependence: which variable assignment was propagated to the value of `s' ? Dynamic Control Dependence: which are the conditional branches that executed till line 10 and in what order?
  • 29. Dynamic Slicing: Example cont… Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp For N=3
  • 30. The Dynamic Slice w.r.t. (10,s) Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
  • 31. Slicing Tools Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp • Unravel : Static slicing tool for ANSI C • WET : Whole Execution Traces, dynamic slicing • CodeSurfer : Commercial static slicing tool for C • Performs data flow and control dependence analysis • Indus : Static slicer for Java • Available for Eclipse via Kaveri plugin • JSlice : Dynamic slicing tool for Java • SPYDER: Debugging tool • Performs both static and dynamic slice
  • 32. Further Reduction in Size of Slice… Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp Amorphous Slice:  No Syntax Preservation  Retaining the semantic property Applications:  Re-engineering  Component Re-use  Program Comprehension  Testing & Maintenance  Program Integration
  • 33. Amorphous Slice: Example Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp for(i = 0,sum = a[0], biggest = sum; i<19; sum = a[++i]) if (a[i+1] > biggest) { biggest = a[i+1]; average = sum/20; } Amorphous slice for(i = 1, biggest = a[0]; i<20; ++i) { if (a[i]>biggest) biggest = a[i]; } Traditional slice for(i = 0,sum = a[0], biggest = sum; i<19; sum = a[++i]) if (a[i+1] > biggest) { biggest = a[i+1]; } Slicing Criterion Loop unrolling
  • 34. Challenges: For further reading… Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp  Slicing Object-Oriented Programs  Effect of Exceptions on Control Flow  Slicing UML Models  Slicing of threaded programs  Slicing Concurrent and Distributed Programs
  • 35. Directions of Research Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp A Novel Fault Localization Technique
  • 36. References [1] M Weiser. 1984. “Program slicing” IEEE Transactions on Software Engineering 10(4):352–57 [2] F. Tip. 1995. A survey of program slicing techniques. Journal of Programming Languages 3(3): 121–89 [3] D. P.Mohapatra, R.Mall, and R. Kumar. 2006. “ An overview of slicing techniques for object-oriented programs” Informatica 30(2):253–77 [4] G. B.Mund, R.Mall, and S. Sarkar. 2003. “Computation of intra-procedural dynamic program slices. Information and Software Technology 45(8):499–512. Indian Institute of Technology, Kharagpur Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
  • 37. Questions Indian Institute of Technology, Kharagpur Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
  • 38. Indian Institute of Technology, Kharagpur Date : 27 March-2014 Ankur Jain, Dept of Computer Sc & Engg., IIT Kgp
  翻译: