Program slicing is a technique for program analysis and transformation with many different applications such as program debugging, program specialisation, and parallelisation. The system dependence graph (SDG), the most commonly used data structure for program slicing, has been extended in several ways to manage exception handling constructs. In this paper, however, we show that the presence of exception-handling constructs can make even the extended SDG produce incorrect and incomplete slices. To solve this situation, we survey the current state of the art and merge and extend different approaches (that treat throws, try-catch, etc.) to produce a version of the SDG that is able to manage all of them, that always produces complete slices, and that increases its precision keeping the same time complexity. An interesting side result is the discovering of a new kind of control dependence: conditional control dependence, which is needed to properly represent catch statements.
Read full abstract