CS510 Software Engineering
Program Slicing
- Asst. Prof. Mathias Payer
Department of Computer Science Purdue University TA: Scott A. Carr Slides inspired by Xiangyu Zhang http://nebelwelt.net/teaching/15-CS510-SE
CS510 Software Engineering Program Slicing Asst. Prof. Mathias - - PowerPoint PPT Presentation
CS510 Software Engineering Program Slicing Asst. Prof. Mathias Payer Department of Computer Science Purdue University TA: Scott A. Carr Slides inspired by Xiangyu Zhang http://nebelwelt.net/teaching/15-CS510-SE Spring 2015 What is slicing?
Department of Computer Science Purdue University TA: Scott A. Carr Slides inspired by Xiangyu Zhang http://nebelwelt.net/teaching/15-CS510-SE
What is slicing?
1
2
3
4
5
6
7
8
Mathias Payer (Purdue University) CS510 Software Engineering 2015 2 / 39
What is slicing?
1Mark Weiser, Program slicing, ICSE’81
Mathias Payer (Purdue University) CS510 Software Engineering 2015 3 / 39
What is slicing?
1 #d e f i n e N 256 2 3 void
4
5
6
7
8
9
10
11
12 } Mathias Payer (Purdue University) CS510 Software Engineering 2015 4 / 39
Using Slicing
1
2
3
4
5
6
7
8
Mathias Payer (Purdue University) CS510 Software Engineering 2015 5 / 39
Using Slicing
Mathias Payer (Purdue University) CS510 Software Engineering 2015 6 / 39
Slice Construction
1
2
3
4
5
6
7
8
Mathias Payer (Purdue University) CS510 Software Engineering 2015 7 / 39
Slice Construction
1 #d e f i n e N 256 2 3 void
4
5
6
7
8
9
10
11
12 }
Mathias Payer (Purdue University) CS510 Software Engineering 2015 8 / 39
Slice Construction
Mathias Payer (Purdue University) CS510 Software Engineering 2015 9 / 39
Slice Construction
2Bogdan Korel and Janusz Laski, Dynamic Program Slicing, 1988
Mathias Payer (Purdue University) CS510 Software Engineering 2015 10 / 39
Slice Construction
Mathias Payer (Purdue University) CS510 Software Engineering 2015 11 / 39
Slice Construction
Mathias Payer (Purdue University) CS510 Software Engineering 2015 12 / 39
Slice Construction
1 #d e f i n e N 256 2 3 void
4
5
6
7
8
9
10
11
12 }
3B is control dependent on A iff there is a path in the CFG from A to B that
Mathias Payer (Purdue University) CS510 Software Engineering 2015 13 / 39
Slice Construction
Mathias Payer (Purdue University) CS510 Software Engineering 2015 14 / 39
Offline Slicing Algorithms
1
2
3
4
5
6
7
8
Mathias Payer (Purdue University) CS510 Software Engineering 2015 15 / 39
Offline Slicing Algorithms
Mathias Payer (Purdue University) CS510 Software Engineering 2015 16 / 39
Offline Slicing Algorithms
1 void
2
3
4
5
6
7
8
9
10 } Mathias Payer (Purdue University) CS510 Software Engineering 2015 17 / 39
Offline Slicing Algorithms
Mathias Payer (Purdue University) CS510 Software Engineering 2015 18 / 39
Offline Slicing Algorithms
Mathias Payer (Purdue University) CS510 Software Engineering 2015 19 / 39
Online Slicing Algorithms
1
2
3
4
5
6
7
8
Mathias Payer (Purdue University) CS510 Software Engineering 2015 20 / 39
Online Slicing Algorithms
Mathias Payer (Purdue University) CS510 Software Engineering 2015 21 / 39
Online Slicing Algorithms
Mathias Payer (Purdue University) CS510 Software Engineering 2015 22 / 39
Online Slicing Algorithms
Mathias Payer (Purdue University) CS510 Software Engineering 2015 23 / 39
Online Slicing Algorithms
1 f o r
2
3
4
5 } 6 a=a+1;
Mathias Payer (Purdue University) CS510 Software Engineering 2015 24 / 39
Online Slicing Algorithms
1
2
Mathias Payer (Purdue University) CS510 Software Engineering 2015 25 / 39
Online Slicing Algorithms
Mathias Payer (Purdue University) CS510 Software Engineering 2015 26 / 39
Online Slicing Algorithms
Mathias Payer (Purdue University) CS510 Software Engineering 2015 27 / 39
Online Slicing Algorithms
Mathias Payer (Purdue University) CS510 Software Engineering 2015 28 / 39
Forward Dynamic Slice Computation
1
2
3
4
5
6
7
8
Mathias Payer (Purdue University) CS510 Software Engineering 2015 29 / 39
Forward Dynamic Slice Computation
Mathias Payer (Purdue University) CS510 Software Engineering 2015 30 / 39
Forward Dynamic Slice Computation
Mathias Payer (Purdue University) CS510 Software Engineering 2015 31 / 39
Forward Dynamic Slice Computation
Mathias Payer (Purdue University) CS510 Software Engineering 2015 32 / 39
Forward Dynamic Slice Computation
Mathias Payer (Purdue University) CS510 Software Engineering 2015 33 / 39
Forward Dynamic Slice Computation
Mathias Payer (Purdue University) CS510 Software Engineering 2015 34 / 39
Slicing Outlook
1
2
3
4
5
6
7
8
Mathias Payer (Purdue University) CS510 Software Engineering 2015 35 / 39
Slicing Outlook
Mathias Payer (Purdue University) CS510 Software Engineering 2015 36 / 39
Summary
1
2
3
4
5
6
7
8
Mathias Payer (Purdue University) CS510 Software Engineering 2015 37 / 39
Summary
Mathias Payer (Purdue University) CS510 Software Engineering 2015 38 / 39
Summary
Mathias Payer (Purdue University) CS510 Software Engineering 2015 39 / 39