Leveraging Contextual Information from Function Call Chains to Improve Fault Localization
In Spectrum Based Fault Localization, program elements such as statements or functions are ranked according to a suspiciousness score which can guide the programmer in finding the fault more efficiently. However, such a ranking does not include any additional information about the element under investigation. In this work, we propose to complement function-level spectrum based fault localization with function call chains - i.e., snapshots of the call stack occurring during execution - on which the fault localization is first performed, and then narrowed down to functions. Our experiments using defects from four Defects4J programs show that (i) 84% of the defective functions can be found in call chains with highest scores, (ii) the proposed approach improves Ochiai ranking of 1 to 6 positions on average, with a relative improvement of 45%, and (iii) the improvement is substantial when Ochiai produces bad rankings.