{"title":"Fault localization by abstract interpretation and its applications","authors":"Aleksandar S. Dimovski","doi":"10.1016/j.cola.2024.101288","DOIUrl":null,"url":null,"abstract":"<div><p><em>Fault localization</em> aims to automatically identify the cause of an error in a program by localizing the error to a relatively small part of the program. In this paper, we present a novel technique for automated fault localization via <em>error invariants</em> inferred by abstract interpretation. An error invariant for a location in an error program over-approximates the reachable states at the given location that may produce the error, if the execution of the program is continued from that location. Error invariants can be used for <em>statement-wise semantic slicing</em> of error programs and for obtaining concise error explanations. We use an iterative refinement sequence of backward–forward static analyses by abstract interpretation to compute error invariants, which are designed to explain why an error program violates a particular assertion.</p><p>Furthermore, we present a practical application of the fault localization technique for automatic repair of programs. Given an erroneous program, we first use the fault localization to automatically identify statements relevant for the error, and then repeatedly mutate the expressions in those relevant statements until a correct program that satisfies all assertions is found. All other statements classified by the fault localization as irrelevant for the error are not mutated in the program repair process. This way, we significantly reduce the search space of mutated programs without losing any potentially correct program, and so locate a repaired program much faster than a program repair without fault localization.</p><p>We have developed a prototype tool for automatic fault localization and repair of C programs. We demonstrate the effectiveness of our approach to localize errors in realistic C programs, and to subsequently repair them. Moreover, we show that our approach based on combining fault localization and code mutations is significantly faster that the previous program repair approach without fault localization.</p></div>","PeriodicalId":48552,"journal":{"name":"Journal of Computer Languages","volume":"80 ","pages":"Article 101288"},"PeriodicalIF":1.7000,"publicationDate":"2024-08-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Computer Languages","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S2590118424000315","RegionNum":3,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0
Abstract
Fault localization aims to automatically identify the cause of an error in a program by localizing the error to a relatively small part of the program. In this paper, we present a novel technique for automated fault localization via error invariants inferred by abstract interpretation. An error invariant for a location in an error program over-approximates the reachable states at the given location that may produce the error, if the execution of the program is continued from that location. Error invariants can be used for statement-wise semantic slicing of error programs and for obtaining concise error explanations. We use an iterative refinement sequence of backward–forward static analyses by abstract interpretation to compute error invariants, which are designed to explain why an error program violates a particular assertion.
Furthermore, we present a practical application of the fault localization technique for automatic repair of programs. Given an erroneous program, we first use the fault localization to automatically identify statements relevant for the error, and then repeatedly mutate the expressions in those relevant statements until a correct program that satisfies all assertions is found. All other statements classified by the fault localization as irrelevant for the error are not mutated in the program repair process. This way, we significantly reduce the search space of mutated programs without losing any potentially correct program, and so locate a repaired program much faster than a program repair without fault localization.
We have developed a prototype tool for automatic fault localization and repair of C programs. We demonstrate the effectiveness of our approach to localize errors in realistic C programs, and to subsequently repair them. Moreover, we show that our approach based on combining fault localization and code mutations is significantly faster that the previous program repair approach without fault localization.
故障定位的目的是通过将错误定位到程序中相对较小的部分来自动识别程序中的错误原因。在本文中,我们提出了一种通过抽象解释推断出的错误不变式进行自动故障定位的新技术。错误程序中某一位置的错误不变式可以过度近似给定位置上可能产生错误的可到达状态,如果程序从该位置继续执行的话。错误不变式可用于对错误程序进行语句语义切分,并获得简明的错误解释。我们通过抽象解释使用后向-前向静态分析的迭代精炼序列来计算错误不变式,旨在解释错误程序违反特定断言的原因。给定一个错误的程序,我们首先使用故障定位自动识别与错误相关的语句,然后反复修改这些相关语句中的表达式,直到找到一个满足所有断言的正确程序。在程序修复过程中,所有被故障定位归类为与错误无关的其他语句都不会被修改。通过这种方法,我们在不丢失任何潜在正确程序的情况下,大大减少了变异程序的搜索空间,因此修复程序的定位速度比不进行故障定位的程序修复快得多。我们开发了自动定位和修复 C 语言程序故障的原型工具。我们展示了我们的方法在定位现实 C 语言程序中的错误以及随后修复它们的有效性。此外,我们还展示了基于故障定位和代码突变相结合的方法,其修复速度明显快于之前不进行故障定位的程序修复方法。