270 likes | 497 Views
Program Slicing and Debugging. Elton Alves Informatics Center Federal University of Pernambuco ( UFPE). V Encontro Brasilieiro de Testes de Software (EBTS), Recife-PE, Brazil , April 2011. Program Slicing. What is it?
E N D
ProgramSlicing and Debugging Elton Alves Informatics Center Federal Universityof Pernambuco (UFPE) V EncontroBrasilieiro de Testes de Software (EBTS), Recife-PE, Brazil, April 2011
Program Slicing • What is it? • Program analysis technique to filter relevant lines of a subject program given a specific criteria SubjectProgram
Program Slicing • What is it? • Program analysis technique to filter relevant lines of a subject program given a specific criteria SubjectProgram Consider that the assertion in this line is violated!
Program Slicing • What is it? • Program analysis technique to filter relevant lines of a subject program given a specific criteria SubjectProgram That assertion depends on other lines!
Program Slicing • What is it? • Program analysis technique to filter relevant lines of a subject program given a specific criteria SubjectProgram which depend on others…
Program Slicing • What is it? • Program analysis technique to filter relevant lines of a subject program given a specific criteria SubjectProgram and so on…
Program Slicing • What is it? • Program analysis technique to filter relevant lines of a subject program given a specific criteria SubjectProgram and so on…
Program Slicing • What is it? • Program analysis technique to filter relevant lines of a subject program given a specific criteria Contains only relevant parts. SubjectProgram Sliced Program Should focus on that for debugging!
Considerations • Very different from coverage • In the example, not all covered lines are in the slice • Not only for debugging • Test generation • Model extraction • It works for arbitrarily complex programs
Quick note on dependency • Control dependency (a => b) • Execution at a depends on control decision at b • Data dependency (a => b) • Use of variable x at a depends on definition of x at b
Illustration:Control and Data Dependency PROGRAM DEPENDENCE GRAPH (PDG) From “Dynamic Program Slicing”, Agrawal and Horgan, PLDI’90
Slicers Input • Static slicers (slice at compile time) • Input: slicing criteria and program • Dynamic slicers (slice at execution time) • Input: slicing criteria, program, and test case
Static and Dynamic slicers • Static slices tend to grow very rapidly • Problems: Pointer aliasing and dynamic binding • Dynamic slices are incomplete but more precise: they operate with one test case. We focus on dynamic slicing.
Different kinds: Precision and Cost coverage Box sizes denote relative size of slices relevant full = data + control data
Different kinds: Precision and Cost coverage Increase chances of missing errors relevant full = data + control data
Different kinds: Precision and Cost coverage Increase cost of computation relevant full = data + control data
Important findings [Zhang et al., AADEBUG 2005] • Only relevant slicer is complete • Relevant and full require static analysis info • Data slices are remarkably smaller than other kinds of slices but very often miss errors • Relevant and full have almost same size and capability of finding errors
Existing Implementations • Several implementation in C • For Java • JSlicer (http://jslice.sourceforge.net) • Backward slicer that runs with JDK 1.4 • Extension to Java PathFinder • Under development in our group
Our group work • Improve precision of lightweight debugging • We use dynamic slicing and evolution information • Check conformance of feature models (FM) • FMs are used in software product line development • We use dynamic slicing to extract FMs from code For more information visit: http://pan.cin.ufpe.br/