Commit e9d7c3e5 authored by Carlos Galindo's avatar Carlos Galindo
Browse files

Make slices interprocedural

- A flag has been added to make slices intraprocedural if desired.
parent db99fce8
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -163,7 +163,10 @@ public class EKnife {
					kArgs.setGraphFile(new File(args[argIndex + 1]));
					break;
				case "--ignore-constraints":
					kArgs.algClass = AdaptedStandardAlgorithm.class;
					kArgs.constrainedAlgorithm = false;
					break;
				case "--intraprocedural":
					kArgs.intraproceduralAlgorithm = true;
					break;
			}
		}
@@ -185,6 +188,7 @@ public class EKnife {
		help += "  -G,--print-graph <file.dot> Exports the graph as a dot file\n";
		help += "  -G,--print-graph <file.pdf> Exports the graph as a PDF file\n";
		help += "  --ignore-constraints        Generates constraints but ignores when slicing\n";
		help += "  --intraprocedural           Makes the slice intraprocedural, the algorithm will not traverse function bounds\n";
		help += "  --help                      Show this message.\n";

		System.out.print(help);
@@ -666,8 +670,9 @@ public class EKnife {
		int occurrence = 1;
		File graphFile;
		GraphFormat graphFormat;
		Class<? extends SlicingAlgorithm> algClass = OnePassConstrainedAlgorithm.class;

		boolean intraproceduralAlgorithm = false;
		boolean constrainedAlgorithm = true;
		Class<? extends SlicingAlgorithm> algClass;

		void setGraphFile(File graphFile) {
			if (graphFile.getName().endsWith(".dot"))
@@ -684,6 +689,9 @@ public class EKnife {
		void completeData() {
			if (file == null && inputPath != null && new File(inputPath).isFile())
				file = new File(inputPath).getName();
			if (intraproceduralAlgorithm)
				algClass = constrainedAlgorithm ? OnePassConstrainedAlgorithm.class : AdaptedStandardAlgorithm.class;
			else algClass = constrainedAlgorithm ? ConstrainedAlgorithm.class : StandardAlgorithm.class;
		}

		boolean isValid() {