Search in sources :

Example 41 with UnrelocatedAddress

use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress 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 42 with UnrelocatedAddress

use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress 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 43 with UnrelocatedAddress

use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress in project binnavi by google.

the class CGraphDebuggerTest method testToggleBreakpoint.

@Test
public void testToggleBreakpoint() {
    CGraphDebugger.toggleBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123)));
    assertEquals(1, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
    assertEquals(0x123, m_debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, 0).getAddress().getAddress().getAddress().toLong());
    assertEquals(BreakpointStatus.BREAKPOINT_INACTIVE, m_debugger.getBreakpointManager().getBreakpointStatus(BreakpointType.REGULAR, 0));
    CGraphDebugger.toggleBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123)));
    assertEquals(0, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
}
Also used : UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 44 with UnrelocatedAddress

use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress in project binnavi by google.

the class CGraphDebuggerTest method testToggleBreakpointStatus.

@Test
public void testToggleBreakpointStatus() {
    CGraphDebugger.toggleBreakpoint(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123)));
    assertEquals(1, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
    assertEquals(0x123, m_debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, 0).getAddress().getAddress().getAddress().toLong());
    assertEquals(BreakpointStatus.BREAKPOINT_INACTIVE, m_debugger.getBreakpointManager().getBreakpointStatus(BreakpointType.REGULAR, 0));
    CGraphDebugger.toggleBreakpointStatus(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123)));
    assertEquals(1, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
    assertEquals(0x123, m_debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, 0).getAddress().getAddress().getAddress().toLong());
    assertEquals(BreakpointStatus.BREAKPOINT_DISABLED, m_debugger.getBreakpointManager().getBreakpointStatus(BreakpointType.REGULAR, 0));
    CGraphDebugger.toggleBreakpointStatus(m_debugger.getBreakpointManager(), m_module, new UnrelocatedAddress(new CAddress(0x123)));
    assertEquals(1, m_debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR));
    assertEquals(0x123, m_debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, 0).getAddress().getAddress().getAddress().toLong());
    assertEquals(BreakpointStatus.BREAKPOINT_INACTIVE, m_debugger.getBreakpointManager().getBreakpointStatus(BreakpointType.REGULAR, 0));
}
Also used : UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 45 with UnrelocatedAddress

use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress 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)

Aggregations

UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)81 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)60 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)60 Test (org.junit.Test)49 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)28 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)15 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)15 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)13 Address (com.google.security.zynamics.binnavi.API.disassembly.Address)12 ArrayList (java.util.ArrayList)11 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)10 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)9 HashSet (java.util.HashSet)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 Breakpoint (com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint)8 FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)8 CBreakpointTableModel (com.google.security.zynamics.binnavi.Gui.Debug.BreakpointTable.CBreakpointTableModel)7 TraceLogger (com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger)7