Search in sources :

Example 76 with BreakpointAddress

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

the class CBreakpointRemoveFunctions method removeAllView.

/**
   * Removes all breakpoints of a given breakpoint manager that belong to a given view.
   * 
   * @param manager The breakpoints manager whose breakpoints are removed.
   * @param view The view that decides what breakpoints are removed.
   */
private static void removeAllView(final BreakpointManager manager, final INaviView view) {
    final Set<BreakpointAddress> addresses = 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())) {
            addresses.add(address);
        }
    }
    CGraphDebugger.removeBreakpoints(addresses, manager);
}
Also used : BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) Breakpoint(com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint) HashSet(java.util.HashSet)

Example 77 with BreakpointAddress

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

the class CBreakpointSetFunctions method enableAllView.

/**
   * Enables all breakpoints of a given breakpoint manager that belong to a given view.
   * 
   * @param manager The breakpoints manager whose breakpoints are enabled.
   * @param view The view that decides what breakpoints are enabled.
   */
private static void enableAllView(final BreakpointManager manager, final INaviView view) {
    final Set<BreakpointAddress> addressesToEnable = 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())) {
            addressesToEnable.add(address);
        }
    }
    manager.setBreakpointStatus(addressesToEnable, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_ENABLED);
}
Also used : BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) HashSet(java.util.HashSet)

Example 78 with BreakpointAddress

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

the class CTraceCombinationFunctions method createCombinedTrace.

/**
   * Fills a combined trace from the events of multiple input traces.
   *
   * @param newTrace The trace to fill.
   * @param traces The input events.
   * @param addresses The addresses of the events to put into the combined trace.
   */
private static void createCombinedTrace(final TraceList newTrace, final List<TraceList> traces, final Set<BreakpointAddress> addresses) {
    final Set<BreakpointAddress> visitedAddresses = new LinkedHashSet<BreakpointAddress>();
    for (final TraceList trace : traces) {
        for (final ITraceEvent event : trace) {
            final BreakpointAddress address = event.getOffset();
            if (!addresses.contains(address)) {
                continue;
            }
            if (visitedAddresses.contains(address)) {
                continue;
            }
            visitedAddresses.add(address);
            newTrace.addEvent(event);
        }
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) ITraceEvent(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent)

Example 79 with BreakpointAddress

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

the class CTraceFunctions method setBreakpoints.

/**
   * Sets breakpoints on trace events.
   *
   * @param model Provides the active debugger.
   * @param events Events on which breakpoints are set.
   */
public static void setBreakpoints(final CDebugPerspectiveModel model, final List<ITraceEvent> events) {
    final IDebugger debugger = model.getCurrentSelectedDebugger();
    if (debugger == null) {
        return;
    }
    final List<INaviModule> modules = debugger.getModules();
    final Set<BreakpointAddress> addresses = new HashSet<BreakpointAddress>();
    for (final ITraceEvent event : events) {
        final BreakpointAddress address = event.getOffset();
        if ((address.getModule() == null) || (modules.contains(address.getModule()) && !debugger.getBreakpointManager().hasBreakpoint(BreakpointType.REGULAR, address))) {
            addresses.add(address);
        }
    }
    debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, addresses);
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger) HashSet(java.util.HashSet) ITraceEvent(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent)

Example 80 with BreakpointAddress

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

the class TraceEventTest method testConstructor.

@Test
public void testConstructor() {
    final MockModule module = new MockModule();
    final TraceEvent event = new TraceEvent(new com.google.security.zynamics.binnavi.debug.models.trace.TraceEvent(0, new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0x123))), TraceEventType.ECHO_BREAKPOINT, new ArrayList<com.google.security.zynamics.binnavi.debug.models.trace.TraceRegister>()));
    assertEquals(0x123, event.getAddress().toLong());
    assertEquals(com.google.security.zynamics.binnavi.API.disassembly.TraceEventType.EchoBreakpoint, event.getType());
    assertEquals("Trace Event [EchoBreakpoint : 123]", event.toString());
}
Also used : MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) ArrayList(java.util.ArrayList) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

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