Search in sources :

Example 16 with INaviViewNode

use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.

the class BreakpointableNodeCounter method next.

@Override
public IterationMode next(final NaviNode node) {
    final INaviViewNode viewNode = node.getRawNode();
    if (viewNode instanceof INaviCodeNode) {
        final INaviCodeNode codeNode = (INaviCodeNode) viewNode;
        final INaviInstruction instruction = Iterables.getFirst(codeNode.getInstructions(), null);
        final INaviModule module = instruction.getModule();
        final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(instruction.getAddress()));
        if (EchoBreakpointCollector.isBlocked(breakpointManager, address)) {
            return IterationMode.CONTINUE;
        }
        ++breakpointAbleNodeCount;
    } else if (viewNode instanceof INaviFunctionNode) {
        final INaviFunctionNode functionNode = (INaviFunctionNode) viewNode;
        final INaviModule module = functionNode.getFunction().getModule();
        final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(functionNode.getFunction().getAddress()));
        if (EchoBreakpointCollector.isBlocked(breakpointManager, address)) {
            return IterationMode.CONTINUE;
        }
        ++breakpointAbleNodeCount;
    }
    return IterationMode.CONTINUE;
}
Also used : INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction)

Example 17 with INaviViewNode

use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.

the class EchoBreakpointCollector method next.

@Override
public IterationMode next(final NaviNode node) {
    final INaviViewNode viewNode = node.getRawNode();
    if (viewNode instanceof INaviCodeNode) {
        final INaviCodeNode codeNode = (INaviCodeNode) viewNode;
        final INaviInstruction instruction = Iterables.getFirst(codeNode.getInstructions(), null);
        final INaviModule module = instruction.getModule();
        final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(instruction.getAddress()));
        if (isBlocked(manager, address)) {
            return IterationMode.CONTINUE;
        }
        NaviLogger.info("Adding Echo breakpoint %s to the active list", address.getAddress().getAddress().toHexString());
        // Add the echo breakpoint to the list of active echo breakpoints
        echoBreakpointAbleAddresses.add(address);
    } else if (viewNode instanceof INaviFunctionNode) {
        final INaviFunctionNode functionNode = (INaviFunctionNode) viewNode;
        final INaviModule module = functionNode.getFunction().getModule();
        final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(functionNode.getFunction().getAddress()));
        if (isBlocked(manager, address)) {
            return IterationMode.CONTINUE;
        }
        NaviLogger.info("Adding Echo breakpoint %s to the active list", address.getAddress().getAddress().toHexString());
        // Add the echo breakpoint to the list of active echo breakpoints
        echoBreakpointAbleAddresses.add(address);
    }
    return IterationMode.CONTINUE;
}
Also used : INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction)

Example 18 with INaviViewNode

use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.

the class CGraphInliner method inlineAll.

/**
   * Inlines all function calls of a given graph.
   * 
   * @param parent Parent window used for dialogs.
   * @param container Contains the functions to be inlined.
   * @param graph Graph where the inline operation takes place.
   */
