Abstract
Lots of fault localization techniques have been developed to reduce the time in debugging a faulty program. The technique of code coverage has been recognized by its effectiveness in identifying suspicious statements that may contain the fault. However, a programmer still needs to manually examine each variable referenced in a suspicious statement and such a process can become extremely time-consuming. In our previous work, we proposed a novel technique called state coverage to significantly reduce the time in examining variables. However, the previous state coverage was built on top of code coverage so that its improvement is limited. In this paper, we further propose a slice-based approach to enhance state coverage. We first insert a set of checkpoints to record the state of each variable referenced in a branching statement. We next execute the faulty program by a test suite consisting of both passed and failed cases. A state is statistically considered to be more suspicious if it appears more in failed cases and less in passed cases. State coverage will then elect the program state having highest relativity against the fault. We implemented both code coverage and state coverage in a debugging tool and used a commonly-used benchmark consisting of 61 faulty programs to evaluate their performance. For 49% of these programs, their faults are within 20 statements of the most suspicious statement identified by code coverage. On the other hand, state coverage increases this ratio to 82%, a 67% performance improvement.