This Article 
 Bibliographic References 
 Add to: 
Better Debugging via Output Tracing and Callstack-Sensitive Slicing
January/February 2010 (vol. 36 no. 1)
pp. 7-19
Susan Horwitz, University of Wisconsin-Madison, Madison
Ben Liblit, University of Wisconsin-Madison, Madison
Marina Polishchuk, Microsoft Corporation, Redmond
Debugging often involves 1) finding the point of failure (the first statement that produces bad output) and 2) finding and fixing the actual bug. Print statements and debugger break points can help with step 1. Slicing the program back from values used at the point of failure can help with step 2. However, neither approach is ideal: Debuggers and print statements can be clumsy and time-consuming and backward slices can be almost as large as the original program. This paper addresses both problems. We present callstack-sensitive slicing, which reduces slice sizes by leveraging the series of calls active when a program fails. We also show how slice intersections may further reduce slice sizes. We then describe a set of tools that identifies points of failure for programs that produce bad output. Finally, we apply our point-of-failure tools to a suite of buggy programs and evaluate callstack-sensitive slicing and slice intersection as applied to debugging. Callstack-sensitive slicing is very effective: On average, a callstack-sensitive slice is about 0.31 time the size of the corresponding full slice, down to just 0.06 time in the best case. Slice intersection is less impressive, on average, but may sometimes prove useful in practice.

