Search in sources :

Example 1 with INaviFunctionNode

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

the class PostgreSQLEdgeLoader method initializeGlobalComment.

/**
   * Initializes the global comment for an edge.
   *
   * @param edge The edge whose global comment is initialized.
   * @param globalComments The global comment to set.
   */
private static void initializeGlobalComment(final CNaviViewEdge edge, final ArrayList<IComment> globalComments, final SQLProvider provider) {
    final INaviViewNode source = edge.getSource();
    final INaviViewNode target = edge.getTarget();
    if ((source instanceof INaviCodeNode) && (target instanceof IAddressNode)) {
        CommentManager.get(provider).initializeGlobalEdgeComment(edge, globalComments);
    } else if ((source instanceof INaviFunctionNode) && (target instanceof IAddressNode)) {
        CommentManager.get(provider).initializeGlobalEdgeComment(edge, globalComments);
    }
}
Also used : INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode) IAddressNode(com.google.security.zynamics.binnavi.disassembly.IAddressNode)

Example 2 with INaviFunctionNode

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

the class CViewContent method updateGraphType.

/**
   * Calculates the new graph type of the view from the current state of the view graph.
   */
private void updateGraphType() {
    boolean hasCodeNode = false;
    boolean hasFunctionNode = false;
    for (final INaviViewNode node : graph.getNodes()) {
        if (node instanceof INaviFunctionNode) {
            hasFunctionNode = true;
            if (hasCodeNode) {
                setGraphType(GraphType.MIXED_GRAPH);
                return;
            }
        } else if (node instanceof INaviCodeNode) {
            hasCodeNode = true;
            if (hasFunctionNode) {
                setGraphType(GraphType.MIXED_GRAPH);
                return;
            }
        }
    }
    if (hasCodeNode) {
        setGraphType(GraphType.FLOWGRAPH);
    } else if (hasFunctionNode) {
        setGraphType(GraphType.CALLGRAPH);
    } else {
        setGraphType(GraphType.MIXED_GRAPH);
    }
}
Also used : INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode)

Example 3 with INaviFunctionNode

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

the class CViewInserter method createNodes.

/**
   * Clones a node of the source view and inserts it into the target view.
   *
   * @param target The target view where the cloned view is inserted.
   * @param sourceNode The source node that is cloned and inserted into the target view.
   * @param nodeMap Maps nodes of the source view to their cloned counterparts.
   */
private static void createNodes(final INaviView target, final INaviViewNode sourceNode, final Map<INaviViewNode, INaviViewNode> nodeMap) {
    final INaviViewNode newNode = CNodeTypeSwitcher.switchNode(sourceNode, new INodeTypeCallback<INaviViewNode>() {

        @Override
        public INaviViewNode handle(final INaviCodeNode node) {
            return insertCodeNode(target, node);
        }

        @Override
        public INaviViewNode handle(final INaviFunctionNode node) {
            return insertFunctionNode(target, node);
        }

        @Override
        public INaviViewNode handle(final INaviGroupNode node) {
            // Skip now, create later
            return null;
        }

        @Override
        public INaviViewNode handle(final INaviTextNode node) {
            return insertTextNode(target, node);
        }
    });
    if (newNode != null) {
        newNode.setBorderColor(sourceNode.getBorderColor());
        newNode.setColor(sourceNode.getColor());
        newNode.setHeight(sourceNode.getHeight());
        newNode.setSelected(sourceNode.isSelected());
        newNode.setVisible(sourceNode.isVisible());
        newNode.setWidth(sourceNode.getWidth());
        newNode.setX(sourceNode.getX());
        newNode.setY(sourceNode.getY());
        nodeMap.put(sourceNode, newNode);
    }
}
Also used : INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) INaviTextNode(com.google.security.zynamics.binnavi.disassembly.INaviTextNode) INaviViewNode(com.google.security.zynamics.binnavi.disassembly.INaviViewNode) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode) INaviGroupNode(com.google.security.zynamics.binnavi.disassembly.INaviGroupNode)

Example 4 with INaviFunctionNode

use of com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode 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 5 with INaviFunctionNode

use of com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode 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)

Aggregations

INaviFunctionNode (com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode)24 INaviCodeNode (com.google.security.zynamics.binnavi.disassembly.INaviCodeNode)17 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)9 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)7 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)6 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)6 IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)5 MaybeNullException (com.google.security.zynamics.binnavi.Exceptions.MaybeNullException)4 CFunctionNode (com.google.security.zynamics.binnavi.disassembly.CFunctionNode)4 INaviGroupNode (com.google.security.zynamics.binnavi.disassembly.INaviGroupNode)4 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)3 INaviTextNode (com.google.security.zynamics.binnavi.disassembly.INaviTextNode)3 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)3 FunctionNodeCommentNotificationContainer (com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.FunctionNodeCommentNotificationContainer)2 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)2 IAddressNode (com.google.security.zynamics.binnavi.disassembly.IAddressNode)2 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)2