Search in sources :

Example 81 with IAddress

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

the class TypeSubstitutionsUpdater method rebuild.

/**
 * Rebuilds all affected nodes for the given {@link TypeSubstitution type substitutions}.
 *
 * @param typeSubstitutions A set of {@link TypeSubstitution type substitutions} from a listener
 *        event.
 */
private void rebuild(Set<TypeSubstitution> typeSubstitutions) {
    final IAddress startAddress = codeNode.getAddress();
    final IAddress endAddress = codeNode.getLastInstruction().getAddress();
    for (final TypeSubstitution substitution : typeSubstitutions) {
        if (substitution.getAddress().toLong() >= startAddress.toLong() && substitution.getAddress().toLong() <= endAddress.toLong()) {
            naviNode.getRealizer().regenerate();
            naviNode.getRealizer().repaint();
            return;
        }
    }
}
Also used : TypeSubstitution(com.google.security.zynamics.binnavi.disassembly.types.TypeSubstitution) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress)

Example 82 with IAddress

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

the class CNodeClickHandler method nodeClicked.

/**
 * Handles clicks on nodes.
 *
 * @param node The clicked node.
 * @param event The click event.
 * @param x The x-coordinate of the click.
 * @param y The y-coordinate of the click.
 * @param extensions List of objects that extend code node context menus.
 */
public void nodeClicked(final NaviNode node, final MouseEvent event, final double x, final double y, final List<ICodeNodeExtension> extensions) {
    if (event.getButton() == MouseEvent.BUTTON3) {
        handleRightClick(node, event, x, y, extensions);
    } else if ((event.getButton() == MouseEvent.BUTTON1) && (event.getClickCount() == 2) && event.isControlDown()) {
        final INaviViewNode rawNode = node.getRawNode();
        if (rawNode instanceof INaviFunctionNode) {
            final INaviFunction function = ((INaviFunctionNode) rawNode).getFunction();
            CGraphOpener.showFunction(m_model.getParent(), m_model.getViewContainer(), function);
        } else if (rawNode instanceof INaviCodeNode) {
            final INaviCodeNode cnode = (INaviCodeNode) rawNode;
            final int row = node.positionToRow(y - node.getY());
            final INaviInstruction instruction = CCodeNodeHelpers.lineToInstruction(cnode, row);
            if (instruction == null) {
                return;
            }
            final Set<IAddress> references = new HashSet<IAddress>();
            for (final INaviOperandTree operand : instruction.getOperands()) {
                collectReferences(operand.getRootNode(), references);
            }
            final List<INaviFunction> functions = m_model.getViewContainer().getFunctions();
            for (final INaviFunction function : functions) {
                for (final IAddress address : references) {
                    if (function.getAddress().equals(address)) {
                        CGraphOpener.showFunction(m_model.getParent(), m_model.getViewContainer(), function);
                    }
                }
            }
        }
    } else if (!m_model.getGraph().getEditMode().getLabelEventHandler().isActive() && (event.getButton() == MouseEvent.BUTTON1) && (event.getClickCount() == 2)) {
        if ((node.getRawNode() instanceof INaviGroupNode) && event.isShiftDown()) {
            final INaviGroupNode gnode = (INaviGroupNode) node.getRawNode();
            gnode.setCollapsed(!gnode.isCollapsed());
        } else {
            CGraphZoomer.zoomNode(m_model.getGraph(), node);
        }
    }
}
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) INaviOperandTree(com.google.security.zynamics.binnavi.disassembly.INaviOperandTree) INaviGroupNode(com.google.security.zynamics.binnavi.disassembly.INaviGroupNode) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction) HashSet(java.util.HashSet)

Aggregations

IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)82 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)28 ArrayList (java.util.ArrayList)23 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)19 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)16 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)15 Test (org.junit.Test)14 SQLException (java.sql.SQLException)12 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)11 ResultSet (java.sql.ResultSet)11 BigInteger (java.math.BigInteger)10 HashMap (java.util.HashMap)10 INaviCodeNode (com.google.security.zynamics.binnavi.disassembly.INaviCodeNode)9 COperandTree (com.google.security.zynamics.binnavi.disassembly.COperandTree)7 INaviOperandTreeNode (com.google.security.zynamics.binnavi.disassembly.INaviOperandTreeNode)7 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)7 CConnection (com.google.security.zynamics.binnavi.Database.CConnection)6 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)6 ReilFunction (com.google.security.zynamics.reil.ReilFunction)6 List (java.util.List)6