Skip to content

Commit

Permalink
Merge pull request #195 from barbosamaatheus/master
Browse files Browse the repository at this point in the history
feat: add option to run interprocedural analysis without new entrypoint
  • Loading branch information
pauloborba authored Jun 19, 2024
2 parents ea1165e + c9ea976 commit 9c011a5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@ class ConflictDetectionAlgorithm {
private String mode;
private long timeout;
private SootAnalysisWrapper sootWrapper;
private boolean interprocedural;

ConflictDetectionAlgorithm(String name, String mode, SootAnalysisWrapper sootWrapper) {
this.name = name
this.mode = mode;
this.timeout = null;
this.sootWrapper = sootWrapper;
ConflictDetectionAlgorithm(String name, String mode, SootAnalysisWrapper sootWrapper, long timeout) {
this(name, mode, sootWrapper, timeout, false);
}

ConflictDetectionAlgorithm(String name, String mode, SootAnalysisWrapper sootWrapper, long timeout) {
ConflictDetectionAlgorithm(String name, String mode, SootAnalysisWrapper sootWrapper, long timeout, boolean interprocedural) {
this.name = name;
this.mode = mode;
this.timeout = timeout;
this.sootWrapper = sootWrapper;
this.interprocedural = interprocedural;
}

String getName() {
Expand All @@ -40,6 +39,10 @@ class ConflictDetectionAlgorithm {
this.timeout = timeout
}

boolean getInterprocedural() {
return interprocedural
}

@Override
String toString() {
return "ConflictDetectionAlgorithm{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ package services.outputProcessors.soot
*/
class NonCommutativeConflictDetectionAlgorithm extends ConflictDetectionAlgorithm {

NonCommutativeConflictDetectionAlgorithm(String name, String mode, SootAnalysisWrapper sootWrapper) {
super(name, mode, sootWrapper)
}

NonCommutativeConflictDetectionAlgorithm(String name, String mode, SootAnalysisWrapper sootWrapper, long timeout) {
super(name, mode, sootWrapper, timeout)
}

NonCommutativeConflictDetectionAlgorithm(String name, String mode, SootAnalysisWrapper sootWrapper, long timeout, boolean interprocedural) {
super(name, mode, sootWrapper, timeout, interprocedural)
}

@Override
String generateHeaderName() {
return "left right ${this.name};right left ${this.name}"
Expand All @@ -35,9 +35,9 @@ class NonCommutativeConflictDetectionAlgorithm extends ConflictDetectionAlgorith
String entrypoints = scenario.getEntrypoints()

println "Running left right " + toString();
String leftRightResult = super.runAndReportResult(filePath, classPath, entrypoints)
String leftRightResult = super.runAndReportResult(filePath, classPath, super.getInterprocedural() ? entrypoints : null)
println "Running right left " + toString();
String rightLeftResult = super.runAndReportResult(filePathReverse, classPath, entrypoints)
String rightLeftResult = super.runAndReportResult(filePathReverse, classPath, super.getInterprocedural() ? entrypoints : null)

return "${leftRightResult};${rightLeftResult}";
} catch (ClassNotFoundInJarException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class RunSootAnalysisOutputProcessor implements OutputProcessor {
this.sootWrapper = new SootAnalysisWrapper("0.2.1-SNAPSHOT", dependenciesPath)
this.detectionAlgorithms = [
new NonCommutativeConflictDetectionAlgorithm("DF Intra", "svfa-intraprocedural", this.sootWrapper, TIMEOUT),
new NonCommutativeConflictDetectionAlgorithm("DF Inter", "svfa-interprocedural", this.sootWrapper, TIMEOUT),
new NonCommutativeConflictDetectionAlgorithm("DF Inter", "svfa-interprocedural", this.sootWrapper, TIMEOUT, true),
new ConflictDetectionAlgorithm("Confluence Intra", "dfp-confluence-intraprocedural", this.sootWrapper, TIMEOUT),
new ConflictDetectionAlgorithm("Confluence Inter", "dfp-confluence-interprocedural", this.sootWrapper, TIMEOUT),
new ConflictDetectionAlgorithm("Confluence Inter", "dfp-confluence-interprocedural", this.sootWrapper, TIMEOUT, true),
new ConflictDetectionAlgorithm("OA Intra", "overriding-intraprocedural", this.sootWrapper, TIMEOUT),
new ConflictDetectionAlgorithm("OA Inter", "overriding-interprocedural", this.sootWrapper, TIMEOUT),
new ConflictDetectionAlgorithm("OA Inter", "overriding-interprocedural", this.sootWrapper, TIMEOUT, true),
new NonCommutativeConflictDetectionAlgorithm("DFP-Intra", "dfp-intra", this.sootWrapper, TIMEOUT),
new NonCommutativeConflictDetectionAlgorithm("DFP-Inter", "dfp-inter", this.sootWrapper, TIMEOUT),
new NonCommutativeConflictDetectionAlgorithm("DFP-Inter", "dfp-inter", this.sootWrapper, TIMEOUT, true),
new NonCommutativeConflictDetectionAlgorithm("CD", "cd", this.sootWrapper, TIMEOUT),
new NonCommutativeConflictDetectionAlgorithm("CDe", "cd-e", this.sootWrapper, TIMEOUT),
new NonCommutativeConflictDetectionAlgorithm("PDG", "pdg", this.sootWrapper, TIMEOUT),
Expand Down
17 changes: 12 additions & 5 deletions src/main/services/outputProcessors/soot/SootAnalysisWrapper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,22 @@ class SootAnalysisWrapper {
}

Process executeSoot(String inputFilePath, String classPath, String mode, String entrypoints) {
return ProcessRunner.runProcess(".",
"java", "-jar" , getJarPath(),
List<String> command = [
"java", "-jar", getJarPath(),
"-csv", inputFilePath,
"-cp", classPath,
"-mode", mode,
"-entrypoints", entrypoints
);
"-mode", mode
]

if (entrypoints != null) {
command.add("-entrypoints")
command.add(entrypoints)
}

return ProcessRunner.runProcess(".", command.toArray(new String[0]))
}


String getSootAnalysisVersionDisclaimer() {
return "# This results were produced by soot-analysis v" + this.version + "\n";
}
Expand Down

0 comments on commit 9c011a5

Please sign in to comment.