DeepBugs: A learning approach to name-based bug detection

被引:191
|
作者
Pradel M. [1 ]
Sen K. [2 ,3 ]
机构
[1] TU Darmstadt, Department of Computer Science
[2] University of California, Berkeley
关键词
Bug detection; !text type='Java']Java[!/text]Script; Machine learning; Name-based program analysis; Natural language;
D O I
10.1145/3276517
中图分类号
学科分类号
摘要
Natural language elements in source code, e.g., the names of variables and functions, convey useful information. However, most existing bug detection tools ignore this information and therefore miss some classes of bugs. The few existing name-based bug detection approaches reason about names on a syntactic level and rely on manually designed and tuned algorithms to detect bugs. This paper presents DeepBugs, a learning approach to name-based bug detection, which reasons about names based on a semantic representation and which automatically learns bug detectors instead of manually writing them. We formulate bug detection as a binary classification problem and train a classifier that distinguishes correct from incorrect code. To address the challenge that effectively learning a bug detector requires examples of both correct and incorrect code, we create likely incorrect code examples from an existing corpus of code through simple code transformations. A novel insight learned from our work is that learning from artificially seeded bugs yields bug detectors that are effective at finding bugs in real-world code. We implement our idea into a framework for learning-based and name-based bug detection. Three bug detectors built on top of the framework detect accidentally swapped function arguments, incorrect binary operators, and incorrect operands in binary operations. Applying the approach to a corpus of 150,000 JavaScript files yields bug detectors that have a high accuracy (between 89% and 95%), are very efficient (less than 20 milliseconds per analyzed file), and reveal 102 programming mistakes (with 68% true positive rate) in real-world code. © 2018 Copyright held by the owner/author(s).
引用
收藏
相关论文
共 50 条
  • [1] DeepBugs: A Learning Approach to Name-Based Bug Detection
    Pradel, Michael
    Sen, Koushik
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2018, 2
  • [2] DeepBugs: A Learning Approach to Name-Based Bug Detection
    Pradel, Michael
    Sen, Koushik
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2018, 2
  • [3] A Replication of 'DeepBugs: A Learning Approach to Name-based Bug Detection'
    Winkler, Jordan
    Agarwal, Abhimanyu
    Tung, Caleb
    Ugalde, Dario Rios
    Jung, Young Jin
    Davis, James C.
    PROCEEDINGS OF THE 29TH ACM JOINT MEETING ON EUROPEAN SOFTWARE ENGINEERING CONFERENCE AND SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING (ESEC/FSE '21), 2021, : 1604 - 1604
  • [4] Name-based Shim6: A name-based approach to host mobility
    Ming, Zhongxing
    Ubillos, Javier
    Xu, Mingwei
    MOBILE COMPUTING AND COMMUNICATIONS REVIEW, 2011, 15 (04) : 46 - 48
  • [5] Name-Based Cluster Sampling
    Ferguson, Douglas A.
    SOCIOLOGICAL METHODS & RESEARCH, 2009, 37 (04) : 590 - 598
  • [6] Comment on name-based reporting
    Catania, Joseph A.
    Osmond, Dennis
    AMERICAN JOURNAL OF PUBLIC HEALTH, 2008, 98 (10) : 1735 - 1736
  • [7] Name-Based Estimators of Intergenerational Mobility
    Santavirta, Torsten
    Stuhler, Jan
    ECONOMIC JOURNAL, 2024, 134 (663): : 2982 - 3016
  • [8] Enhancing Scalable Name-Based Forwarding
    Yuan, Haowei
    Crowley, Patrick
    Song, Tian
    2017 ACM/IEEE SYMPOSIUM ON ARCHITECTURES FOR NETWORKING AND COMMUNICATIONS SYSTEMS (ANCS), 2017, : 60 - 69
  • [9] Enabling NAME-Based Security and Trust
    Fotiou, Nikos
    Polyzos, George C.
    TRUST MANAGEMENT IX, 2015, 454 : 47 - 59
  • [10] NBA: A name-based approach to device mobility in industrial IoT networks
    Ming, Zhongxing
    Xu, Mingwei
    COMPUTER NETWORKS, 2021, 191