Program Slicing – Based Techniques

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

CROSSmeeting UM, Fev T5: Slicing Techniques Applied to OSS Pedro Rangel Henriques Daniela da Cruz Dep. de Informática/CCTC, Universidade do Minho,
Slide 1 Insert your own content. Slide 2 Insert your own content.
Basic Java Constructs and Data Types – Nuts and Bolts
1 End-User Programming to Support Classroom Activities on Small Devices Craig Prince University of Washington VL/HCC 2008.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Chapters 1 & 2 Theorem & Postulate Review Answers
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
and 6.855J Cycle Canceling Algorithm. 2 A minimum cost flow problem , $4 20, $1 20, $2 25, $2 25, $5 20, $6 30, $
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Coordinate Plane Practice The following presentation provides practice in two skillsThe following presentation provides practice in two skills –Graphing.
0 - 0.
ALGEBRAIC EXPRESSIONS
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
MULTIPLICATION EQUATIONS 1. SOLVE FOR X 3. WHAT EVER YOU DO TO ONE SIDE YOU HAVE TO DO TO THE OTHER 2. DIVIDE BY THE NUMBER IN FRONT OF THE VARIABLE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
1 Software Unit Test Coverage And Test Adequacy Hong Zhu, Patrick A. V. Hall, John H.R. May Presented By: Arpita Gandhi.
Michael Hildebrandt H UMBOLDT U NIVERSITY B ERLIN D EPARTMENT O F C OMPUTER S CIENCE C HAIR O F S OFTWARE E NGINEERING.
ABC Technology Project
O X Click on Number next to person for a question.
© S Haughton more than 3?
1 Directed Depth First Search Adjacency Lists A: F G B: A H C: A D D: C F E: C D G F: E: G: : H: B: I: H: F A B C G D E H I.
Copyright  2003 Dan Gajski and Lukai Cai 1 Transaction Level Modeling: An Overview Daniel Gajski Lukai Cai Center for Embedded Computer Systems University.
Twenty Questions Subject: Twenty Questions
Past Tense Probe. Past Tense Probe Past Tense Probe – Practice 1.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 10P. 1Winter Quarter Repetition Structures.
DATAFLOW TESTING DONE BY A.PRIYA, 08CSEE17, II- M.s.c [C.S].
Addition 1’s to 20.
25 seconds left…...
Test B, 100 Subtraction Facts
11 = This is the fact family. You say: 8+3=11 and 3+8=11
Analysis of engineering system by means of graph representation.
Week 1.
We will resume in: 25 Minutes.
1 Ke – Kitchen Elements Newport Ave. – Lot 13 Bethesda, MD.
Bottoms Up Factoring. Start with the X-box 3-9 Product Sum
1 Unit 1 Kinematics Chapter 1 Day
O X Click on Number next to person for a question.
Copyright © 2012 Pearson Education, Inc. Chapter 14: More About Classes.
Drill down Reconciliation Analysis Report (RFMFGRCN_RP1) in the Background Instructions Guide June, 2012.
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 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.
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.
Introduction to Program Slicing Presenter: M. Amin Alipour Software Design Laboratory
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 for Refactoring Advanced SW Tools Seminar Jan 2005Yossi Peery.
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
Software (Program) Analysis. Automated Static Analysis Static analyzers are software tools for source text processing They parse the program text and.
Formal Methods Program Slicing & Dataflow Analysis February 2015.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Design and Implementation.
1 Program Slicing Amir Saeidi PhD Student UTRECHT UNIVERSITY.
Chapter 11: Dynamic Analysis Omar Meqdadi SE 3860 Lecture 11 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Program Slicing Techniques CSE 6329 Spring 2013 Parikksit Bhisay
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;
SwE 455 Program Slicing.
How is a PDG Created? Control Flow Graph (CFG) PDG is union of:
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
C. M. Overstreet Old Dominion University Fall 2005
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 – Based Techniques By Corey Rahberger

Overview What is program slicing? History How to extract a slice Program slicing techniques Applications Program slicing tools Current Problems Future

