@Override public Collection<CGNode> getEntrypointNodes() { Collection<CGNode> tmp = cg.getEntrypointNodes(); Set<CGNode> ret = new HashSet<>(); for (CGNode n : tmp) { if (keep.contains(n)) { ret.add(n); } } return ret; }
@Override public Collection<CGNode> getEntrypointNodes() { Collection<CGNode> tmp = cg.getEntrypointNodes(); Set<CGNode> ret = new HashSet<>(); for (CGNode n : tmp) { if (keep.contains(n)) { ret.add(n); } } return ret; }
/** * check whether all entrypoints are existing in callgraph * * @throws CallgraphConstructException */ private void checkEntrypoints(boolean _policy) throws CallgraphConstructException { HashSet<com.sap.psr.vulas.shared.json.model.ConstructId> ep_diff = new HashSet<com.sap.psr.vulas.shared.json.model.ConstructId>(); com.sap.psr.vulas.shared.json.model.ConstructId cid = null; ep_diff.addAll(this.filteredEP); for (CGNode node : this.callgraph.getEntrypointNodes()) { cid = getCid(node.getMethod()); ep_diff.remove(cid); } if (_policy && (!ep_diff.isEmpty())) throw new CallgraphConstructException("Strict policy applied; terminating as there are [" + ep_diff.size() + "] entry points missing in call graph", null); if (ep_diff.size() == this.filteredEP.size()) throw new CallgraphConstructException("[0/" + ep_diff.size() + "] entry points found in call graph", null); if ((!_policy) && (!ep_diff.isEmpty())) { WalaCallgraphConstructor.log.warn("There should be [" + this.filteredEP.size() + "] entrypoints set; but [" + ep_diff.size() + "] entrypoints are missing in the call graph"); for (com.sap.psr.vulas.shared.json.model.ConstructId m : ep_diff) WalaCallgraphConstructor.log.warn(" [" + m.getQname() + "] is missing"); } else { WalaCallgraphConstructor.log.info("All [" + this.filteredEP.size() + "] entrypoints exist in the call graph"); } }
private static<E extends ISSABasicBlock> void processStaticFieldSource(CGAnalysisContext<E> ctx, Map<BasicBlockInContext<E>, Map<FlowType<E>,Set<CodeElement>>> taintMap, StaticFieldSourceSpec ss, CallGraph cg, ISupergraph<BasicBlockInContext<E>, CGNode> graph, PointerAnalysis<InstanceKey> pa) { // get the first block: BasicBlockInContext<E> bb = null; for (CGNode n : cg.getEntrypointNodes() ){ bb = graph.getEntriesForProcedure(n)[0]; } assert bb != null : "Could not find entry basic block."; ss.addDomainElements(ctx, taintMap, bb.getMethod(), bb, null, null, graph, pa, cg); }
for (CGNode entry : cg.getEntrypointNodes()) { BasicBlockInContext<E>[] bbic = graph.getEntriesForProcedure(entry); for (BasicBlockInContext<E> element : bbic)
nodes.add(cgNode); CallGraph pcg = PartialCallGraph.make(cg, cg.getEntrypointNodes(), nodes); graph = (ISupergraph) ICFGSupergraph.make(pcg);
CGNode main = cg.getEntrypointNodes().iterator().next();