I have been working on program slicing for a while. Since that Backward slicing works on a control-flow graph (CFG) and there are plenty of tools that generates CFGs, I easily implemented the Backward slicing algorithm with Java.
However, as read some articles, I have seen that Forward slicing works on system dependence graphs (SDG) and I found that WALA generates SDGs, but also has Forwards Slicing implemented.
WALA is a very big project and I kinda got lost in its codes and documentation. Are there any examples of how I can use WALA's Forward slicing for Java? Or at least how I can generate a given program's SDG in dot format so that I can visualize it with Graphviz as well.
WALA's user guide may be helpful for you. In its example, you can change the
computeBackwardSlice
method to thecomputeForwardSlice
method to achieve a forward slice.Wala has been implemented be jars, you can go to download the following four jars to invoke their methods.
com.ibm.wala.core com.ibm.wala.cast com.ibm.wala.shrike com.ibm.wala.util