From: amiraj Date: Thu, 17 Oct 2019 18:40:45 +0000 (-0700) Subject: Add some minor changes to the listener to make the error message more clean! X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=refs%2Fheads%2Faj_branch;p=jpf-core.git Add some minor changes to the listener to make the error message more clean! --- diff --git a/src/main/gov/nasa/jpf/listener/ConflictTracker.java b/src/main/gov/nasa/jpf/listener/ConflictTracker.java index adbab19..9fb12cf 100644 --- a/src/main/gov/nasa/jpf/listener/ConflictTracker.java +++ b/src/main/gov/nasa/jpf/listener/ConflictTracker.java @@ -49,6 +49,7 @@ public class ConflictTracker extends ListenerAdapter { private Node parentNode = new Node(-2); private String operation; private String detail; + private String errorMessage; private int depth; private int id; private boolean conflictFound = false; @@ -145,7 +146,7 @@ public class ConflictTracker extends ListenerAdapter { for (NameValuePair i : currentNode.getSetSet()) { if (i.getIsManual()) // Manual input: we have no conflict - return false; + continue; valueMap.put(i.getVarName(), i.getValue()); if (writerMap.containsKey(i.getVarName())) @@ -157,9 +158,13 @@ public class ConflictTracker extends ListenerAdapter { // Comparing the inSet and setSet to find the conflict for (NameValuePair i : currentNode.getInSet()) { if (valueMap.containsKey(i.getVarName())) { - if (!(valueMap.get(i.getVarName()).equals(i.getValue()))) - if (!(writerMap.get(i.getVarName()).equals(i.getAppNum()))) + if (!(valueMap.get(i.getVarName()).equals(i.getValue()))) // We have different values + if (!(writerMap.get(i.getVarName()).equals(i.getAppNum()))) {// We have different writers + errorMessage = "Conflict found between the two apps. App"+i.getAppNum()+" has written the value: "+i.getValue()+ + " to the variable: "+i.getVarName()+" while App"+writerMap.get(i.getVarName())+" is overwriting the value: " + +valueMap.get(i.getVarName())+" to the same variable!"; return true; + } } } @@ -541,7 +546,7 @@ public class ConflictTracker extends ListenerAdapter { if (conflictFound) { StringBuilder sb = new StringBuilder(); - sb.append("Conflict found between two apps!"); + sb.append(errorMessage); Instruction nextIns = ti.createAndThrowException("java.lang.RuntimeException", sb.toString()); ti.setNextPC(nextIns); } else if (executedInsn instanceof WriteInstruction) {