[1] M. Weiser, "Program Slicing," IEEE Trans. Software Eng., vol. 10, no. 4, pp. 352-357, July 1984.
[2] Wisconsin Program-Slicing Tool 1.1 Reference Manual, Wisconsin Alumni Research Foundation,, Nov. 2000.
[3] D. Binkley and M. Harman, "A Large-Scale Empirical Study of Forward and Backward Static Slice Size and Context Sensitivity," Proc. 2003 Int'l Conf. Software Maintenance, Sept. 2003.
[4] B. Korel and J. Laski, "Dynamic Program Slicing," Information Processing Letters, vol. 29, no. 3, pp. 155-163, 1988.
[5] R. Gupta, personal communication, 2006.
[6] D. Binkley, "Semantics Guided Regression Test Cost Reduction," IEEE Trans. Software Eng., vol. 23, no. 8, pp. 498-516, Aug. 1997.
[7] J. Krinke, "Context-Sensitivity Matters, but Context Does Not," Proc. Int'l Workshop Source Code Analysis and Manipulation, pp. 29-35, 2004.
[8] S. Horwitz, T. Reps, and D. Binkley, "Interprocedural Slicing Using Dependence Graphs," ACM Trans. Programmings Languages and Systems, vol. 12, no. 1, pp. 26-60, Jan. 1990.
[9] J. Krinke, "Effects of Context on Program Slicing," J. Systems and Software, vol. 79, no. 9, pp. 1249-1260, 2006.
[10] G.R.H. Do and S. Elbaum, "Supporting Controlled Experimentation with Testing Techniques: An Infrastructure and Its Potential Impact," Empirical Software Eng.: An Int'l J., vol. 10, no. 4, pp. 405-435, 2005.
[11] G. Rothermel, S. Elbaum, A. Kinneer, and H. Do, "Software-Artifact Infrastructure Repository," http://sir.unl.eduportal/, Sept. 2006.
[12] P. Francis, D. Leon, M. Minch, and A. Podgurski, "Tree-Based Methods for Classifying Software Failures," Proc. 15th Int'l Symp. Software Reliability Eng., pp. 451-462, 2004.
[13] M. Haran, A. Karr, A. Orso, A. Porter, and A. Sanil, "Applying Classification Techniques to Remotely-Collected Program Execution Data," Proc. 10th European Software Eng. Conf., pp. 146-155, 2005.
[14] A. Zheng, M. Jordan, B. Liblit, M. Naik, and A. Aiken, "Statistical Debugging: Simultaneous Identification of Multiple Bugs," Proc. 23rd Int'l Conf. Machine Learning, pp. 1105-1112, June 2006.
[15] The GNU C Library, 0th ed., The Free Software Foundation, July 2001.
[16] GNU Binutils, binutils 2.17 ed., The Free Software Foundation, June 2006.
[17] R.M. Stallman and the GCC Developer Community, Using the GNU Compiler Collection (GCC), gcc 4.1.1 ed., The Free Software Foundation, May 2006.
[18] D. Veillard, The XML C Parser and Toolkit of Gnome, http:/, Sept. 2006.
[19] GrammaTech, Codesurfer, http:/, Sept. 2006.
[20] T. Reps, S. Horwitz, and G. Rosay, "Speeding up Slicing," Proc. ACM SIGSOFT Int'l Symp. Foundations of Software Eng., pp. 11-20, Dec. 1994.
[21] M. Hutchins, H. Foster, T. Goradia, and T. Ostrand, "Experiments of the Effectiveness of Dataflow- and Controlflow-Based Test Adequacy Criteria," Proc. Int'l Conf. Software Eng., pp. 191-200, May 1994.
[22] F.I. Vokolos and P.G. Frankl, "Empirical Evaluation of the Textual Differencing Regression Testing Technique," Proc. Int'l Conf. Software Maintenance, pp. 44-53, Nov. 1998.
[23] W.E. Wong, J.R. Horgan, A. Mathur, and A. Pasquini, "Test Set Size Minimization and Fault Detection Effectiveness: A Case Study in a Space Application," Proc. 21st Int'l Computer Software and Applications Conf., pp. 522-528, Aug. 1997.
[24] D. Binkley, S. Danicic, T. Gyimothy, M. Harman, A. Kiss, and B. Korel, "Theoretical Foundations of Dynamic Program Slicing," Theoretical Computer Science, vol. 360, no. 1, pp. 23-41, 2006.
[25] D. Binkley, S. Danicic, T. Gyimothy, M. Harman, A. Kiss, and B. Korel, "A Formalisation of the Relationship between Forms of Program Slicing," Science of Computer Programming, vol. 62, no. 3, pp. 228-252, 2006.
[26] M. Harman, D. Binkley, and S. Danicic, "Amorphous Program Slicing," J. Systems and Software, vol. 68, no. 1, pp. 45-64, 2003.
[27] X. Zhang and R. Gupta, "Cost Effective Dynamic Program Slicing," Proc. ACM SIGPLAN 2004 Conf. Programming Language Design and Implementation, pp. 94-106, June 2004.
[28] X. Zhang, R. Gupta, and Y. Zhang, "Cost and Precision Tradeoffs of Dynamic Data Slicing Algorithms," ACM Trans. Programming Languages and Systems, vol. 27, no. 4, pp. 631-661, July 2005.
[29] J. Field, G. Ramalingam, and F. Tip, "Parametric Program Slicing," Proc. ACM Symp. Principles of Programming Languages, pp. 379-392, Jan. 1995.
[30] N. Jones, C. Gomard, and P. Sestoft, Partial Evaluation and Automatic Program Generation. Prentice Hall Int'l, 1993.
[31] S. Danicic, C. Fox, M. Harman, and R. Hierons, "ConSIT: A Conditioned Program Slicer," Proc. Ninth IEEE Working Conf. Reverse Eng., pp. 216-226, Oct. 2000.
[32] D. Daoudi, S. Danicic, J. Howroyd, M. Harman, C. Fox, and M. Ward, "ConSUS: A Scalable Approach to Conditioned Slicing," Proc. Ninth IEEE Working Conf. Reverse Eng., pp. 109-118, Oct. 2002.
[33] C. Fox, M. Harman, R. Hierons, and S. Danicic, "Backward Conditioning: A New Program Specialisation Technique and Its Application to Program Comprehension," Proc. Ninth Int'l Workshop Program Comprehension, pp. 89-97, May 2001.
[34] R. Gupta, M. Soffa, and J. Howard, "Hybrid Slicing: Integrating Dynamic Information with Static Analysis," ACM Trans. Software Eng. and Methodology, vol. 6, no. 4, pp. 370-397, Oct. 1997.
[35] A. Nishimatsu, M. Jihira, S. Kusumoto, and K. Inoue, "Call-Mark Slicing: An Efficient and Economical Way of Reducing Slice," Proc. 21st Int'l Conf. Software Eng., pp. 422-431, 1999.
[36] K.B. Gallagher and J.R. Lyle, "Using Program Slicing in Software Maintenance," IEEE Trans. Software Eng., vol. 17, no. 8, pp. 751-761, Aug. 1991.
[37] H. Agrawal, R.A. DeMillo, and E.H. Spafford, "Debugging with Dynamic Slicing and Backtracking," Software—Practice & Experience, vol. 23, no. 6, pp. 589-616, 1993.
[38] A. Mulhern and B. Liblit, "Effective Slicing: A Generalization of Full and Relevant Slicing," Technical Report 1639, Univ. of Wisconsin-Madison, June 2008.

Index Terms:
Static program slicing, callstack-sensitive analysis, points of failure, output tracing and attribution.
Susan Horwitz, Ben Liblit, Marina Polishchuk, "Better Debugging via Output Tracing and Callstack-Sensitive Slicing," IEEE Transactions on Software Engineering, vol. 36, no. 1, pp. 7-19, Jan.-Feb. 2010, doi:10.1109/TSE.2009.66
Usage of this product signifies your acceptance of the Terms of Use.