What is program slicing? The process of computing a slice of a program A slice is a subset of the original program, which contains portions of the program that are related to the slicing criterion used to create the slice The slicing criterion is the point of interest or variable(s) that are being investigated A slice is an executable program whose behavior must be identical to the specified subset of the original program.

Program Slicing Example int i; int sum = 0; int product = 1; for(i = 0; i < N; i++) { sum = sum + 1; product = product * I; } write(sum); write(product); int i; int sum = 0; for(i = 0; i < N; i++) { sum = sum + 1; } write(sum); Original Program Slice on statement “write(sum)”

History First introduced by Mark Weiser in 1984 through publication in IEEE Transactions on Software Engineering Original ideas were in his Ph.D. dissertation (1979) from University of Michigan, Ann Arbor Chief scientist at Xerox PARC Switched his focus to ubiquitous computing http://www-sul.stanford.edu/weiser/

History Researchers have expanded on Weiser’s original definition into multiple directions Huge amounts of program slicing techniques have been created to encompass all programming paradigms Different surveys have been made to compare the techniques, but the results have been inconclusive Surveys look at different things: applications and advances empirical results predict future techniques and applications are different techniques really the same

How to extract a slice First, the dependences must be found between the different statements These dependences can be represented in a data structure called a control flow graph (CFG) A control flow graph shows all the execution paths that a program might take

Control Flow Graph read(text); read(n); lines = 1; chars = 1; subtext = “”; c = getChar(text); while ( c != ‘\eof’) if (c == ‘\n’) then lines = lines + 1; chars = chars + 1; else chars = chars + 1; if (n != 0) then subtext = subtext + c; n = n – 1; write(lines); write(chars); write(subtext); In the CFG, each node is represented by a number that corresponds to a line number of the program Lengauer-Tarjan’s algorithm (graph theory)

Problem with Control Flow Graph Does not include data dependences Solution Add data dependencies to the graph

Program Dependence Graph This new data structure is called a program dependence graph (PDG) “A PDG is an oriented graph where the nodes represent statements in the source code [and the] edges represent control and data flow dependencies between statements in such a way that they induce a partial ordering in the nodes, preserving the semantics of the program.” (Silva)

Program Dependence Graph read(text); read(n); lines = 1; chars = 1; subtext = “”; c = getChar(text); while ( c != ‘\eof’) if (c == ‘\n’) then lines = lines + 1; chars = chars + 1; else chars = chars + 1; if (n != 0) then subtext = subtext + c; n = n – 1; write(lines); write(chars); write(subtext); The solid lines represent the control dependencies and the dotted lines represent the data dependencies.

Program Dependence Graph Since both flow and data dependences are now found for the program, the program dependence graph can be used to compute slices of the program according to the slicing criterion Graphs can get quite large and complex System dependence graph

Program Slicing Techniques There are a huge amount of different techniques We will look more closely into the three main techniques Static slicing Dynamic slicing Conditioned slicing Backward slicing

Static Slicing Similar to what Weiser originally introduced The resulting slice will work for all inputs Usually results in a bigger slice Weiser in 1984

Static Slicing – Slicing Criterion (s,v) ‘s’ represents the line number in the program ‘v’ represents the variable(s) that are of interest Example (7, x)

Static Slicing Example read(n); i := 1; sum := 0; product := 1; while i <= n do begin sum := sum + 1; product := product * i; i := i + 1; end; write(sum); write(product); read(n); i := 1; product := 1; while i <= n do begin product := product * i; i := i + 1; end; write(product); Original Program Slice of program w.r.t. criterion (10, product)

Static Slicing Uses Debugging Dead code removal Program analysis Software maintenance Module cohesion analysis Many more

Dynamic Slicing Input(s) for the program are used to help determine the slice Removes portions of the program that are not reached for the given input(s) The resulting slice will not work for all executions of the program Resulting slice is usually smaller than static slicing, but takes longer to compute Korel and Laski in 1988