public static void inlineAll(final JFrame parent, final IViewContainer container, final ZyGraph graph) {
    Preconditions.checkNotNull(parent, "IE02285: Parent argument can not be null");
    Preconditions.checkNotNull(container, "IE02286: Container argument can not be null");
    Preconditions.checkNotNull(graph, "IE02287: Graph Argument can not be null");
    final MutableDirectedGraph<INaviViewNode, INaviEdge> mutableGraph = (MutableDirectedGraph<INaviViewNode, INaviEdge>) graph.getRawView().getGraph();
    final List<INaviViewNode> nodes = mutableGraph.getNodes();
    final HashMap<INaviInstruction, INaviFunction> instructionToFunctionMap = new HashMap<INaviInstruction, INaviFunction>();
    for (final INaviViewNode iNaviViewNode : nodes) {
        if (iNaviViewNode instanceof INaviCodeNode) {
            instructionToFunctionMap.putAll(CReferenceFinder.getCodeReferenceMap((INaviCodeNode) iNaviViewNode));
        }
    }
    for (final INaviInstruction iNaviInstruction : instructionToFunctionMap.keySet()) {
        INaviCodeNode updatedNode = null;
        for (final INaviViewNode iNaviViewNode2 : graph.getRawView().getGraph().getNodes()) {
            final INaviCodeNode codeNode = (INaviCodeNode) iNaviViewNode2;
            if (codeNode.hasInstruction(iNaviInstruction)) {
                updatedNode = codeNode;
            }
        }
        if (updatedNode != null) {
            inlineFunctionSilently(parent, container, graph, updatedNode, iNaviInstruction, instructionToFunctionMap.get(iNaviInstruction));
        } else {
            throw new IllegalStateException("IE01174: Graph final has been rendered final to an final inconsitant state");
        }
    }
}
Also used : INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) HashMap(java.util.HashMap) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviEdge(com.google.security.zynamics.binnavi.disassembly.INaviEdge) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) MutableDirectedGraph(com.google.security.zynamics.zylib.types.graphs.MutableDirectedGraph) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction)

Example 19 with INaviViewNode

use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.

the class ZyGraphBuilder method convertNodes.

/**
   * Converts the nodes of a view into Graph2D nodes.
   *
   * @param nodes The nodes to convert.
   * @param graph2D The graph where the nodes are inserted.
   * @param rawNodeToNodeMap Keeps track of view node => graph node mappings.
   * @param graphSettings Graph settings used to build the graph.
   */
private void convertNodes(final Collection<INaviViewNode> nodes, final Graph2D graph2D, final Map<INaviViewNode, Node> rawNodeToNodeMap, final ZyGraphViewSettings graphSettings) {
    for (final INaviViewNode node : nodes) {
        final Pair<Node, NaviNode> result = ZyGraphNodeBuilder.convertNode(node, graph2D, graphSettings);
        // Keep track of the view node => Graph2D node mapping
        rawNodeToNodeMap.put(node, result.first());
        m_ynodeToNodeMap.put(result.first(), result.second());
    }
}
Also used : Node(y.base.Node) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode)

Example 20 with INaviViewNode

use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.

the class ZyGraphBuilder method setupGroupNodes.

/**
   * Puts nodes that have raw parent group nodes into the corresponding yFiles group nodes.
   *
   * @param nodes The nodes to be put into their parent group nodes.
   * @param graph2D The yFiles graph the nodes belong to.
   * @param rawNodeToNodeMap Maps between raw nodes and yFiles nodes.
   */
private static void setupGroupNodes(final Iterable<INaviViewNode> nodes, final Graph2D graph2D, final Map<INaviViewNode, Node> rawNodeToNodeMap) {
    for (final INaviViewNode node : nodes) {
        if (node.getParentGroup() != null) {
            final Node child = rawNodeToNodeMap.get(node);
            final Node parent = rawNodeToNodeMap.get(node.getParentGroup());
            graph2D.getHierarchyManager().setParentNode(child, parent);
        }
    }
}
Also used : Node(y.base.Node) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode)

Aggregations

INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)73 INaviCodeNode (com.google.security.zynamics.binnavi.disassembly.INaviCodeNode)22 INaviEdge (com.google.security.zynamics.binnavi.disassembly.INaviEdge)21 Test (org.junit.Test)16 INaviGroupNode (com.google.security.zynamics.binnavi.disassembly.INaviGroupNode)14 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)13 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)12 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)12 INaviFunctionNode (com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode)11 ArrayList (java.util.ArrayList)10 IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)9 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)9 CNaviViewEdge (com.google.security.zynamics.binnavi.disassembly.CNaviViewEdge)9 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)9 CGroupNode (com.google.security.zynamics.binnavi.disassembly.CGroupNode)8 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)8 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)8 INaviTextNode (com.google.security.zynamics.binnavi.disassembly.INaviTextNode)7 MockView (com.google.security.zynamics.binnavi.disassembly.MockView)7 CView (com.google.security.zynamics.binnavi.disassembly.views.CView)7