Program Slicing Techniques CSE 6329 Spring 2013 Parikksit Bhisay 1000 80 2524.

Slides:



Advertisements
Similar presentations
DATAFLOW TESTING DONE BY A.PRIYA, 08CSEE17, II- M.s.c [C.S].
Advertisements

Overview Structural Testing Introduction – General Concepts
A Survey of Program Slicing Techniques A Survey of Program Slicing Techniques Sections 3.1,3.6 Swathy Shankar
Program Slicing – Based Techniques
Data-Flow Analysis II CS 671 March 13, CS 671 – Spring Data-Flow Analysis Gather conservative, approximate information about what a program.
Discrete Event Control
Analysis of programs with pointers. Simple example What are the dependences in this program? Problem: just looking at variable names will not give you.
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
Chair of Software Engineering From Program slicing to Abstract Interpretation Dr. Manuel Oriol.
 Program Slicing Long Li. Program Slicing ? It is an important way to help developers and maintainers to understand and analyze the structure.
Program Slicing; Andreas Linder eXtreme Programming lab course 2004.
A survey of techniques for precise program slicing Komondoor V. Raghavan Indian Institute of Science, Bangalore.
Program Slicing. 2 CS510 S o f t w a r e E n g i n e e r i n g Outline What is slicing? Why use slicing? Static slicing of programs Dynamic Program Slicing.
Program Slicing Mark Weiser and Precise Dynamic Slicing Algorithms Xiangyu Zhang, Rajiv Gupta & Youtao Zhang Presented by Harini Ramaprasad.
1 Program Slicing Purvi Patel. 2 Contents Introduction What is program slicing? Principle of dependences Variants of program slicing Slicing classifications.
CS590F Software Reliability What is a slice? S: …. = f (v)  Slice of v at S is the set of statements involved in computing v’s value at S. [Mark Weiser,
Introduction to Program Slicing Presenter: M. Amin Alipour Software Design Laboratory
Interprocedural Slicing using Dependence Graphs Susan Horwitz, Thomas Reps, and David Binkley University of Wisconsin-Madison.
Csci 565 Spring  Originally proposed by [Weiser 88]and [Gallagher 91] in software maintenance  Useful for  Software Debugging  Software Maintenance.
SwE 455 Program Slicing. Our Goals Debug your thousands lines of code easily by reducing the complexity of the program Write a robust program before testing.
The Application of Graph Criteria: Source Code  It is usually defined with the control flow graph (CFG)  Node coverage is used to execute every statement.
Program Representations Xiangyu Zhang. CS590F Software Reliability Why Program Representations  Initial representations Source code (across languages).
White Box Testing and Symbolic Execution Written by Michael Beder.
Chair of Software Engineering Fundamentals of Program Analysis Dr. Manuel Oriol.
Program Slicing for Refactoring Advanced SW Tools Seminar Jan 2005Yossi Peery.
Program Representations Xiangyu Zhang. CS590Z Software Defect Analysis Program Representations  Static program representations Abstract syntax tree;
Overview of program analysis Mooly Sagiv html://
Survey of program slicing techniques
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 5 Data Flow Testing
Generation of WEB SERVICES Using PROGRAM SLICING RAVINDRA KUMAR SUDIP AKURA AMIT KUMAR BALKARAN SINGH SIDHU
Technical University of Valencia Computer Science Department SOFSEM’07 (22/01/2007) A Program Slicing Based Method to Filter XML/DTD documents.
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
Presented By Dr. Shazzad Hosain Asst. Prof., EECS, NSU
Software (Program) Analysis. Automated Static Analysis Static analyzers are software tools for source text processing They parse the program text and.
2006/09/19AOAsia 21 Towards Locating a Functional Concern Based on a Program Slicing Technique Takashi Ishio 1,2, Ryusuke Niitani 2 and Katsuro Inoue 2.
Formal Methods Program Slicing & Dataflow Analysis February 2015.
Coverage Literature of software testing is primarily concerned with various notions of coverage Four basic kinds of coverage: Graph coverage Logic coverage.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Technology and Science, Osaka University Dependence-Cache.
 Program Slicing : Analysis technique of extracting parts of a given program, relevant to the aspects being analyzed (the slicing criterion). E.g. slicing.
1 Program Slicing Amir Saeidi PhD Student UTRECHT UNIVERSITY.
Dr.Basem Alkazemi
SOFTWARE DESIGN. INTRODUCTION There are 3 distinct types of activities in design 1.External design 2.Architectural design 3.Detailed design Architectural.
Chapter 11: Dynamic Analysis Omar Meqdadi SE 3860 Lecture 11 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
CASE/Re-factoring and program slicing
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Software Engineering Research Group, Graduate School of Engineering Science, Osaka University A Slicing Method for Object-Oriented Programs Using Lightweight.
A System to Generate Test Data and Symbolically Execute Programs Lori A. Clarke Presented by: Xia Cheng.
SAFEWARE System Safety and Computers Chap18:Verification of Safety Author : Nancy G. Leveson University of Washington 1995 by Addison-Wesley Publishing.
1 Software Testing & Quality Assurance Lecture 13 Created by: Paulo Alencar Modified by: Frank Xu.
Control Flow Graphs : The if Statement 1 if (x < y) { y = 0; x = x + 1; } else { x = y; } x >= yx < y x = y y = 0 x = x + 1 if (x < y) { y = 0;
/ PSWLAB Evidence-Based Analysis and Inferring Preconditions for Bug Detection By D. Brand, M. Buss, V. C. Sreedhar published in ICSM 2007.
1 Iterative Program Analysis Mooly Sagiv Tel Aviv University Textbook: Principles of Program.
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Activity Diagrams.
PREPARED BY G.VIJAYA KUMAR ASST.PROFESSOR
Testing and Debugging PPT By :Dr. R. Mall.
Static Slicing Static slice is the set of statements that COULD influence the value of a variable for ANY input. Construct static dependence graph Control.
SwE 455 Program Slicing.
Mark Weiser University of Maryland, College Park IEEE CHI, 1981
A Survey of Program Slicing Techniques: Section 4
Program Slicing Baishakhi Ray University of Virginia
Graph Coverage for Source Code
Optimization 薛智文 (textbook ch# 9) 薛智文 96 Spring.
C. M. Overstreet Old Dominion University Spring 2006
Paul Ammann & Jeff Offutt
C. M. Overstreet Old Dominion University Fall 2005
C. M. Overstreet Old Dominion University Fall 2007
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Presentation transcript:

Program Slicing Techniques CSE 6329 Spring 2013 Parikksit Bhisay

Flow: Abstract Overview Static slicing Dynamic slicing Data and Control Dependence

Abstract: A program slice consists of the parts of a program that (potentially) affect the values computed at some point of interest, referred to as a slicing criterion. The task of computing program slices is called program slicing.

Abstract : Procedures, arbitrary control flow, composite datatypes and pointers, and interprocess communication each require a specific solution. We classify Static & Dynamic slicing methods for each of above features and then compare their accuracy & efficiency

Overview: Original concept by Weiser, 1979.[2] Large programs must be decomposed for understanding and manipulation. However, it should be into procedures and abstract data types. Program Slicing is decomposition based on data flow and control flow analysis. A study showed, experienced programmers mentally slicing while debugging.

Overview: However, many variations exist. Because: Different applications need different properties of slices An important aspect is distinction between Static and Dynamic slicing. Static: made without assumptions of the program’s input. Dynamic: Relies on some specific case

Overview: Features of programming languages: Procedures, arbitrary control flow, composite datatypes and pointers, and interprocess communication each require a specific solution. We classify Static & Dynamic slicing methods for each of above features and then compare their accuracy & efficiency

Static Slicing: With Example 1.read(n); 2.i := 1; 3.sum := 0; 4.product := 1; 5.while i <= n do begin 6.sum := sum + i; 7.product := product * i; 8.i := i + 1; end; 9. write(sum); 10. write(product); 1.read(n); 2.i := 1; 3. 4.product := 1; 5.while i <= n do begin 6. 7.product := product * i; 8.i := i + 1; end; write(product); (A) (B) Static slicing w.r.t. the criterion (n, product)

Dynamic Slicing First introduced by Korel and Laski Dynamic Slicing is a non-interactive version of Balzer’s flowback analysis. Flowback Analysis: If a value computed at statement s depends o values computed at statement t, the user may trace back to the vertex of s and t. Dependencies occurring in specific execution are considered.

Difference: Quick View Dynamic Slicing assumes a fixed input for a program. Static Slicing does not make any assumptions regarding the input. Hybrid Approaches – make use of both!

Dynamic Slicing: Example 1.read(n); 2.i := 1; 3.while (i <= n) do begin 4.if (i mod 2 = 0) then 5.x := 17 else 6.x := 18; 7.i := i+1 end; 8.write(x) 1.read(n); 2.i := 1; 3.while (i <= n) do begin 4.if (i mod 2 = 0) then 5.x := 17 else 6. ; 7.i := i+1 end; 8.write(x) (A)(B) dynamic slicing w.r.t. the criterion (n = 2, 8¹, x)

CFG CFG = Control Flow Graph Example: Startread(n) sum:=0 prod:=1i<=n sum:= sum+1 prod:= prod+1 i:=i+1 write(sum)write(prod)Stop (1) (3)(4) (5) (2) i := 1 (6) (7) (8) (10)(9)

Contains a node for each statement Edge indicates possible flow Contains special nodes Start and Stop Startread(n) sum:=0 prod:=1i<=n sum:= sum+1 prod:= prod+1 i:=i+1 write(sum)write(prod)Stop (1) (3)(4) (5) (2) i := 1 (6) (7) (8) (10)(9) CFG

Data and Control Dependence Defined in terms of CFG Types of dependencies: Flow dependence loop-carried dependence loop independent dependence output dependence anti dependence However, for slicing, we only consider flow dependence.

Data and Control Dependence Node j is flow dependent on node j if there exists a variable x such that: x ∈ DEF(i), x ∈ REF(j) and there exists a path from i to j without intervening definitions of x

Data and Control Dependence Control dependence is usually defined in terms of post-dominance. A node i is post-dominated by j if all paths from i to STOP pass through j. A node j is control dependent on a node i if: there exists a path P from i to j...and... i is not post-dominated by j

Startread(n) sum:=0 prod:=1i<=n sum:= sum+1 prod:= prod+1 i:=i+1 write(sum)write(prod)Stop (1) (3)(4) (5) (2) i := 1 (6) (7) (8) (10)(9) Example of Post-Dominated CFG Node 3 is post-dominated by Node 2

Startread(n) sum:=0 prod:=1i<=n sum:= sum+1 prod:= prod+1 i:=i+1 write(sum)write(prod)Stop (1) (3)(4) (5) (2) i := 1 (6) (7) (8) (10)(9) Example of flow dependence Node 7 is flow dependent on node 4 because: 1.node 4 defines variable prod. 2.node 7 references variable prod...and 3.there exists a path 4->5->6->7 without intervening definitions of prod.

Startread(n) sum:=0 prod:=1i<=n sum:= sum+1 prod:= prod+1 i:=i+1 write(sum)write(prod)Stop (1) (3)(4) (5) (2) i := 1 (6) (7) (8) (10)(9) Example of control dependence Node 7 is control dependent on node 5 because... there exists a path 5->6->7 such that: 1.node 6 is post-dominated by node 7..and 2.node 5 is not post-dominated by node 7.

References: [1] F. Tip, A Survey of Program Slicing Techniques, CS-R9438, Computer Science/Department of Software Technology, 1994 [2] Weiser, M. Program slices: formal, psychological, and practical investigations of an automatic program abstraction method. PhD thesis, University of Michigan, Ann Arbor, 1979.

Questions?