Dynamic Slicing – Slicing Criterion (si, v, {ai, …, an}) ‘s’ represents the line number in the program ‘i’ represents the position in the execution history of statement ‘s’ ‘v’ represents the variable(s) that are of interest ‘{ai, …, an}’ represents the initial values or inputs Example (71, sum, {x = 1}) ‘i’ represents the occurrence number of statement ‘s’ in the execution history

Dynamic Slicing Example read(n); i := 1; while (i <= n) do begin if (i mod 2 = 0) then x := 17; else x := 18; i := i + 1; end; write(x); read(n); i := 1; while (i <= n) do begin if (i mod 2 = 0) then x := 17; else ; i := i + 1; end; write(x); Original Program Slice of program w.r.t. criterion (81, x, {n = 2})

Dynamic Slicing Uses Debugging Testing Tuning Compilers

Conditioned Slicing Combination of static and dynamic slicing Provides information about the inputs values, but does not specify them exactly Resulting slice is ranges between static and dynamic in size Formally introduced in 1994 by Canfora and others

Conditioned Slicing – Slicing Criterion (i, F, s, v) ‘i’ represents the input variable(s) ‘F’ represents a logical formula on ‘i’ ‘s’ represents the line number in the program ‘v’ represents the variable(s) that are of interest Example (sales, F, 11, {total}), where F = (sales > 0)

Conditioned Slicing Example read(text); read(n); lines = 1; chars = 1; subtext = “”; c = getChar(text); while ( c != ‘\eof’) if (c == ‘\n’) then lines = lines + 1; chars = chars + 1; else chars = chars + 1; if (n != 0) then subtext = subtext + c; n = n – 1; write(lines); write(chars); write(subtext); (1) read(text); (2) read(n); (5) subtext = “”; (6) c = getChar(text); (7) while ( c != ‘\eof’) (8) if (c == ‘\n’) then (12) if (n != 0) then (13) subtext = subtext + c; (14) n = n – 1; (15) c = getChar(text); (18) write(subtext); Original Program Slice of program w.r.t. criterion ((text, n), F, 18, {subtext}), where F = (∀ c ∈ text, c != ‘\n’ . n > 0)

Conditioned Slicing Uses Debugging Software reuse Ripple effect analysis Understanding legacy code Program comprehension

Applications All the different techniques have made program slicing a useful tool in all areas of programming Examples Debugging Cohesion measurement Comprehension Maintenance and reengineering Testing Debugging - program slicing can help narrow down the search for the error(s) Cohesion measurement - program slicing can help to make sure that a program is following good object-oriented programming Comprehension - program slicing can help in the maintenance by splitting it into understandable pieces Maintenance and reengineering - program slicing can help separate sections of code to be modified Testing - program slicing can simplify the section of the program to be tested and can increase the speed of the testing

Program Slicing Tools Sprite Unravel CodeSurfer Open source National Institute of Standards and Technology CodeSurfer University of Wisconsin Slicing Tool GrammaTech Sprite – favors performance, uses Steensgaard’s almost linear points-to analysis, and also performs context insensitivity slices Unravel – prototype, ANSI C source code, last information from 1998 CodeSurfer – Andersen’s cubic time pointer analysis and uses summary edges to provide infinite context sensitivity

CodeSurfer University of Wisconsin Slicing Tool CodeSurfer 1.0 Developed 1996-2000 Susan Horwitz, Thomas Reps and others CodeSurfer 1.0 Released in June 1999 Derived from Wisconsin’s Slicing Tool

CodeSurfer Language Platforms Cost C/C++ Windows Linux Solaris Basic – (Locked) $795 (Floating) $1495 Suite – (Locked) $3995 (Floating) $5995

NASA’s evaluation of CodeSurfer Johnson Space Center Safety and Mission Assurance Directorate, Flight Equipment Division Reviewed the efficiency of CodeSurfer compared to doing it manually Compared results from two projects Space Integrated Global Positioning System/Inertial Navigation System (SIGI) Health Management System Defibrillator (Defib) Power and Data Interface Module (PDIM) Johnson Space Center – usually deals with projects 1,000 to 50,000 LOC

