-
Notifications
You must be signed in to change notification settings - Fork 2
/
Diagnostics.java
40 lines (39 loc) · 1.33 KB
/
Diagnostics.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import gov.nasa.jpf.search.Search;
import gov.nasa.jpf.search.SearchListenerAdapter;
import gov.nasa.jpf.vm.ClassInfo;
import gov.nasa.jpf.vm.ElementInfo;
import gov.nasa.jpf.vm.FieldInfo;
import gov.nasa.jpf.vm.LocalVarInfo;
import gov.nasa.jpf.vm.MethodInfo;
import gov.nasa.jpf.vm.StackFrame;
import gov.nasa.jpf.vm.ThreadInfo;
import gov.nasa.jpf.vm.VM;
public class Diagnostics extends SearchListenerAdapter {
public void propertyViolated(Search search) {
/*
VM vm = search.getVM();
ThreadInfo[] threads = vm.getLiveThreads();
// ElementInfo[] eiCandidates = new ElementInfo[threads.length];
// FieldInfo[] fiCandidates = new FieldInfo[threads.length];
// ClassLoader classLoader = Class
for (int i = 0; i < threads.length; i++) {
ClassInfo tcl = threads[i].getClassInfo();
if (tcl.getName().equals("TestThread")) {
System.out.println(tcl.getName());
// FieldInfo f1 = tcl.getInstanceField(0);
// FieldInfo f2 = tcl.getInstanceField(1);
ElementInfo ei = threads[i].getThisElementInfo();
// FieldInfo f1 = ei.getFieldInfo("idx1");
// FieldInfo f2 = ei.getFieldInfo("idx2");
// if (f1 != null && f2 != null) {
int l1 = ei.getIntField("idx1");
int l2 = ei.getIntField("idx2");
System.out.println("Thread " + threads[i].getId() +
" uses locks " + l1 +
", " + l2);
// }
}
}
*/
}
}