Search in sources :

Example 1 with IAddressNode

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

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

the class EdgeCache method addEdges.

public void addEdges(final List<INaviEdge> edges) {
    final ImmutableMap<Integer, INaviEdge> edgesMap = Maps.uniqueIndex(edges, new Function<INaviEdge, Integer>() {

        @Override
        public Integer apply(final INaviEdge edge) {
            return edge.getId();
        }
    });
    edgesByIdCache.putAll(edgesMap);
    for (final INaviEdge edge : edges) {
        if (edge.getSource() instanceof IAddressNode && edge.getTarget() instanceof IAddressNode) {
            final IAddress sourceAddress = ((IAddressNode) edge.getSource()).getAddress();
            final IAddress targetAddress = ((IAddressNode) edge.getTarget()).getAddress();
            Integer sourceModuleId = null;
            Integer targetModuleId = null;
            if (edge.getSource() instanceof INaviCodeNode) {
                sourceModuleId = getModuleId((INaviCodeNode) edge.getSource());
            } else if (edge.getSource() instanceof INaviFunctionNode) {
                sourceModuleId = getModuleId((INaviFunctionNode) edge.getSource());
            }
            if (edge.getTarget() instanceof INaviCodeNode) {
                targetModuleId = getModuleId((INaviCodeNode) edge.getTarget());
            } else if (edge.getTarget() instanceof INaviFunctionNode) {
                targetModuleId = getModuleId((INaviFunctionNode) edge.getTarget());
            }
            if (targetModuleId != null && sourceModuleId != null) {
                UpdateAddressModuleIdCache(sourceAddress, sourceModuleId, targetAddress, targetModuleId, edge);
            }
        }
    }
}
Also used : INaviCodeNode(com.google.security.zynamics.binnavi.disassembly.INaviCodeNode) INaviFunctionNode(com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode) IAddressNode(com.google.security.zynamics.binnavi.disassembly.IAddressNode) INaviEdge(com.google.security.zynamics.binnavi.disassembly.INaviEdge) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress)

Aggregations

IAddressNode (com.google.security.zynamics.binnavi.disassembly.IAddressNode)2 INaviCodeNode (com.google.security.zynamics.binnavi.disassembly.INaviCodeNode)2 INaviFunctionNode (com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode)2 INaviEdge (com.google.security.zynamics.binnavi.disassembly.INaviEdge)1 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)1 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)1