public void setConstErrorMessage() { MethodInfo mi = insn.getMethodInfo(); StringBuilder sb = new StringBuilder("@Const method violation: "); sb.append(mi.getFullName()); sb.append("\n\tfield: "); sb.append(((FieldInfo) use).getFullName()); sb.append("\n\tmethod: "); sb.append(insn.getSourceLocation()); msg = sb.toString(); }
boolean checkConst(Record rec, ThreadInfo ti, FieldInfo fi, Instruction insn) { if (checkConst) { AnnotationInfo ai = insn.getMethodInfo().getAnnotation("gov.nasa.jpf.Const"); if (ai != null) { violation = new Violation(rec, ti, fi, insn); violation.setConstErrorMessage(); ti.breakTransition(); return false; } } return true; }
MethodCoverage getMethodCoverage(JVM vm) { Instruction insn = vm.getLastInstruction(); if (!insn.isExtendedInstruction()) { MethodInfo mi = insn.getMethodInfo(); if (mi != lastMi) { lastMc = null; lastMi = mi; ClassInfo ci = mi.getClassInfo(); if (ci != null) { ClassCoverage cc = classes.get(ci.getName()); if (cc != null) { lastMc = cc.getMethodCoverage(mi); } } } return lastMc; } return null; }
public void executeInstruction(JVM vm) { Instruction insn = vm.getLastInstruction(); MethodInfo mi = insn.getMethodInfo(); ThreadInfo ti = vm.getLastThreadInfo(); if (mi != lastMi) { logStack(ti); lastMi = mi; } else if (insn instanceof InvokeInstruction) { MethodInfo callee; // that's the only little gist of it - if this is a VirtualInvocation, // we have to dig the callee out by ourselves (it's not known // before execution) if (insn instanceof VirtualInvocation) { VirtualInvocation callInsn = (VirtualInvocation) insn; int objref = callInsn.getCalleeThis(ti); callee = callInsn.getInvokedMethod(ti, objref); } else if (insn instanceof INVOKESPECIAL) { INVOKESPECIAL callInsn = (INVOKESPECIAL) insn; callee = callInsn.getInvokedMethod(ti); } else { InvokeInstruction callInsn = (InvokeInstruction) insn; callee = callInsn.getInvokedMethod(ti); } if (callee != null) { if (callee.isMJI()) { logStack(ti); } } else { out.println("ERROR: unknown callee of: " + insn); } } }