private void checkSynchronizationStmt(Stmt sootStmt) { if(sootStmt instanceof EnterMonitorStmt) { EnterMonitorStmt enterMonitorStmt = (EnterMonitorStmt)sootStmt; lockStack.add(0, enterMonitorStmt.getOp()); expSecondExitMonitor = false; } else if(sootStmt instanceof ExitMonitorStmt) { if(!expSecondExitMonitor) { lockStack.remove(0); expSecondExitMonitor = true; } else { expSecondExitMonitor = false; } } }
public void caseExitMonitorStmt(ExitMonitorStmt stmt) { if (uses) { if (stmt.getOp() instanceof Local) { TypeVariable op = resolver.typeVariable((Local) stmt.getOp()); op.addParent(resolver.typeVariable(RefType.v("java.lang.Object"))); } } }
public Set<Unit> getUnitsWithMonitor(UnitGraph ug) { Set<Unit> unitsWithMonitor = new HashSet<Unit>(); for (Unit head : ug.getHeads()) { List<Unit> workList = new ArrayList<Unit>(); workList.add(head); Set<Unit> doneSet = new HashSet<Unit>(); while (!workList.isEmpty()) { Unit curUnit = workList.remove(0); if (!doneSet.add(curUnit)) continue; workList.addAll(ug.getSuccsOf(curUnit)); // If this is an "entermonitor" construct, // we're in a monitor from now on if (curUnit instanceof EnterMonitorStmt) unitsWithMonitor.add(curUnit); // If we leave a monitor, we're out now else if (curUnit instanceof ExitMonitorStmt) continue; else { for (Unit pred : ug.getPredsOf(curUnit)) if (unitsWithMonitor.contains(pred)) unitsWithMonitor.add(curUnit); } } } // Get rid of the entermonitor statements themselves for (Iterator<Unit> it = unitsWithMonitor.iterator(); it.hasNext(); ) if (it.next() instanceof EnterMonitorStmt) it.remove(); return unitsWithMonitor; }
@Override public void caseExitMonitorStmt(ExitMonitorStmt arg0) { injectLabelStatements(arg0); arg0.getOp().apply(this.valueswitch); this.valueswitch.getExpression(); // TODO: this.inMonitor = false; }
private void analyzeUnitExitMonitor(SootMethod method, UnitGraph cfg, ExitMonitorStmt unit) { addUnitToEmptyProduction(unit,method); analyzeSuccessors(method,cfg,unit); }
private void analyzeUnit(SootMethod method, Unit unit, UnitGraph cfg, StackNode<EnterMonitorStmt> stack) { if (visited.contains(unit)) return; /* Unit already taken care of */ visited.add(unit); if (unit instanceof EnterMonitorStmt) stack=new StackNode<EnterMonitorStmt>(stack,(EnterMonitorStmt)unit); else if (unit instanceof ExitMonitorStmt && stack != null) { EnterMonitorStmt enter; enter=stack.element(); if (!exitMon.containsKey(enter)) exitMon.put(enter,new ArrayList<ExitMonitorStmt>(8)); exitMon.get(enter).add((ExitMonitorStmt)unit); stack=stack.parent(); } for (Unit succ: cfg.getSuccsOf(unit)) analyzeUnit(method,succ,cfg,stack); }
@Override public void caseExitMonitorStmt(ExitMonitorStmt stmt) { throw new RuntimeException("todo"); }
public void caseExitMonitorStmt(ExitMonitorStmt stmt) { String varName = printValueAssignment(stmt.getOp(), "monitor"); printStmt(stmt,varName); }
public void caseExitMonitorStmt(ExitMonitorStmt stmt) { stmt.setOp(this.uv.visit( stmt.getOp(), RefType.v("java.lang.Object"), stmt)); }
public void caseExitMonitorStmt(ExitMonitorStmt stmt) { }
@Override public void caseExitMonitorStmt(ExitMonitorStmt stmt) { addInsn(buildMonitorInsn(stmt, Opcode.MONITOR_EXIT), stmt); }
@Override public void caseExitMonitorStmt(ExitMonitorStmt s) { result = result.add(mgr.ILLEGAL_MONITOR_STATE_EXCEPTION); result = result.add(mgr.NULL_POINTER_EXCEPTION); result = result.add(mightThrow(s.getOp())); }
@Override public void caseExitMonitorStmt(ExitMonitorStmt stmt) { throwNotImplementedException(stmt.getClass(), stmt.toString()); }
@Override public void caseExitMonitorStmt(ExitMonitorStmt stmt) { logger.fine("\n > > > Exit monitor statement identified < < <"); valueSwitch.callingStmt = stmt; throw new NotSupportedStmtException("ExitMonitorStmt"); }
@Override public void caseExitMonitorStmt(ExitMonitorStmt stmt) { logger.fine("\n > > > Exit monitor statement identified < < <"); throw new NotSupportedStmtException("ExitMonitorStmt"); }
public MonitorAnalysis(Scene s) { scene=s; visited=null; exitMon=new HashMap<EnterMonitorStmt,Collection<ExitMonitorStmt>>(); }
public Collection<ExitMonitorStmt> getExitMonitor(EnterMonitorStmt enterMon) { assert exitMon.containsKey(enterMon); return exitMon.get(enterMon); }
/** * Method, which should process the given statement of type * {@link ExitMonitorStmt}, but is not implemented in the current version of * this method. If method will be called an exception is thrown. * * @param stmt * Statement that should be processed to check for security * violations. * @see soot.jimple.StmtSwitch#caseExitMonitorStmt(soot.jimple.ExitMonitorStmt) * @throws UnimplementedSwitchException * Method throws always this exception, because the method is * not implemented. */ @Override public void caseExitMonitorStmt(ExitMonitorStmt stmt) { throw new SwitchException(getMsg("exception.analysis.switch.not_implemented", stmt.toString(), getSourceLine(), stmt.getClass().getSimpleName(), this.getClass().getSimpleName())); }
/** * DOC * * @see soot.jimple.StmtSwitch#caseExitMonitorStmt(soot.jimple.ExitMonitorStmt) */ @Override public void caseExitMonitorStmt(ExitMonitorStmt stmt) { stmt.getOp().apply(valueSwitch); }