Search in sources :

Example 1 with Breakpoint

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint in project binnavi by google.

the class CBreakpointModuleSynchronizer method processModuleBreakpoints.

private static void processModuleBreakpoints(final IDebugger debugger, final MemoryModule module, final BreakpointType breakPointType, final IModuleBreakpointEnumerator callback) {
    final BreakpointManager manager = debugger.getBreakpointManager();
    final Set<BreakpointAddress> breakpointAddresses = new HashSet<BreakpointAddress>();
    for (final Breakpoint breakpoint : manager.getBreakpointsByModule(breakPointType, module)) {
        if ((manager.getBreakpointStatus(breakpoint.getAddress(), breakpoint.getType()) != BreakpointStatus.BREAKPOINT_ENABLED) && (manager.getBreakpointStatus(breakpoint.getAddress(), breakpoint.getType()) != BreakpointStatus.BREAKPOINT_DISABLED) && isWithinModule(debugger, module, breakpoint)) {
            breakpointAddresses.add(breakpoint.getAddress());
        }
    }
    callback.handleAddress(manager, breakpointAddresses);
}
Also used : Breakpoint(com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) BreakpointManager(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager) HashSet(java.util.HashSet)

Example 2 with Breakpoint

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint in project binnavi by google.

the class CBreakpointRemoveFunctions method removeAll.

/**
   * Removes all breakpoints of a given breakpoint manager.
   * 
   * @param manager The breakpoints manager whose breakpoints are removed.
   */
private static void removeAll(final BreakpointManager manager) {
    final Set<BreakpointAddress> addresses = new HashSet<BreakpointAddress>();
    for (final Breakpoint breakpoint : manager.getBreakpoints(BreakpointType.REGULAR)) {
        addresses.add(breakpoint.getAddress());
    }
    CGraphDebugger.removeBreakpoints(addresses, manager);
}
Also used : Breakpoint(com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) HashSet(java.util.HashSet)

Example 3 with Breakpoint

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint in project binnavi by google.

the class CBreakpointTable method showPopupMenu.

/**
   * Displays the popup menu at the location specified by the click event.
   * 
   * @param event The click event.
   */
private void showPopupMenu(final MouseEvent event) {
    final int row = rowAtPoint(event.getPoint());
    final int column = columnAtPoint(event.getPoint());
    int[] rows = getSelectedRows();
    if ((rows.length == 0) || (rows.length == 1)) {
        changeSelection(row, column, false, false);
        rows = getSelectedRows();
    }
    final JPopupMenu menu = new JPopupMenu();
    menu.add(new JMenuItem(CActionProxy.proxy(new CDeleteAction(m_debuggerProvider, rows))));
    if (CBreakpointFunctions.allDisabled(m_debuggerProvider, rows)) {
        menu.add(new JMenuItem(CActionProxy.proxy(new CEnableAction(m_debuggerProvider, rows))));
    } else if (CBreakpointFunctions.allNotDisabled(m_debuggerProvider, rows)) {
        menu.add(new JMenuItem(CActionProxy.proxy(new CDisableAction(m_debuggerProvider, rows))));
    }
    if (rows.length == 1) {
        menu.addSeparator();
        final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(m_debuggerProvider, rows[0]);
        final BreakpointManager manager = breakpoint.first().getBreakpointManager();
        final int breakpointIndex = breakpoint.second();
        final BreakpointAddress address = manager.getBreakpoint(BreakpointType.REGULAR, breakpointIndex).getAddress();
        menu.add(new JMenuItem(CActionProxy.proxy(new CZoomBreakpointAction(SwingUtilities.windowForComponent(this), m_graph, m_viewContainer, address))));
    }
    menu.show(event.getComponent(), event.getX(), event.getY());
}
Also used : CZoomBreakpointAction(com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CZoomBreakpointAction) CDeleteAction(com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CDeleteAction) BreakpointManager(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager) Breakpoint(com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint) JPopupMenu(javax.swing.JPopupMenu) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) CDisableAction(com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CDisableAction) JMenuItem(javax.swing.JMenuItem) CEnableAction(com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.Actions.CEnableAction) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)

Example 4 with Breakpoint

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint in project binnavi by google.

the class CBreakpointRemoveFunctions method deleteBreakpoints.

/**
   * Deletes the breakpoints specified by the rows argument.
   * 
   * @param debuggerProvider Provides the debuggers where breakpoints can be set.
   * @param rows Rows that identify the breakpoints.
   */
public static void deleteBreakpoints(final BackEndDebuggerProvider debuggerProvider, final int[] rows) {
    Preconditions.checkNotNull(debuggerProvider, "IE01886: Debugger provider argument can not be null");
    Preconditions.checkNotNull(rows, "IE02253: Rows argument can't be null");
    final ArrayList<Pair<IDebugger, BreakpointAddress>> addresses = new ArrayList<Pair<IDebugger, BreakpointAddress>>();
    for (final int row : rows) {
        final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(debuggerProvider, row);
        final BreakpointManager manager = breakpoint.first().getBreakpointManager();
        final int breakpointIndex = breakpoint.second();
        addresses.add(new Pair<IDebugger, BreakpointAddress>(breakpoint.first(), manager.getBreakpoint(BreakpointType.REGULAR, breakpointIndex).getAddress()));
    }
    for (final Pair<IDebugger, BreakpointAddress> p : addresses) {
        final BreakpointManager manager = p.first().getBreakpointManager();
        final BreakpointAddress address = p.second();
        manager.setBreakpointStatus(Sets.newHashSet(address), BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_DELETING);
    }
}
Also used : ArrayList(java.util.ArrayList) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) BreakpointManager(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) Breakpoint(com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint) Pair(com.google.security.zynamics.zylib.general.Pair)

Example 5 with Breakpoint

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint in project binnavi by google.

the class CBreakpointRemoveFunctions method disableBreakpoints.

/**
   * Disables the breakpoints identified by the rows argument.
   * 
   * @param debuggerProvider Provides the debuggers where breakpoints can be set.
   * @param rows Rows that identify the breakpoints.
   */
public static void disableBreakpoints(final BackEndDebuggerProvider debuggerProvider, final int[] rows) {
    Preconditions.checkNotNull(debuggerProvider, "IE01919: Debugger provider argument can not be null");
    Preconditions.checkNotNull(rows, "IE02254: Rows argument can't be null");
    for (final int row : rows) {
        final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(debuggerProvider, row);
        final BreakpointManager manager = breakpoint.first().getBreakpointManager();
        final int breakpointIndex = breakpoint.second();
        manager.setBreakpointStatus(BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_DISABLED, breakpointIndex);
    }
}
Also used : BreakpointManager(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager) Breakpoint(com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Aggregations

Breakpoint (com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint)21 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)14 Test (org.junit.Test)12 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)11 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)11 DebugTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings)10 DebuggerProvider (com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider)10 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)10 BreakpointCondition (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointCondition)8 BreakpointManager (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager)8 BaseNode (com.google.security.zynamics.binnavi.debug.models.breakpoints.conditions.BaseNode)8 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)8 CBreakpointTableModel (com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.CBreakpointTableModel)7 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)7 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)6 IDebugger (com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)5 HashSet (java.util.HashSet)5 Pair (com.google.security.zynamics.zylib.general.Pair)3 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)2 MockFunction (com.google.security.zynamics.binnavi.disassembly.MockFunction)2