Decomposing Source Codes by Program Slicing for Bug Localization

Jian Yong, Ziye Zhu, Yun Li · 2023

Bug localization, which aims to automatically locate buggy source code files based on the given bug report, is a critical yet time-consuming task in the software engineering field. Existing advanced bug localization methods have successfully leveraged deep learning to bridge the lexical gap between bug reports and source code files at the semantic level. These methods usually first build the entire source code file semantic representation and then match it with the bug report. However, the bug described in the bug report may be related to only part of the source code file semantics. Directly constructing a semantic representation of the entire source code file would increase the difficulty of semantic matching between bug reports and source code files. In this paper, we propose a novel model named S-BugLocator, which decomposes source code file with the help of program slicing. Especially, our proposed S-BugLocator incorporates two distinctly structured slice feature extraction components in processing source code files to cope with the significant discrepancy between multi-row slices and single-row slices. For each multi-row slice, a CNN and Bi-LSTM network is firstly employed to extract its semantics and then a keywords supervised attention mechanism is designed to build its semantic representation by focusing on slices that have strong relevance with the bug report. For each single-row slice, the semantic representation is obtained by fusing word embeddings in single-row slices. The experimental results on four real-world large-scale projects indicate that our proposed model outperforms existing state-of-the-art bug localization methods.

Read the paper · More papers on PaperTik