arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2103.00270cs.SE
收藏

基于代码覆盖表示学习的故障定位

Fault Localization with Code Coverage Representation Learning

Yi Li, Shaohua Wang, Tien N. Nguyen

摘要:

在本文中,我们提出了DeepRL 4FL,这是一种深度学习故障定位(FL)方法,通过将FL视为图像模式识别问题,在语句和方法级别定位错误代码。DeepRL 4FL通过新的代码覆盖表示学习(RL)和程序语句的数据依赖RL来实现这一点。这两种基于代码覆盖矩阵中的动态信息的强化学习也与基于通常可疑源代码的静态信息的代码表示学习相结合。这种组合受到犯罪现场调查的启发,在犯罪现场调查中,调查人员分析犯罪现场(失败的测试案例和语句)和相关人员(具有依赖关系的语句),同时检查过去犯下类似罪行的常见嫌疑人(训练数据中类似的错误代码)。对于代码覆盖率信息,DeepRL 4FL首先对测试用例进行排序,并标记错误代码语句,期望模型能够识别出区分错误和非错误语句/方法的模式。对于语句之间的依赖关系,除了语句本身之外,还考虑到对执行中的其他语句和数据流的数据依赖关系,可以看出语句的可疑性。最后,代码覆盖矩阵,语句之间的数据依赖关系,和源代码的矢量表示相结合,并作为一个分类器的输入,从卷积神经网络检测错误的语句/方法。我们的实证评估表明,DeepRL 4FL将最先进的语句级FL基线的前1结果从173.1%提高到491.7%。它还将现有方法级FL基线的前1结果从15.0%提高到206.3%。

英文摘要:

In this paper, we propose DeepRL4FL, a deep learning fault localization (FL) approach that locates the buggy code at the statement and method levels by treating FL as an image pattern recognition problem. DeepRL4FL does so via novel code coverage representation learning (RL) and data dependencies RL for program statements. Those two types of RL on the dynamic information in a code coverage matrix are also combined with the code representation learning on the static information of the usual suspicious source code. This combination is inspired by crime scene investigation in which investigators analyze the crime scene (failed test cases and statements) and related persons (statements with dependencies), and at the same time, examine the usual suspects who have committed a similar crime in the past (similar buggy code in the training data). For the code coverage information, DeepRL4FL first orders the test cases and marks error-exhibiting code statements, expecting that a model can recognize the patterns discriminating between faulty and non-faulty statements/methods. For dependencies among statements, the suspiciousness of a statement is seen taking into account the data dependencies to other statements in execution and data flows, in addition to the statement by itself. Finally, the vector representations for code coverage matrix, data dependencies among statements, and source code are combined and used as the input of a classifier built from a Convolution Neural Network to detect buggy statements/methods. Our empirical evaluation shows that DeepRL4FL improves the top-1 results over the state-of-the-art statement-level FL baselines from 173.1% to 491.7%. It also improves the top-1 results over the existing method-level FL baselines from 15.0% to 206.3%.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