public NodeExecutor(ExecutionGraph graph, ClassManager classManager) { this.graph = graph; exceptionResolver = new ExceptionHandlerAddressResolver(classManager, graph.getMethod()); }
public static String graph(ExecutionGraph graph) { ExecutionNode node = graph.getRoot(); StringBuilder sb = new StringBuilder("digraph {\n"); getGraph(node, graph, sb, new ArrayList<>()); sb.append("labelloc=\"t\"\n"); sb.append("label=\"").append(graph.getMethod()).append("\";\n"); sb.append('}'); return sb.toString(); }
log.warn("No types for consensus; using *unknown* type! method={}, addresses={}, " + "register={}", getMethod().getSignature(), addresses, register, types); return HeapItem.newUnknown(CommonTypes.UNKNOWN); if (register == MethodState.ReturnRegister) { log.warn("Strange: No consensus type for return register; using method return type, method={}, addresses={}, " + "register={}, " + "types={}", getMethod().getSignature(), addresses, register, types); type = method.getReturnType(); } else { log.warn("No consensus type; using *unknown* type! method={}, addresses={}, " + "register={}, types={}", getMethod().getSignature(), addresses, register, types);
ExecutionGraph execute(ExecutionGraph graph) throws VirtualMachineException { TIntIntMap addressToVisitCount = new TIntIntHashMap(); VirtualMethod method = graph.getMethod(); ExecutionNode node = graph.getRoot(); int callDepth = node.getCallDepth();
@Test public void testHasExpectedGraph() { ExecutionNode child = buildNode(CHILD_ADDRESS, CHILD_NODE_STR, CHILD_STATE_STR); when(child.getChildren()).thenReturn(new LinkedList<ExecutionNode>()); ExecutionNode root = buildNode(ROOT_ADDRESS, ROOT_NODE_STR, ROOT_STATE_STR); List<ExecutionNode> children = new LinkedList<ExecutionNode>(); children.add(child); when(root.getChildren()).thenReturn(children); VirtualMethod localMethod = mock(VirtualMethod.class); when(localMethod.toString()).thenReturn(METHOD_SIGNATURE); ExecutionGraph graph = mock(ExecutionGraph.class); when(graph.getRoot()).thenReturn(root); when(graph.getMethod()).thenReturn(localMethod); when(graph.getNodeIndex(root)).thenReturn(0); when(graph.getNodeIndex(child)).thenReturn(0); String digraph = ExecutionGrapher.graph(graph); StringBuilder sb = new StringBuilder("digraph {\n"); sb.append("\"@").append(ROOT_ADDRESS).append(".0 :: ").append(ROOT_NODE_STR).append('\n'); sb.append(ROOT_STATE_STR).append("\" -> "); sb.append("\"@").append(CHILD_ADDRESS).append(".0 :: ").append(CHILD_NODE_STR).append('\n'); sb.append(CHILD_STATE_STR).append("\"\n"); sb.append("labelloc=\"t\"\n"); sb.append("label=\"").append(METHOD_SIGNATURE).append("\";"); sb.append("\n}"); String expected = sb.toString(); assertEquals(expected, digraph); }