skip to main content
research-article
Free Access

Dynamic slicing on Java bytecode traces

Published:14 March 2008Publication History
Skip Abstract Section

Abstract

Dynamic slicing is a well-known technique for program analysis, debugging and understanding. Given a program P and input I, it finds all program statements which directly/indirectly affect the values of some variables' occurrences when P is executed with I. In this article, we develop a dynamic slicing method for Java programs. Our technique proceeds by backwards traversal of the bytecode trace produced by an input I in a given program P. Since such traces can be huge, we use results from data compression to compactly represent bytecode traces. The major space savings in our method come from the optimized representation of (a) data addresses used as operands by memory reference bytecodes, and (b) instruction addresses used as operands by control transfer bytecodes. We show how dynamic slicing algorithms can directly traverse our compact bytecode traces without resorting to costly decompression. We also extend our dynamic slicing algorithm to perform “relevant slicing”. The resultant slices can be used to explain omission errors that is, why some events did not happen during program execution. Detailed experimental results on space/time overheads of tracing and slicing are reported in the article. The slices computed at the bytecode level are translated back by our tool to the source code level with the help of information available in Java class files. Our JSlice dynamic slicing tool has been integrated with the Eclipse platform and is available for usage in research and development.

References

  1. Agrawal, H. 1991. Towards automatic debugging of computer programs. Ph.D. dissertation, Purdue University. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Agrawal, H. and Horgan, J. 1990. Dynamic program slicing. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI). ACM, New York, 246--256. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Agrawal, H., Horgan, J., Krauser, E., and London, S. 1993. Incremental regression testing. In Proceedings of the International Conference on Software Maintenance (ICSM) (Washington, DC). IEEE Computer Society Press, Los Alamitos, CA, 348--357. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Akgul, T., Mooney, V., and Pande, S. 2004. A fast assembly level reverse execution method via dynamic slicing. In Proceedings of the International Conference on Software Engineering (ICSE) (Edinburgh, Scotland). IEEE Computer Society Press, Los Alamitos, CA, 522--531. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Andersen, L. O. 1994. Program analysis and specialization for the C progranzming language. Ph.D. dissertation, University of Copenhagen.Google ScholarGoogle Scholar
  6. Berk, E. J. and Ananian, C. S. 2003. A lexical analyzer generator for Java. website: http://www.cs.princeton.edu/~appel/modern/java/JLex/.Google ScholarGoogle Scholar
  7. Dhamdhere, D., Gururaja, K., and Ganu, P. 2003. A compact execution history for dynamic slicing. Inf. Proc. Lett. 85, 145--152. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Ferrante, J., Ottenstein, K., and Warren, J. 1987. The program dependence graph and its use in optimization. ACM Trans. Prog. Lang. Syst. 9, 3, 319--349. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Goel, A., Roychoudhury, A., and Mitra, T. 2003. Compactly representing parallel program executions. In Proceedings of the ACM Symposium on Principles and Practice of Parallel Programming (PPoPP). San Diego, CA, USA, 191--202. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Gyimóthy, T., Beszédes, A., and Forgács, I. 1999. An efficient relevant slicing method for debugging. In Proceedings of the 7th ACM SIGSOFT International Symposium on Foundations of Software Engineering (Toulouse, France). ACM, New York, 303--321. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Horwitz, S., Reps, T., and Binkley, D. 1990. Interprocedural slicing using dependence graphs. ACM Trans. Prog. Lang. Syst. (TOPLAS) 12, 1, 26--60. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. JGF. The Java Grande Forum Benchmark Suite. website: http://www.epcc.ed.ac.uk/javagrande/seq/contents.html.Google ScholarGoogle Scholar
  13. Joy, B., Steele, G., Gosling, J., and Bracha, G. 2000. Java(TM) Language Specification (2nd Edition). Prentice Hall, Englewood Cliffs, NJ.Google ScholarGoogle Scholar
  14. Kaffe. The Kaffe virtual machine. website: http://www.kaffe.org.Google ScholarGoogle Scholar
  15. Korel, B. and Laski, J. W. 1988. Dynamic program slicing. Inf. Proc. Lett. 29, 3, 155--163. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Korel, B. and Rilling, J. 1997. Application of dynamic slicing in program debugging. In Proceedings of the International Workshop on Automatic Debugging (Linkoping, Sweden). Springer-Verlag, New York.Google ScholarGoogle Scholar
  17. Lamport, L. 1997. Time, clocks, and the ordering of events in a distributed system. Communications of the ACM 21, 558--565. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Larsen, L. and Harrold, M. 1996. Slicing object-oriented software. In Proceedings of the ACM/IEEE International Conference on Software Engineering (ICSE) (Berlin, Germany). IEEE Computer Society Press, Los Alamitos, CA, 495--505. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Larus, J. 1990. Abstract execution: A technique for efficiently tracing programs. Software - Practice and Experience (SPE) 20, 1241--1258. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Larus, J. R. 1999. Whole program paths. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI). ACM, Atlanta, Georgia, USA, 259--269. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Levrouw, L. J., Audenaert, K. M. R., and Campenhout, J. M. 1994. A new trace and replay system for shared memory programs based on lamport clocks. In Proceedings of the 2nd Euromicro Workshop on Parallel and Distributed Processing. IEEE Computer Society, ELIS, Universiteit Gent, Belgium, 471--478.Google ScholarGoogle Scholar
  22. Lhoták, O. 2002. Spark: A flexible points-to analysis framework for Java. M.S. dissertation, McGill University.Google ScholarGoogle Scholar
  23. Lindholm, T. and Yellin, F. 1999. The Java(TM) Virtual Machine Specification (2nd Edition). Prentice Hall, Englewood Cliffs, NJ. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Lucia, A. D. 2001. Program slicing: Methods and applications. In Proceedings of the IEEE International Workshop on Source Code Analysis and Manipulation (Florence, Italy). IEEE Computer Society Press, Los Alamitos, CA, 142--149.Google ScholarGoogle ScholarCross RefCross Ref
  25. Majumdar, R. and Jhala, R. 2005. Path slicing. In Proceedings of the International Conference on Programming Language Design and Implementation (PLDI) (Chicago, IL). ACM, New York. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Nevill-Manning, C. G. and Witten, I. H. 1997. Linear-time, incremental hierarchy inference for compression. In Proceedings of the Data Commpression Conference (DCC) (Snowbird, Utah). IEEE Computer Society Press, Los Alamitos, CA, 3--11. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Ohata, F., Hirose, K., Fujii, M., and Inoue, K. 2001. A slicing method for object-oriented programs using lightweight dynamic information. In Proceedings of the Asia-Pacific Software Engineering Conference (Macau, China). IEEE Computer Society Press, Los Alamitos, CA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Pleszkun, A. R. 1994. Techniques for compressing programm address traces. In Proceedings of the IEEE/ACM International Symposium on Microarchitecture (MICRO) (San Jose, CA). ACM, New York, 32--39. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Reiss, S. P. and Renieris, M. 2001. Encoding program executions. In Proceedings of the ACM/IEEE International Conference on Software Engineering (ICSE) (Toronto, Ont., Canada). IEEE Computer Society Press, Los Alamitos, CA, 221--230. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Ronsse, M. and Bosschere, K. D. 1999. Recplay: A fully integrated practical record/replay system. ACM Trans. Comput. Syst. (TOCS) 17, 133--152. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Sazeides, Y. 2003. Instruction isomorphism in program execution. J. Instruction-Level Paral. 5.Google ScholarGoogle Scholar
  32. Sinha, S. and Harrold, M. J. 2000. Analysis and testing of programs with exceptionhandling constructs. IEEE Trans. Softw. Eng. 26, 9, 849--871. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. SPECjvm98. 1998. Spec JVM98 benchmarks. website: http://www.specbench.org/osg/jvm98/.Google ScholarGoogle Scholar
  34. Steensgaard, B. 1996. Points-to analysis in almost linear time. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (St. Petersburg Beach, FL). ACM, New York, 32--41. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Tip, F. 1995. A survey of program slicing techniques. J. Prog. Lang. 3, 3, 121--189.Google ScholarGoogle Scholar
  36. Vallée-Rai, R., Co, P., Gagnon, E., Hendren, L., Lam, P., and Sundaresan, V. 1999. Soot - A Java bytecode optimization framework. In Proceedings of the Conference of the Centre for Advanced Studies on Collaborative Research (CASCON) (Mississauga, Ontario, Canada). IBM Press. 13. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Wang, T. and Roychoudhury, A. 2007. Dynamic slicing on Java bytecode traces. Tech. Rep. TRB3/07, National University of Singapore. March. http://www.comp.nus.edu.sg/~abhik/pdf/JSlice-TR.pdf.Google ScholarGoogle Scholar
  38. Weiser, M. 1984. Program slicing. IEEE Trans. Softw. Engineering 10, 4, 352--357.Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Xu, B., Chen, Z., and Yang, H. 2002. Dynamic slicing object-oriented programs for debugging. In Proceedings of the IEEE International Workshop on Source Code Analysis and Manipulation (Montreal, Canada). IEEE Computer Society Press, Los Alamitos, CA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Zhang, Y. and Gupta, R. 2001. Timestamped whole program path representation and its applications. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (Snowbird, UT). ACM, New York, 180--190. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Zhang, X. and Gupta, R. 2004. Whole execution traces. In Proceedings of the IEEE/ACM International Symposium on Microarchitecture (MICRO) (Portland, OR). IEEE Computer Society Press, Los Alamitos, CA, 105--116. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Zhang, X., Gupta, R., and Zhang, Y. 2005. Cost and precision tradeoffs of dynamic data slicing algorithms. ACM Trans. Prog. Lang. Syst. (TOPLAS) 27, 631--661. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Zhao, J. 2000. Dependence analysis of Java bytecode. In IEEE Annual International Computer Software and Applications Conference (Taipei, Taiwan). IEEE Computer Society Press, Los Alamitos, CA, 486--491. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Zilles, C. B. and Sohi, G. 2000. Understanding the backward slices of performance degrading instructions. In Proceedings of the International Symposium on Computer Architecture (ISCA) (Vancouver, BC, Canada). IEEE Computer Society Press, Los Alamitos, CA, 172--181. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Dynamic slicing on Java bytecode traces

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM Transactions on Programming Languages and Systems
        ACM Transactions on Programming Languages and Systems  Volume 30, Issue 2
        March 2008
        217 pages
        ISSN:0164-0925
        EISSN:1558-4593
        DOI:10.1145/1330017
        Issue’s Table of Contents

        Copyright © 2008 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 14 March 2008
        • Accepted: 1 February 2007
        • Revised: 1 October 2005
        • Received: 1 March 2005
        Published in toplas Volume 30, Issue 2

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article
        • Research
        • Refereed

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!