NASA’s evaluation of CodeSurfer COMBINED SIGI AND PDIM INSPECTION DATA Metric Manual Code inspection With CodeSurfer Inspection Time (hr) 17 12.25 Lines of Code (LOC) 10650 Inspection Rate (LOC/hr) 626 869 Total Defects Found Using Method 8 18 Defects Found per Hour 0.47 1.47 Unique Defects Found Using Method 2 12

NASA’s evaluation of CodeSurfer Drawbacks from CodeSurfer Must be compiled using on a compiler provided with the tool Training is required, which is expensive Must use it regularly to remain knowledgeable on using CodeSurfer

Current Problems Resources need to compute slices It can take a while to compute slices Usability of program slicing tools Computing a slice from a PDG of N nodes is O(N) Cost of building a slice is O(N2)

Future Rate at which slices can be computed Usability Integration into mainstream development tools

Conclusion Program slicing techniques have been and are still constantly improving Can be used in all the different programming paradigms As soon as the usability has been increased, program slicing should become a well known and useful tool

Questions?

References Binkley, D., & Harman, M. (2004). A Survey of Empirical Results on Program Slicing. Advanced Computing, 62, 105-178. Retrieved October 27, 2012, from http://eres.lndproxy.org/edoc/FacPubs/loy/BinkleyDW/SurveyOfEmpirical-04.pdf Harman, M., & Hierons, R. (2001). An Overview of Program Slicing. Software Focus, 2(3), 85-92. Retrieved October 27, 2012, from http://docis.info/strip/docis/lib/ligo/rclis/dbl/soffoc/(2001)2%253A3%253C85%253AAOOPS%253E/www.brunel.ac.uk%252F~cssrllh%252FGusttReview%252FPublications_dir%252Ffocus.pdf Sasirekha, N., Robert, A. E., & Hemalatha, M. (2011, July). Program Slicing Techniques and Its Applications. International Journal of Software Engineering & Applications, 2(3), 50-64. Retrieved October 21, 2012, from http://airccse.org/journal/ijsea/papers/0711ijsea04.pdf Silva, J. (2012, June). A Vocabulary of Program Slicing-Based Techniques. ACM Computing Surveys, 44(3), 12:1-12:41. Retrieved September 12, 2012, from http://dl.acm.org/citation.cfm?id=2187674 Tip, F. (1995). A Survey of Program Slicing Techniques. Java Programming Language, 3, 121-189. Retrieved October 27, 2012, from http://www.cse.buffalo.edu/LRG/CSE705/Papers/Tip-Slicing-Survey.pdf Weiser, M. (1984, July). Program Slicing. IEEE Transactions of Software Engineering, 10(4), 352-357. Retrieved October 21, 2012, from http://www.cse.buffalo.edu/LRG/CSE705/Papers/Weiser-Static-Slicing.pdf

References (cont.) Lyle, Jim. "The Unravel Project." The Unravel Program Slicing Tool. National Institute of Standards and Technology, 37 Mar. 1998. Web. 10 Dec. 2012. http://hissa.nist.gov/unravel/ Brown, Aaron. "CodeSurfer: It Slices, It Chops, But Doesn't Make Julienne Fries." GrammaTech, n.d. Web. 10 Dec. 2012. http://hiper.cis.udel.edu/lp/lib/exe/fetch.php/courses/cisc879/codesurfer-demo.pdf United States. Johnson Space Center Safety and Mission Assurance Directorate. Flight Equipment Division. Can CodeSurfer Increase Code Inspection Efficiency? By Mark Markovich and Dan Freund. N.p., n.d. Web. 10 Dec. 2012.  http://www.nasa.gov/centers/ivv/ppt/172689main_CanXCodeSurferXIncreaseXCodeXInspectionXEfficiencyV31.ppt "Wisconsin Program-Slicing Project." N.p., n.d. Web. 10 Dec. 2012. http://research.cs.wisc.edu/wpis/html/ "CodeSurfer." GrammaTech. N.p., 2012. Web. 12 Dec. 2012. http://www.grammatech.com/products/codesurfer/overview.html