Bug detection Using model transformations and deep learning

Document Type : Original Article

Authors

1 Department of Computer Engineering, Faculty of Engineering, Lorestan University, Khorramabad, Iran

2 Department of Computer Engineering, Faculty of Engineering, Arak University, Arak, Iran

3 Department of Computer Engineering, Malayer University, Malayer, Iran

Abstract

In recent years, software bug detection techniques have become widely used by application developers to improve code quality and ensure robustness. One of the most popular approaches is static analysis, which relies on pattern-based methods. These techniques involve manually creating patterns by experts to identify known bugs. Despite the extensive efforts to create a large set of patterns for different bugs, there are still numerous bugs that slip through all the available filters. In response to this limitation, this paper introduces a new method for automatic bug detection specifically designed for JavaScript code. The proposed approach involves mapping both buggy and bug-free code to graph representations. These graphs are then fed into a deep learning model that has been trained to classify the code as either buggy or bug-free. The model’s ability to work with graph data allows it to capture more complex relationships within the code. Furthermore, this approach can adapt to new, previously unseen bugs, enhancing its robustness. Evaluation results show that this method is able to detect a broader range of bugs and outperforms previous detection techniques in terms of accuracy and coverage.

Keywords

Main Subjects


[1] Caitlin Sadowski, Jeffrey van Gogh, Ciera Jaspan, Emma Söderberg, and Collin Winter. “Tricorder: Building a program analysis ecosystem”. In Proceedings of the 37th International Conference on Software Engineering, 2015.
[2] Andrew Scott, Johannes Bader, and Satish Chandra. “Getafix: Learning to fix bugs automatically”. In Proceedings of the ACM on Programming Languages. 2019.
[3] Miltiadis Allamanis, Marc Brockschmidt, and Mahmoud Khademi. “Learning to represent programs with graphs”. International Conference on Learning Representations, 2018.
[4] Michael Pradel and Koushik Sen. “Deepbugs: A learning approach to name-based bug detection. ACM Program. Lang, 2(OOPSLA), 2018.
[5] Edward Aftandilian, Raluca Sauciuc, Siddharth Priya, and Sundaresan 2012. “Building Useful Program Analysis Tools Using an Extensible Java Compiler. In 12th IEEE International Working Conference on Source Code Analysis and Manipulation, SCAM 2012, Riva del Garda, Italy, September 23-24, 2012. 14–23.
[6] David Hovemeyer and William Pugh. “Finding bugs is easy. In Companion to the Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA). ACM, 132–136, 2004.
[7] Yousofvand, S. Soleimani and V. Rafe, “Automatic bug localization using a combination of deep learning and model transformation through node classification”, Software Quality Journal, 2023.
[8] Andrew Rice, Edward Aftandilian, Ciera Jaspan, Emily Johnston, Michael Pradel. “Detecting Argument Selection Defects”. In OOPSLA, 2017.
[9] Xiaodong Gu, Hongyu Zhang, Dongmei Zhang, and Sunghun Kim. “Deep API learning”. In Proceedings of the 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering, FSE 2016, Seattle, WA, USA, November 13-18, 2016. 631–642.
[10] Rahul Gupta, Soham Pal, Aditya Kanade, and Shirish Shevade.. “DeepFix: Fixing Common C Language Errors by Deep Learning. InAAAI, 2017.
[11] Sudheendra Hangal and Monica S. Lam.. “Tracking down software bugs using automatic anomaly detection”. In International Conference on Software Engineering (ICSE). ACM, 291–301, 2002.
[12] Dawson Engler, David Yu Chen, Seth Hallem, Andy Chou, and Benjamin Chelf.. “Bugs as Deviant Behavior: A General Approach to Inferring Errors in Systems Code. In Symposium on Operating Systems Principles (SOSP). ACM, 57–72, 2001.
[13] Amin Nikanjam, Houssem Ben Braiek, Mohammad Mehdi Morovati, and Foutse Khomh. “Automatic Fault Detection for Deep Learning Programs Using Graph Transformation”. ACM Transactions on Software Engineering and Methodology, 2021.
[14] Dinella, H. Dai, Z. Li, M. Naik, L. Song, and K. Wang, “Hoppity: Learning graph transformations to detect and fix bugs in programs”. In International Conference on Learning Representations, 2021.
[15] Péter Gyimesi, Béla Vancsics, Andrea Stocco, Davood Mazinanian, Árpád Beszédes, Rudolf Ferenc, Ali Mesbah. “BUGSJS: a benchmark and taxonomy of JavaScript bugs”. Software Testing, Verification and Reliability, e1751,2019.
[16] Moradi, R. Yousefian, V. Rafe, “Providing a solution to deal with the state space explosion problem in graph transformation systems using bird algorithms and gravitational search”, Journal of Electrical Engineering, University of Tabriz, Volume 45, Issue 4, Pages 163-177, 2015.
[17] Darvish and S. Shamekhi, “ A hybrid multi-scale CNN-LSTM deep learning model for the identification of protein-coding regions in DNA sequences”. Tabriz Jornal of Electrival Engineering, 2022.
[18] Kipf, T. N., and Welling, M. “Semi-supervised classification with graph convolutional networks”. In The International Conference on Learning Representations (ICLR), 2017.
[19] Niepert, M. Ahmed and K. Kutzkov, “Learning convolutional neural networks for graphs”, InProceedings of The 33rd International Conference on Machine Learning, PMLR , 2016.
[20] Shervashidze, N.; Schweitzer, P.; Leeuwen, E. J. v.; Mehlhorn, K.and Borgwardt, K. M. “Weisfeiler-lehman graph kernels. Journal of Machine Learning Research 12(Sep):2539–2561 , 2011.