Search in sources :

Example 1 with BreakpointAddress

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

the class CEventTableModel method getValueAt.

@Override
public Object getValueAt(final int row, final int col) {
    final ITraceEvent debugEvent = getEvents().get(row);
    final BreakpointAddress address = debugEvent.getOffset();
    switch(col) {
        case INDEX_COLUMN:
            return row + 1;
        case THREAD_COLUMN:
            return Long.valueOf(debugEvent.getThreadId());
        case MODULE_COLUMN:
            return address.getModule() == null ? "-" : address.getModule().getConfiguration().getName();
        case ADDRESS_COLUMN:
            {
                if (address.getModule() == null) {
                    return address.getAddress().getAddress().toHexString();
                } else {
                    final INaviFunction function = address.getModule().isLoaded() ? address.getModule().getContent().getFunctionContainer().getFunction(address.getAddress().getAddress()) : null;
                    if (function == null) {
                        return address.getAddress().getAddress().toHexString();
                    } else {
                        return function.getName();
                    }
                }
            }
        default:
            throw new IllegalStateException("IE01121: Unknown column");
    }
}
Also used : BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) ITraceEvent(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent)

Example 2 with BreakpointAddress

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress 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 3 with BreakpointAddress

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress 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 4 with BreakpointAddress

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress 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 5 with BreakpointAddress

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

the class CBreakpointRemoveFunctions method disableAllView.

/**
   * Disables all breakpoints which are part of a view.
   * 
   * @param debuggerProvider Provides the debuggers where breakpoints can be set.
   * @param view The view to consider when disabling the breakpoints.
   */
public static void disableAllView(final BackEndDebuggerProvider debuggerProvider, final INaviView view) {
    Preconditions.checkNotNull(debuggerProvider, "IE01889: Debugger provider argument can not be null");
    Preconditions.checkNotNull(view, "IE02009: View argument can't be null");
    for (final IDebugger debugger : debuggerProvider) {
        final BreakpointManager manager = debugger.getBreakpointManager();
        final Set<BreakpointAddress> addressesToDisable = new HashSet<BreakpointAddress>();
        for (int i = 0; i < manager.getNumberOfBreakpoints(BreakpointType.REGULAR); i++) {
            final BreakpointAddress address = manager.getBreakpoint(BreakpointType.REGULAR, i).getAddress();
            if (CViewHelpers.containsAddress(view, address.getAddress())) {
                addressesToDisable.add(address);
            }
        }
        manager.setBreakpointStatus(addressesToDisable, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_DISABLED);
    }
}
Also used : 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) HashSet(java.util.HashSet)

Aggregations

BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)87 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)60 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)49 Test (org.junit.Test)39 HashSet (java.util.HashSet)24 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)22 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)15 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)15 Breakpoint (com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint)15 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)13 Address (com.google.security.zynamics.binnavi.API.disassembly.Address)11 BreakpointManager (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager)11 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)11 ArrayList (java.util.ArrayList)9 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)8 DebugTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings)8 DebuggerProvider (com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider)8 CBreakpointTableModel (com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.CBreakpointTableModel)7 TraceLogger (com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger)7 ITraceEvent (com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent)7