private String operation;
private String detail;
private String errorMessage;
+ private String varName;
private int depth;
private int id;
private boolean manual = false;
private boolean conflictFound = false;
private int currentEvent = -1;
private boolean debugMode = false;
+ private int popRef = 0;
private final String SET_LOCATION_METHOD = "setLocationMode";
private final String LOCATION_VAR = "locationMode";
ti.setNextPC(nextIns);
}
}
-
- if (conflictFound) {
+ if (conflictFound) {
StringBuilder sb = new StringBuilder();
sb.append(errorMessage);
Instruction nextIns = ti.createAndThrowException("java.lang.RuntimeException", sb.toString());
ti.setNextPC(nextIns);
} else {
+ // Check if we are ready to pop the values
+ if (popRef == 2) {
+ byte type = getType(ti, executedInsn);
+ varName = getValue(ti, executedInsn, type);
+ String writer = getWriter(ti.getStack(), appSet);
+
+ popRef = popRef-1;
+ } else if (popRef == 1) {
+ byte type = getType(ti, executedInsn);
+ String value = getValue(ti, executedInsn, type);
+ String writer = getWriter(ti.getStack(), appSet);
+
+ for (String var: conflictSet) {
+ if (varName.contains(var)) {
+ if (writer != null) {
+ System.out.println("################# writer: "+writer);
+ System.out.println("################# variable: "+varName);
+ System.out.println("################# value: "+value);
+ System.out.println("################# manual: "+manual);
+ writeWriterAndValue(writer, varName, value);
+ }
+ }
+ }
+
+ popRef = popRef-1;
+ }
+
+
+ if (executedInsn.getMnemonic().equals("getfield")) {
+ if (executedInsn.toString().contains("deviceValueSmartThing") ||
+ executedInsn.toString().contains("deviceIntValueSmartThing")) {
+ if (executedInsn.getNext() != null) {
+ if (executedInsn.getNext().getMnemonic().contains("load")) {
+
+ if (executedInsn.getNext().getNext() != null)
+ if (executedInsn.getNext().getNext().getMnemonic().contains("load"))
+ popRef = 2;
+ }
+ }
+ }
+ }
if (executedInsn instanceof WriteInstruction) {
String varId = ((WriteInstruction) executedInsn).getFieldInfo().getFullName();
if (varId.contains("isManualTransaction")) {
byte type = getType(ti, executedInsn);
String value = getValue(ti, executedInsn, type);
- System.out.println();
+
manual = (value.equals("true"))?true:false;
}
- for (String var : conflictSet) {
- if (varId.contains(var)) {
- // Get variable info
- byte type = getType(ti, executedInsn);
- String value = getValue(ti, executedInsn, type);
- String writer = getWriter(ti.getStack(), appSet);
-
- // Just return if the writer is not one of the listed apps in the .jpf file
- if (writer == null)
- return;
-
- // Update the current updates
- writeWriterAndValue(writer, var, value);
- }
- }
}
- }
+ }
}
}