We use cookies to improve your experience with our site.

基于测试信息的交互式错误定位方法

Interactive Fault Localization Using Test Information

  • 摘要: 程序员很难保证初次写出的代码就是正确的,因此,排除(debugging)是软件开发过程中不可回避的重要任务。此外,排错过程耗时耗力,因此,它一直是人们关注的焦点问题之一。
    排错主要包括错误定位(fault localization)和错误修改(fault correction)两个阶段。错误定位,就是要定位导致程序运行失败的错误语句位置;而错误修改,则是使用正确的语句替换错误语句。据统计,前者要比后者更加耗时耗力,因此,本论文主要聚焦于排错的第一个阶段:错误定位。
    在传统的程序员排错过程中,程序员主要通过设置程序断点(breakpoint)来定位导致程序运行失败的错误语句。程序断点设置的位置,直接影响到整个错误定位过程的效率。然而,到目前为止,鲜少有方法和工具为程序员提供程序断点的支持,主要指在程序的何处设置程序断点。
    为了有效地支持程序员的错误定位过程,并解决传统程序员排错过程中的断点选择问题,我们在本论文中提出了一种基于测试信息的交互式错误定位框架,它有效地结合了基于测试信息的自动化错误定位方法和传统的程序员排错过程的特点。具体地,这种基于测试信息的交互式错误定位框架,根据测试用例的执行信息以及程序员在已有的程序检查点做出的判断来计算程序语句的可疑度(suspicion)。程序语句的可疑度指的是程序语句可能是错误语句的程度。基于测试信息的交互式错误定位框架,根据语句的可疑度不断为程序员推荐程序检查点(checking point)直到程序员定位导致程序运行失败的错误语句为止。以这个基于测试信息的交互式错误定位框架为基础,我们首先提出了一种简单的错误定位实现方法。但是,这种简单的交互式错误定位方法要求程序员在错误定位过程中必须提交完全正确的反馈信息,即:程序员在程序检查点处的判断必须正确,否则,错误定位过程就会失败。然而,实际的错误定位过程中,程序员很难保证永远提交正确的反馈信息。为了解决这一问题,我们在基于测试信息的交互式错误定位框架的基础上,又提出了一种具有容错能力的错误定位方法。这种方法允许程序员在错误定位过程中提交可能不正确的反馈信息,并根据程序员的反馈信息适当地修改语句的可疑度。本论文进一步通过实验比较了我们提出的基于测试信息的交互式错误定位框架(包括它的两种实现方法)和现有的错误定位方法。实验结果表明,基于测试信息的交互式错误定位方法确实能够有效地定位程序中的错误语句。
    此外,与现有的错误定位方法相比,基于测试信息的交互式错误定位方法遵循了程序员习惯的排错方式,为程序员习惯的排错过程提供了直接而有效的支持,这使得它更容易被程序员接受和使用。

     

    Abstract: Debugging is a time-consuming task in software development. Although various automated approaches have been proposed, they are not effective enough. On the other hand, in manual debugging, developers have difficulty in choosing breakpoints. To address these problems and help developers locate faults effectively, we propose an interactive fault-localization framework, combining the benefits of automated approaches and manual debugging. Before the fault is found, this framework continuously recommends checking points based on statements' suspicions, which are calculated according to the execution information of test cases and the feedback information from the developer at earlier checking points. Then we propose a naive approach, which is an initial implementation of this framework. However, with this naive approach or manual debugging, developers' wrong estimation of whether the faulty statement is executed before the checking point (breakpoint) may make the debugging process fail. So we propose another robust approach based on this framework, handling cases where developers make mistakes during the fault-localization process. We performed two experimental studies and the results show that the two interactive approaches are quite effective compared with existing fault-localization approaches. Moreover, the robust approach can help developers find faults when they make wrong estimation at some checking points.

     

/

返回文章
返回