Search in sources :

Example 1 with CGotoOperandExpressionAction

use of com.google.security.zynamics.binnavi.ZyGraph.Menus.Actions.CGotoOperandExpressionAction in project binnavi by google.

the class CFollowInDumpMenu method addFollowInDumpMenu.

/**
 * Checks what follow in dump menus are needed and adds those that are missing.
 *
 * @param menu The popup menu to extend.
 * @param viewModel Debug perspective model that shows the memory.
 * @param debugger Provides the register values.
 * @param activeThread The thread whose register values should be considered.
 * @param module Needed for relocation information.
 * @param treeNode The clicked operand tree node.
 *
 * @return True, if at least one menu was added. False, otherwise.
 */
private static boolean addFollowInDumpMenu(final JPopupMenu menu, final CDebugPerspectiveModel viewModel, final IDebugger debugger, final TargetProcessThread activeThread, final INaviModule module, final COperandTreeNode treeNode) {
    final BigInteger simpleAddress = getSimpleAddress(treeNode, activeThread.getRegisterValues(), debugger, module);
    if ((simpleAddress != null) && needsSimpleFollowMenu(debugger, treeNode, simpleAddress)) {
        menu.add(new CGotoOperandExpressionAction(viewModel, treeNode.getValue(), simpleAddress));
        return true;
    }
    final BigInteger expressionAddress = getExpressionAddress(treeNode, activeThread.getRegisterValues(), debugger, module);
    // Don't show menu twice for instructions like "mov eax, [someSymbol]"
    if ((expressionAddress != null) && !expressionAddress.equals(simpleAddress) && needsAddressExpressionMenu(debugger, treeNode, expressionAddress)) {
        final INaviOperandTreeNode addressExpression = getAddressExpression(treeNode);
        menu.add(new CGotoOperandExpressionAction(viewModel, toString(addressExpression), expressionAddress));
        return true;
    }
    return false;
}
Also used : INaviOperandTreeNode(com.google.security.zynamics.binnavi.disassembly.INaviOperandTreeNode) CGotoOperandExpressionAction(com.google.security.zynamics.binnavi.ZyGraph.Menus.Actions.CGotoOperandExpressionAction) BigInteger(java.math.BigInteger)

Aggregations

CGotoOperandExpressionAction (com.google.security.zynamics.binnavi.ZyGraph.Menus.Actions.CGotoOperandExpressionAction)1 INaviOperandTreeNode (com.google.security.zynamics.binnavi.disassembly.INaviOperandTreeNode)1 BigInteger (java.math.BigInteger)1