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,

Slides:



Advertisements
Similar presentations
CSCE 3110 Data Structures & Algorithm Analysis
Advertisements

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.
Context-Sensitive Interprocedural Points-to Analysis in the Presence of Function Pointers Presentation by Patrick Kaleem Justin.
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
 Program Slicing Long Li. Program Slicing ? It is an important way to help developers and maintainers to understand and analyze the structure.
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.
Presented By: Krishna Balasubramanian
1 Cost Effective Dynamic Program Slicing Xiangyu Zhang Rajiv Gupta The University of Arizona.
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.
Carnegie Mellon Lecture 6 Register Allocation I. Introduction II. Abstraction and the Problem III. Algorithm Reading: Chapter Before next class:
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 Slicing Xiangyu Zhang. CS590F Software Reliability What is a slice? S: …. = f (v)  Slice of v at S is the set of statements involved in computing.
CS4723 Software Engineering Lecture 10 Debugging and Fault Localization.
1 Integrating Influence Mechanisms into Impact Analysis for Increased Precision Ben Breech Lori Pollock Mike Tegtmeyer University of Delaware Army Research.
A Comparison of Online and Dynamic Impact Analysis Algorithms Ben Breech Mike Tegtmeyer Lori Pollock University of Delaware.
Pruning Dynamic Slices With Confidence Xiangyu Zhang Neelam Gupta Rajiv Gupta The University of Arizona.
Program Representations Xiangyu Zhang. CS590F Software Reliability Why Program Representations  Initial representations Source code (across languages).
1 CS 201 Compiler Construction Lecture 12 Global Register Allocation.
1 CSE1301 Computer Programming: Lecture 15 Flowcharts and Debugging.
1 “White box” or “glass box” tests “White Box” (or “Glass Box”) Tests.
Program Representations Xiangyu Zhang. CS590Z Software Defect Analysis Program Representations  Static program representations Abstract syntax tree;
Load-Reuse Analysis design and evaluation Rastislav Bodík Rajiv Gupta Mary Lou Soffa.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
Survey of program slicing techniques
Software (Program) Analysis. Automated Static Analysis Static analyzers are software tools for source text processing They parse the program text and.
Data Structures & AlgorithmsIT 0501 Algorithm Analysis I.
CS5103 Software Engineering Lecture 17 Debugging.
1 A Static Analysis Approach for Automatically Generating Test Cases for Web Applications Presented by: Beverly Leung Fahim Rahman.
Programming Lifecycle
Bug Localization with Machine Learning Techniques Wujie Zheng
1 Program Slicing Amir Saeidi PhD Student UTRECHT UNIVERSITY.
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
Detecting Equality of Variables in Programs Bowen Alpern, Mark N. Wegman, F. Kenneth Zadeck Presented by: Abdulrahman Mahmoud.
Chapter 11: Dynamic Analysis Omar Meqdadi SE 3860 Lecture 11 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
References: “Pruning Dynamic Slices With Confidence’’, by X. Zhang, N. Gupta and R. Gupta (PLDI 2006). “Locating Faults Through Automated Predicate Switching’’,
CASE/Re-factoring and program slicing
Lecture Notes - Copyright © S. C. Kothari, All rights reserved.1 Efficient Debugging CPRE 556 Lecture 19.
Software Engineering Research Group, Graduate School of Engineering Science, Osaka University A Slicing Method for Object-Oriented Programs Using Lightweight.
PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Merging Equivalent Contexts for Scalable Heap-cloning-based Points-to.
Software Engineering Department Graph-Less Dynamic Dependence-Based Dynamic Slicing Algorithms Árpád Beszédes, Tamás Gergely and Tibor Gyimóthy University.
Program Slicing Techniques CSE 6329 Spring 2013 Parikksit Bhisay
CS412/413 Introduction to Compilers Radu Rugina Lecture 18: Control Flow Graphs 29 Feb 02.
Pruning Dynamic Slices With Confidence Original by: Xiangyu Zhang Neelam Gupta Rajiv Gupta The University of Arizona Presented by: David Carrillo.
1 Graph Coverage (3). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section 2.2 ◦ Section
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;
1 Iterative Program Analysis Mooly Sagiv Tel Aviv University Textbook: Principles of Program.
1 CSE1301 Computer Programming: Lecture 16 Flow Diagrams and Debugging.
Phoenix Based Dynamic Slicing Debugging Tool Eric Cheng Lin Xu Matt Gruskin Ravi Ramaseshan Microsoft Phoenix Intern Team (Summer '06)
SOFTWARE PRESENTATION ON Path Testing And Decision To Decision Path
Unit 3: ALGORITHMS AND FLOWCHARTS
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.
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Paul Ammann & Jeff Offutt
SwE 455 Program Slicing.
Antonia Zhai, Christopher B. Colohan,
Algorithm.
A Survey of Program Slicing Techniques: Section 4
Topic 10: Dataflow Analysis
Program Slicing Baishakhi Ray University of Virginia
Dynamic Program Analysis
“White box” or “glass box” tests
Program Slicing Xiangyu Zhang.
CPRE 416-Software Evolution and Maintenance-Lecture 11
Paul Ammann & Jeff Offutt
C. M. Overstreet Old Dominion University Fall 2005
CS 201 Compiler Construction
Presentation transcript:

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, 1982] Data dependence Control dependence Void main ( ) { int I=0; int sum=0; while (I<N) { sum=add(sum,I); I=add(I,1); } printf (“sum=%d\n”,sum); printf(“I=%d\n”,I);

CS590F Software Reliability 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 dependences  Data dependences Traverse dependence graph to compute slice  Transitive closure over control and data dependences

CS590F Software Reliability Dynamic Slicing Dynamic slice is the set of statements that DID affect the value of a variable at a program point for ONE specific execution. [Korel and Laski, 1988] Execution trace  control flow trace -- dynamic control dependences  memory reference trace -- dynamic data dependences Construct a dynamic dependence graph Traverse dynamic dependence graph to compute slices Smaller, more precise, slices are more helpful

CS590F Software Reliability Slice Sizes: Static vs. Dynamic ProgramStatements Avg. of 25 slicesStatic / Dynamic StaticDynamic 126.gcc 099.go 134.perl 130.li 008.espresso 585,491 95, ,182 31,829 74,039 51,098 16,941 5,242 2,450 2,353 6,614 5, Static slice can be much larger than the dynamic slice

CS590F Software Reliability Applications of Dynamic Slicing  Debugging [Korel & Laski ]  Detecting Spyware [Jha ] Installed without users’ knowledge  Software Testing [Duesterwald, Gupta, & Soffa ] Dependence based structural testing - output slices.  Module Cohesion [N.Gupta & Rao ] Guide program structuring  Performance Enhancing Transformations Instruction criticality [Ziles & Sohi ] Instruction isomorphism [Sazeides ]  Others…

CS590F Software Reliability Dynamic Slicing Example - background 1: b=0 2: a=2 3: for i= 1 to N do 4: if ((i++)%2==1) then 5: a = a+1 else 6: b = a*2 endif done 7: z = a+b 8: print(z) For input N=2, 1 1 : b=0 [b=0] 2 1 : a=2 3 1 : for i = 1 to N do [i=1] 4 1 : if ( (i++) %2 == 1) then [i=1] 5 1 : a=a+1 [a=3] 3 2 : for i=1 to N do [i=2] 4 2 : if ( i%2 == 1) then [i=2] 6 1 : b=a*2 [b=6] 7 1 : z=a+b [z=9] 8 1 : print(z) [z=9]

CS590F Software Reliability Issues about Dynamic Slicing  Precision – perfect  Running history – very big ( GB )  Algorithm to compute dynamic slice - slow and very high space requirement.

CS590F Software Reliability Efficiency  How are dynamic slices computed? Execution traces  control flow trace -- dynamic control dependences  memory reference trace -- dynamic data dependences Construct a dynamic dependence graph Traverse dynamic dependence graph to compute slices

CS590F Software Reliability The Graph Size Problem Program Statements Executed (Millions) Dynamic Dependence Graph Size(MB) 300.twolf 256.bzip2 255.vortex 197.parser 181.mcf 164.gzip 134.perl 130.li 126.gcc 099.go ,568 1,296 1,442 1,816 1, ,954 1,745 1,534 1,707 Graphs of realistic program runs do not fit in memory.

CS590F Software Reliability Conventional Approaches  [Agrawal &Horgan, 1990] presented three algorithms to trade-off the cost with precision. Static Analysis Precise dynamic analysis Algo.IAlgo.IIAlgo.III Cost: low high Precision: lowhigh

CS590F Software Reliability Algorithm One  This algorithm uses a static dependence graph in which all executed nodes are marked dynamically so that during slicing when the graph is traversed, nodes that are not marked are avoided as they cannot be a part of the dynamic slice.  Limited dynamic information - fast, imprecise (but more precise than static slicing)

CS590F Software Reliability Algorithm I Example 1: b=0 2: a=2 3: 1 <=i <=N 4: if ((i++)%2= =1) 5: a=a+16: b=a*2 7: z=a+b 8: print(z) TF T F For input N=1, the trace is: 3232

CS590F Software Reliability Algorithm I Example 1: b=0 2: a=2 3: 1 <=i <=N 4: if ((i++)%2= =1) 5: a=a+16: b=a*2 7: z=a+b 8: print(z) DS={1,2,5,7,8} Precise!

CS590F Software Reliability Imprecision introduced by Algorithm I Input N=2: for (a=1; a<N; a++) { … if (a % 2== 1) { b=1; } if (a % 3 ==1) { b= 2* b; } else { c=2*b+1; } Killed definition counted as reaching!

CS590F Software Reliability Algorithm II  A dependence edge is introduced from a load to a store if during execution, at least once, the value stored by the store is indeed read by the load (mark dependence edge)  No static analysis is needed.

CS590F Software Reliability Algorithm II Example 1: b=0 2: a=2 3: 1 <=i <=N 4: if ((i++)%2= =1) 5: a=a+16: b=a*2 7: z=a+b 8: print(z) TF T F For input N=1, the trace is:

CS590F Software Reliability Algorithm II – Compare to Algorithm I  More precise x=… …=x Algo. I x=… …=x Algo. II

CS590F Software Reliability Efficiency: Summary  For an execution of 130M instructions: space requirement: reduced from 1.5GB to 94MB (I further reduced the size by a factor of 5 by designing a generic compression technique [MICRO’05]). time requirement: reduced from >10 Mins to <30 seconds.

CS590F Software Reliability Algorithm III  First preprocess the execution trace and introduces labeled dependence edges in the dependence graph. During slicing the instance labels are used to traverse only relevant edges.

CS590F Software Reliability Dynamic Dep. Graph Representation 3: while ( i<N) do 1: sum=0 2: i=1 4: i=i+1 5: sum=sum+i 6: print (sum) 1: sum=0 2: i=1 3: while ( i<N) do 4: i=i+1 5: sum=sum+i 3: while ( i<N) do 4: i=i+1 5: sum=sum+i 3: while ( i<N) do 6: print (sum) N=2:

CS590F Software Reliability Dynamic Dep. Graph Representation 3: while ( i<N) do 1: sum=0 2: i=1 4: i=i+1 5: sum=sum+i 6: print (sum) 1: sum=0 2: i=1 3: while ( i<N) do 4: i=i+1 5: sum=sum+i 3: while ( i<N) do 4: i=i+1 5: sum=sum+i 3: while ( i<N) do 6: print (sum) N=2:Timestamps (4,6) (2,2) (4,4) A dynamic dep. edge is represented as by an edge annotated with a pair of timestamps

CS590F Software Reliability Infer: Local Dependence Labels: Full Elimination X = Y= X X = Y= X (10,10) (20,20) (30,30) X = Y= X 10,20,30 =Y 21 (20,21)... (...,20)...

CS590F Software Reliability Transform: Local Dependence Labels: Elimination In Presence of Aliasing X = *P = Y= X X = *P = Y= X (10,10) (20,20) X = *P = Y= X 10,20 =Y 11,21 (20,21)...

CS590F Software Reliability Transform: Local Dependence Labels: Elimination In Presence of Aliasing X = *P = Y= X X = *P = Y= X (10,10) (20,20) X = *P = Y= X 10,20 X = *P = Y= X ,21 (10,11) (20,21) =Y 11,21 =Y (20,21) (10,11)

CS590F Software Reliability Transform: Coalescing Multiple Nodes into One

CS590F Software Reliability Group: Labels Across Non-Local Dependence Edges X = Y = = Y = X X = Y = X = Y = = Y = X X = Y = (10,21) (20,11) X = Y = = Y = X X = Y = (20,11) (10,21) 11,