Locating Code Omission Error due to Incorrect Polymorphic Method Call
Dynamic program slicing methods are widely used for debugging, because many statements can be ignored in the process of localizing a bug. A dynamic program slice for a variable contains only those statements that actually had an influence on this variable. One limitation of dynamic slicing-based techniques is that they cannot capture execution omission errors,which may cause the execution of certain critical statements in a program to be omitted and thus result in failures. In this paper,we propose a fully dynamic solution to locate execution omission errors by using dynamic slices for a variable in the presence of functions which are virtual in Java programs. Due to assignment of objects of wrong derived classes to base class reference,some different versions of polymorphic functions may be called which may cause failure. We designed a slicing method called polymorphic relevant slice where we forced the execution of the omitted code by initializing objects of all possible classes derived from the same base class with the available data, assigning them to base class reference one-by-one and switch execution for all alternative virtual functions to check if any of them meets specification. We have used system dependence graph to identify all the derived class objects which could have been assigned to the base class reference.