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

原因线索子句:使用最大可满足性的错误定位

Cause Clue Clauses: Error Localization using Maximum Satisfiability

Manu Jose, Rupak Majumdar

摘要:

程序员每天都要花费大量的精力,试图减少长时间的失败执行跟踪到错误的原因。我们提出了一个新的算法的错误原因定位的基础上减少的最大可满足性问题(MAX-SAT),它问什么是布尔公式的子句,可以同时满足的分配的最大数量。在直观的水平上,我们的算法作为输入的程序和失败的测试,并包括以下三个步骤。首先,使用符号执行,我们编码一个程序的跟踪作为布尔跟踪公式是可满足的,当?第二,对于失败的程序执行(例如,违反断言或后置条件的一个),我们通过采用跟踪公式并另外断言输入是失败的测试并且断言条件在最后确实成立来构造不可满足的公式。第三,使用MAX-SAT,我们找到一个最大的一组条款,可以满足在这个公式中,并输出的补充集作为一个潜在的错误原因。我们已经实现了我们的算法在一个工具,称为错误协助C程序。我们展示了令人惊讶的有效性的工具上的一组基准测试的例子注入故障,并表明,在大多数情况下,错误辅助可以快速,精确地隔离的确切的几行代码的变化消除了错误。我们还演示了如何修改我们的算法,以自动建议修复常见类别的错误,如关闭一个。

英文摘要:

Much effort is spent everyday by programmers in trying to reduce long, failing execution traces to the cause of the error. We present a new algorithm for error cause localization based on a reduction to the maximal satisfiability problem (MAX-SAT), which asks what is the maximum number of clauses of a Boolean formula that can be simultaneously satisfied by an assignment. At an intuitive level, our algorithm takes as input a program and a failing test, and comprises the following three steps. First, using symbolic execution, we encode a trace of a program as a Boolean trace formula which is satisfiable iff the trace is feasible. Second, for a failing program execution (e.g., one that violates an assertion or a post-condition), we construct an unsatisfiable formula by taking the trace formula and additionally asserting that the input is the failing test and that the assertion condition does hold at the end. Third, using MAX-SAT, we find a maximal set of clauses in this formula that can be satisfied together, and output the complement set as a potential cause of the error. We have implemented our algorithm in a tool called bug-assist for C programs. We demonstrate the surprising effectiveness of the tool on a set of benchmark examples with injected faults, and show that in most cases, bug-assist can quickly and precisely isolate the exact few lines of code whose change eliminates the error. We also demonstrate how our algorithm can be modified to automatically suggest fixes for common classes of errors such as off-by-one.

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

↑