Computer Engineering and Applications ›› 2026, Vol. 62 ›› Issue (3): 377-390.DOI: 10.3778/j.issn.1002-8331.2411-0210

• Engineering and Applications • Previous Articles     Next Articles

Statement-Level Bug Localization by Integrating Multiple Types of Features

LI Jingwen, ZHANG Jiale, YUAN Zhihao, CUI Zhanqi+   

  1. College of Computer Science,Beijing Information Science and Technology University, Beijing 100192, China
    + Corresponding author E-mail:czq@bistu.edu.cn
  • Received:2024-11-15 Revised:2025-02-10 Online:2026-02-01 Published:2026-02-01

融合多类特征的语句级缺陷定位方法

李静雯,张佳乐,袁智豪,崔展齐+   

  1. 北京信息科技大学 计算机学院,北京 100192
    + 通信作者 E-mail:czq@bistu.edu.cn
  • 基金资助:
    国家自然科学基金(61702041);北京控制工程研究所高可信嵌入式软件工程技术实验室开放基金(LHCESET202307);北京信息科技大学“勤信人才”培育计划项目(QXTCP B202406)。

Abstract: Existing deep learning-based statement-level bug localization methods perform bug localization by training deep learning models with different features, such as suspiciousness values computed by various bug localization techniques. These methods mainly focus on dynamic information from executing test cases and overlook the class imbalance issue between buggy and non-buggy statements, which limits the accuracy of bug localization. To address these issues, SMSDFL (combining spectrum, mutation, and semantic features for deep fault localization), a method that integrates multiple types of features for statement-level bug localization, is proposed. Using various spectrum-based and mutation-based bug localization methods to calculate the suspiciousness values, which are treated as spectrum and mutation features, and code statements are sliced by using data flow and control flow to obtain code fragments that are dependent on the corresponding statements, from which semantic features such as overlap and tightness metrics are calculated. Then generative adversarial network (GAN) is used to augment the feature data of bug statements to resolve the class imbalance issue between buggy and non-buggy statements. These three types of features are fused and input into the recurrent neural network to calculate the suspiciousness values of each statement, which are used to rank the statements in descending order for bug localization. To evaluate the performance of SMSDFL, experiments are conducted on the Defects4J dataset. The experimental results show that SMSDFL outperforms existing methods in bug localization performance, locates 166, 161, 151, and 68 more bug statements than Ochiai, MUSE, CGAN4FL, and GRACE, respectively, when only checking the first statement in the suspiciousness ranking.

Key words: bug localization, deep learning, neural network, generative adversarial network (GAN)

摘要: 现有基于深度学习的语句级缺陷定位方法通过深度学习模型学习各种传统缺陷定位方法计算出的可疑度值等特征来进行缺陷定位,其主要关注执行测试用例的动态信息,未关注缺陷语句与非缺陷语句之间的类不平衡问题,缺陷定位的准确性有待进一步提高。为此,提出了一种融合多类特征的语句级缺陷定位方法SMSDFL(combining spectrum,mutation and semantic features for deep fault localization),该方法将多种基于频谱和变异的缺陷定位方法计算的可疑度值作为频谱特征和变异特征,利用数据流和控制流对代码语句进行切片,获取与对应语句存在依赖关系的代码片段,以计算Overlap、Tightness等度量元作为其语义特征;采用生成对抗网络扩增缺陷语句的特征数据来解决缺陷语句与非缺陷语句之间的类不平衡问题;将这三类特征进行融合输入到递归神经网络中计算语句的可疑度值,并根据可疑度值对语句进行降序排序,以定位缺陷语句。为评估SMSDFL的缺陷定位性能在Defects4J数据集上进行了实验。实验结果表明,SMSDFL取得了比现有方法更好的缺陷定位效果,其中,仅检查可疑语句排名中的第一条语句时,SMSDFL比Ochiai、MUSE、CGAN4FL和GRACE分别多定位到166、161、151、68条缺陷语句。

关键词: 缺陷定位, 深度学习, 神经网络, 生成对抗网络