Abstract
Observation-based slicing and its generalization observational slicing are recently-introduced, language-independent dynamic slicing techniques. They both construct slices based on the dependencies observed during program execution, rather than static or dynamic dependence analysis. The original implementation of the observation-based slicing algorithm used lines of source code as its program representation. A recent variation, developed to slice modelling languages (such as Simulink), used an XML representation of an executable model. We ported the XML slicer to source code by constructing a tree representation of traditional source code through the use of srcML. This work compares the tree- and line-based slicers using four experiments involving twenty different programs, ranging from classic benchmarks to million-line production systems. The resulting slices are essentially the same size for the majority of the programs and are often identical. However, structural constraints imposed by the tree representation sometimes force the slicer to retain enclosing control structures. It can also “bog down” trying to delete single-token subtrees. This occasionally makes the tree-based slices larger and the tree-based slicer slower than a parallelised version of the line-based slicer. In addition, a Java versus C comparison finds that the two languages lead to similar slices, but Java code takes noticeably longer to slice. The initial experiments suggest two improvements to the tree-based slicer: the addition of a size threshold, for ignoring small subtrees, and subtree replacement. The former enables the slicer to run 3.4 times faster while producing slices that are only about 9% larger. At the same time the subtree replacement reduces size by about 8–12% and allows the tree-based slicer to produce more natural slices.
Similar content being viewed by others
References
Agrawal H, Horgan JR (1990) Dynamic program slicing. In: Proceedings of the ACM SIGPLAN’90 conference on programming language design and implementation (PLDI)
Barpanda SS, Mohapatra DP (2011) Dynamic slicing of distributed object-oriented programs. IET Softw 5(5):425–433
Beszedes A, Gergely T, Szabó ZM, Csirik J, Gyimothy T (2001) Dynamic slicing method for maintenance of large C programs. In: Proceedings of the 5th conference on software maintenance and reengineering
Beszédes Á, Faragó C, Szabó ZM, Csirik J, Gyimóthy T (2002) Union slices for program maintenance. In: Proceedings of the 18th Intl. Conf. on Software Maintenance (ICSM)
Beszedes A, Gergely T, Gyimóthy T (2006) Graph-less dynamic dependence-based dynamic slicing algorithms. In: Intl. workshop on source code analysis and manipulation (SCAM)
Binkley D, Capellini R, Raszewski L, Smith C (2001) An implementation of and experiment with semantic differencing. In: Proceedings of the 2001 IEEE international conference on software maintenance, pp 82–91
Binkley D, Harman M, Hassoun Y, Islam S, Li Z (2009) Assessing the impact of global variables on program dependence and dependence clusters. J Syst Softw 83(1):96–107
Binkley D, Gold N, Harman M, Islam S, Krinke J, Yoo S (2014) ORBS: Language-independent program slicing. In: Proceedings 22nd ACM SIGSOFT Intl. symposium on foundations of software engineering
Binkley D, Gold N, Harman M, Islam S, Krinke J, Yoo S (2015) ORBS and the limits of static slicing. In: Intl. working conference on source code analysis and manipulation (SCAM)
Binkley D, Gold N, Islam S, Krinke J, Yoo S (2017) Tree-oriented vs line-oriented observation-based slicing. In: Intl. workshop on source code analysis and manipulation (SCAM)
Cleve H, Zeller A (2000) Finding failure causes through automated testing. In: Intl. workshop on automated debugging
Collard M (2005) Addressing source code using srcml. In: IEEE international workshop on program comprehension working session (IWPC’05)
Danicic S, Howroyd J (2002) Montréal boat example. In: Source code analysis and manipulation (SCAM 2002) conference resources website. http://www.ieee-scam.org/2002/Slides_ct.html
Danicic S, Harman M, Hierons R, Howroyd J, Laurence M (2004) Applications of linear program schematology in dependence analysis. In: 1st. international workshop on programming language interference and dependence, Verona, Italy. http://profs.sci.univr.it/mastroen/noninterference.html
DeMillo RA, Pan H, Spafford EH (1996) Critical slicing for software fault localization. In: Proceedings of the Intl. symposium on software testing and analysis (ISSTA)
Gallagher KB, Lyle JR (1991) Using program slicing in software maintenance. IEEE Trans Softw Eng 17(8):751–761
Gallagher KB, Binkley D, Harman M (2006) Stop-list slicing. In: Intl. workshop on source code analysis and manipulation (SCAM)
Gold NE, Binkley D, Harman M, Islam S, Krinke J, Yoo S (2017) Generalized observational slicing for tree-represented modelling languages. In: Proceedings 25nd ACM SIGSOFT Intl. symposium on foundations of software engineering
Harman M, Danicic S (1997) Amorphous program slicing. In: 5th IEEE international workshop on program comprenhesion (IWPC)
Harman M, Binkley D, Gallagher K, Gold N, Krinke J (2009) Dependence clusters in source code. ACM Trans Program Lang Syst 32(1):1:1–1:33
Hodován R, Kiss Á, Gyimóthy T (2017) Coarse hierarchical delta debugging. In: 2017 IEEE international conference on software maintenance and evolution (ICSME), pp 194–203
Horwitz S, Reps T, Binkley DW (1988) Interprocedural slicing using dependence graphs. In: ACM SIGPLAN Conference on programming language design and implementation
Horwitz S, Reps T, Binkley DW (1990) Interprocedural slicing using dependence graphs. ACM Trans Program Lang Syst 12(1):26–61
Islam S, Binkley D (2016) PORBS: a parallel observation-based slicer. In: 24Th international conference on program comprehension (ICPC), IEEE, pp 1–3
Jaffar J, Murali V, Navas J, Santosa AE (2012) Path-sensitive backward slicing. In: Proceedings SAS’12, Springer, vol 7460
Jiang S, Santelices R, Grechanik M, Cai H (2014) On the accuracy of forward dynamic slicing and its effects on software maintenance. In: Intl. working conference on source code analysis and manipulation (SCAM)
Korel B, Laski J (1988) Dynamic program slicing. Inf Process Lett 29 (3):155–163
Korel B, Laski J (1990) Dynamic slicing in computer programs. J Syst Softw 13(3):187–195
Krinke J (2003) Barrier slicing and chopping. In: Intl. workshop on source code analysis and manipulation (SCAM)
Laurence MR (2004) Equivalence of linear, free, liberal program schemas is decidable in polynomial time. PhD thesis, Goldsmiths College, University of London
De Lucia A, Harman M, Hierons R, Krinke J (2003) Unions of slices are not slices. In: European conference on software maintenance and reengineering (CSMR 2003), pp 363–367
Mamun MAA, Berger C, Hansson J (2017) Correlations of software code metrics: An empirical study. In: Proceedings of the 27th international workshop on software measurement and 12th international conference on software process and product measurement, pp 255–266
McPeak S, Wilkerson DS, Goldsmith S (2006) Delta (http://delta.tigris.org)
Misherghi G, Su Z (2006) HDD: hierarchical delta debugging. In: Proceedings of the 28th Intl. conference on software engineering (ICSE)
Mund G, Mall R (2006) An efficient interprocedural dynamic slicing method. J Syst Softw 79(6):791–806
NASA (2017a) DAIDALUS: Detect and avoid alerting logic for unmanned systems. https://github.com/nasa/WellClear
NASA (2017b) GMAT: Generalised mission analysis tool R2017a. https://sourceforge.net/projects/gmat/files/GMAT/GMAT-R2017a/
Nguyen HV, Kästner C, Nguyen TN (2015) Cross-language program slicing for dynamic web applications. In: Proceedings of the 2015 10th joint meeting on foundations of software engineering, ACM, pp 369–380
Orso A, Sinha S, Harrold MJ (2001) Incremental slicing based on data-dependences types. In: Proceedings of the IEEE Intl. conference on software maintenance (ICSM)
Ottenstein KJ, Ottenstein LM (1984) The program dependence graph in software development environments. In: Proceedings of the ACM SIGSOFT/SIGPLAN software engineering symposium on practical software development environment
Regehr J, Chen Y, Cuoq P, Eide E, Ellison C, Yang X (2012) Test-case reduction for C compiler bugs. In: Proceedings of the ACM SIGPLAN conference on programming language design and implementation (PLDI)
Reps T, Turnidge T, Danvy O, Glück R, Thiemann P (1996) Program specialization via program slicing. In: Dagstuhl seminar on partial evaluation, vol 1110
Sun C, Li Y, Zhang Q, Gu T, Su Z (2018) Perses: Syntax-guided program reduction. In: Proceedings of the 40th Intl. conference on software engineering (ICSE)
Szegedi A, Gyimóthy T (2005) Dynamic slicing of Java bytecode programs
Tukey JW (1949) Comparing indirect means in the analysis of variance. Biometrics 5(99):99–114
Ward M (2003) Slicing the SCAM mug: a case study in semantic slicing. In: Intl. workshop on source code analysis and manipulation (SCAM)
Weiser M (1981) Program slicing. In: Proceedings of the 5th Intl. conference on software engineering
Weiser M (1982) Programmers use slices when debugging. Commun ACM 25(7):446–452
Yoo S, Binkley D, Eastman RD (2014) Seeing is slicing: Observation based slicing of picture description languages. In: Intl. workshop on source code analysis and manipulation (SCAM), pp 175–184
Zeller A (1999) Yesterday, my program worked. today it does not. Why?. In: European software engineering conference and foundations of software engineering
Zeller A, Hildebrandt R (2002) Simplifying and isolating failure-inducing input. IEEE Trans Softw Eng 28(2):183–200
Zhang X, Gupta R (2004) Cost effective dynamic program slicing. In: Proceedings of the ACM SIGPLAN 2004 Conference on programming language design and implementation
Zhang X, Gupta N, Gupta R (2007) A study of effectiveness of dynamic slicing in locating real faults. Empir Softw Eng 12(2):143–160
Acknowledgements
A special thanks to Mark Harman for many interesting conversations on the use of observational slicing. Dave Binkley is supported by NSF grant 1626262. Shin Yoo is supported by Next- Generation Information Computing Development Program through the National Research Foundation of Korea(NRF) funded by the Ministry of Science, ICT (No. 2017M3C4A7068179) and the National Research Foundation of Korea (NRF) grant funded by the Korea government (MEST) (Grant No. NRF-2016R1C1B1011042). The authors acknowledge the use of the UCL Legion High Performance Computing Facility (Legion@UCL), and associated support services, in the completion of this work. They also thank the Software Infrastructure Repository for the provision of subject programs.
Author information
Authors and Affiliations
Corresponding author
Additional information
Communicated by: Coen de Roover, David Lo and Jianjun Zhao
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
About this article
Cite this article
Binkley, D., Gold, N., Islam, S. et al. A comparison of tree- and line-oriented observational slicing. Empir Software Eng 24, 3077–3113 (2019). https://doi.org/10.1007/s10664-018-9675-9
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10664-018-9675-9