Search in sources :

Example 46 with BreakpointAddress

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

the class CGraphDebuggerTest method testHasBreakpoint.

@Test
public void testHasBreakpoint() {
    m_debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x123)))));
    assertTrue(CGraphDebugger.hasBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123))));
    assertFalse(CGraphDebugger.hasBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x124))));
}
Also used : UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 47 with BreakpointAddress

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

the class CGraphDebuggerTest method testRemoveBreakpoint3.

@Test
public void testRemoveBreakpoint3() {
    final Set<BreakpointAddress> breakpointAddresses = Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1123))), new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1124))));
    m_debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, breakpointAddresses);
    m_debugger.getBreakpointManager().setBreakpointStatus(BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_ACTIVE, 1);
    CGraphDebugger.removeBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x1123)));
    CGraphDebugger.removeBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x1124)));
    assertEquals(0, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
}
Also used : UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 48 with BreakpointAddress

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

the class CGraphDebuggerTest method testGetBreakpointStatus.

@Test
public void testGetBreakpointStatus() {
    m_debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x123)))));
    assertEquals(BreakpointStatus.BREAKPOINT_INACTIVE, CGraphDebugger.getBreakpointStatus(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123))));
}
Also used : UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 49 with BreakpointAddress

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

the class PostgreSQLTracesLoader method loadTraceEvents.

/**
   * Loads the trace events of a trace list from the database.
   *
   * @param connection The connection to the database.
   * @param traceList The trace list whose events are loaded.
   * @param modules List of all modules stored in the database.
   *
   * @throws SQLException Thrown if the trace events could not be loaded.
   */
private static void loadTraceEvents(final CConnection connection, final TraceList traceList, final List<? extends INaviModule> modules) throws SQLException {
    final List<List<TraceRegister>> values = loadTraceEventValues(connection, traceList);
    final String query = "select tid, module_id, address, type from " + CTableNames.TRACE_EVENT_TABLE + " where trace_id = " + traceList.getId() + " order by position asc";
    final ResultSet resultSet = connection.executeQuery(query, true);
    int counter = 0;
    try {
        while (resultSet.next()) {
            final long tid = resultSet.getLong("tid");
            final int moduleId = resultSet.getInt("module_id");
            final INaviModule module = resultSet.wasNull() ? null : findModule(modules, moduleId);
            final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(PostgreSQLHelpers.loadAddress(resultSet, "address")));
            final int event = resultSet.getInt("type");
            traceList.addEvent(new TraceEvent(tid, address, TraceEventType.parseInt(event), values.isEmpty() ? new ArrayList<TraceRegister>() : values.get(counter)));
            counter++;
        }
    } finally {
        resultSet.close();
    }
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) TraceRegister(com.google.security.zynamics.binnavi.debug.models.trace.TraceRegister) ResultSet(java.sql.ResultSet) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) ArrayList(java.util.ArrayList) List(java.util.List) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) TraceEvent(com.google.security.zynamics.binnavi.debug.models.trace.TraceEvent)

Example 50 with BreakpointAddress

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

the class CGraphDebugger method setBreakpoint.

/**
   * Sets a breakpoint at a given address.
   *
   * @param manager The breakpoint manager that sets the breakpoint.
   * @param module The module where the breakpoint is set.
   * @param unrelocatedAddress The unrelocated address of the breakpoint.
   */
public static void setBreakpoint(final BreakpointManager manager, final INaviModule module, final UnrelocatedAddress unrelocatedAddress) {
    Preconditions.checkNotNull(manager, "IE01713: Manager argument can not be null");
    Preconditions.checkNotNull(module, "IE01714: Module argument can not be null");
    Preconditions.checkNotNull(unrelocatedAddress, "IE01715: Address argument can not be null");
    final BreakpointAddress address = new BreakpointAddress(module, unrelocatedAddress);
    if (!manager.hasBreakpoint(BreakpointType.REGULAR, address)) {
        manager.addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(address));
    }
}
Also used : BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)

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