Program: 40564
Project: 40564
Buggy source:
/** 
 * Compute a slice from a call statements, dot it, and fire off ghostview to visualize the result
 * @param appJar should be something like "c:/temp/testdata/java_cup.jar"
 * @param mainClass should be something like "c:/temp/testdata/java_cup.jar"
 * @param srcCaller name of the method containing the statement of interest
 * @param srcCallee name of the method called by the statement of interest
 * @param goBackward do a backward slice?
 * @param dOptions options controlling data dependence
 * @param cOptions options controlling control dependence
 * @return a Process running ghostview to visualize the dot'ted representation of the slice
 * @throws CancelException
 * @throws IllegalArgumentException
 */
public static Process run(String appJar,String mainClass,String srcCaller,String srcCallee,boolean goBackward,DataDependenceOptions dOptions,ControlDependenceOptions cOptions) throws IllegalArgumentException, CancelException {
  try {
    AnalysisScope scope=AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar,new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
    ClassHierarchy cha=ClassHierarchy.make(scope);
    Iterable<Entrypoint> entrypoints=com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope,cha,mainClass);
    AnalysisOptions options=CallGraphTestUtil.makeAnalysisOptions(scope,entrypoints);
    CallGraphBuilder builder=Util.makeVanillaZeroOneCFABuilder(options,new AnalysisCache(),cha,scope);
    CallGraph cg=builder.makeCallGraph(options,null);
    SDG sdg=new SDG(cg,builder.getPointerAnalysis(),dOptions,cOptions);
    CGNode callerNode=SlicerTest.findMethod(cg,srcCaller);
    Statement s=SlicerTest.findCallTo(callerNode,srcCallee);
    System.err.println("String_Node_Str" + s);
    Collection<Statement> slice=null;
    if (goBackward) {
      slice=Slicer.computeBackwardSlice(s,cg,builder.getPointerAnalysis(),dOptions,cOptions);
    }
 else {
      s=getReturnStatementForCall(s);
      slice=Slicer.computeForwardSlice(s,cg,builder.getPointerAnalysis(),dOptions,cOptions);
    }
    SlicerTest.dumpSlice(slice);
    Graph<Statement> g=pruneSDG(sdg,slice);
    sanityCheck(slice,g);
    Properties p=null;
    try {
      p=WalaExamplesProperties.loadProperties();
      p.putAll(WalaProperties.loadProperties());
    }
 catch (    WalaException e) {
      e.printStackTrace();
      Assertions.UNREACHABLE();
    }
    String psFile=p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + PS_FILE;
    String dotExe=p.getProperty(WalaExamplesProperties.DOT_EXE);
    DotUtil.dotify(g,makeNodeDecorator(),GVTypeHierarchy.DOT_FILE,psFile,dotExe);
    String gvExe=p.getProperty(WalaExamplesProperties.GHOSTVIEW_EXE);
    return GVUtil.launchGV(psFile,gvExe);
  }
 catch (  WalaException e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Compute a slice from a call statements, dot it, and fire off ghostview to visualize the result
 * @param appJar should be something like "c:/temp/testdata/java_cup.jar"
 * @param mainClass should be something like "c:/temp/testdata/java_cup.jar"
 * @param srcCaller name of the method containing the statement of interest
 * @param srcCallee name of the method called by the statement of interest
 * @param goBackward do a backward slice?
 * @param dOptions options controlling data dependence
 * @param cOptions options controlling control dependence
 * @return a Process running ghostview to visualize the dot'ted representation of the slice
 * @throws CancelException
 * @throws IllegalArgumentException
 */
public static Process run(String appJar,String mainClass,String srcCaller,String srcCallee,boolean goBackward,DataDependenceOptions dOptions,ControlDependenceOptions cOptions) throws IllegalArgumentException, CancelException, IOException {
  try {
    AnalysisScope scope=AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar,FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
    ClassHierarchy cha=ClassHierarchy.make(scope);
    Iterable<Entrypoint> entrypoints=com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope,cha,mainClass);
    AnalysisOptions options=CallGraphTestUtil.makeAnalysisOptions(scope,entrypoints);
    CallGraphBuilder builder=Util.makeVanillaZeroOneCFABuilder(options,new AnalysisCache(),cha,scope);
    CallGraph cg=builder.makeCallGraph(options,null);
    SDG sdg=new SDG(cg,builder.getPointerAnalysis(),dOptions,cOptions);
    CGNode callerNode=SlicerTest.findMethod(cg,srcCaller);
    Statement s=SlicerTest.findCallTo(callerNode,srcCallee);
    System.err.println("String_Node_Str" + s);
    Collection<Statement> slice=null;
    if (goBackward) {
      slice=Slicer.computeBackwardSlice(s,cg,builder.getPointerAnalysis(),dOptions,cOptions);
    }
 else {
      s=getReturnStatementForCall(s);
      slice=Slicer.computeForwardSlice(s,cg,builder.getPointerAnalysis(),dOptions,cOptions);
    }
    SlicerTest.dumpSlice(slice);
    Graph<Statement> g=pruneSDG(sdg,slice);
    sanityCheck(slice,g);
    Properties p=null;
    try {
      p=WalaExamplesProperties.loadProperties();
      p.putAll(WalaProperties.loadProperties());
    }
 catch (    WalaException e) {
      e.printStackTrace();
      Assertions.UNREACHABLE();
    }
    String psFile=p.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + PS_FILE;
    String dotExe=p.getProperty(WalaExamplesProperties.DOT_EXE);
    DotUtil.dotify(g,makeNodeDecorator(),GVTypeHierarchy.DOT_FILE,psFile,dotExe);
    String gvExe=p.getProperty(WalaExamplesProperties.GHOSTVIEW_EXE);
    return GVUtil.launchGV(psFile,gvExe);
  }
 catch (  WalaException e) {
    e.printStackTrace();
    return null;
  }
}