Search in sources :

Example 1 with ITraceListProvider

use of com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider in project binnavi by google.

the class CTraceLoggerTest method testOverwrittenEchoBreakpoint.

@Test
public void testOverwrittenEchoBreakpoint() throws DebugExceptionWrapper {
    // Scenario: Echo breakpoint of the trace is overwritten by a regular breakpoint
    final ITraceListProvider provider = new MockTraceListProvider();
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(module));
    debugger.setAddressTranslator(module, new CAddress(0), new CAddress(0x1000));
    debugger.connect();
    final TraceLogger logger = new TraceLogger(provider, debugger);
    final MockTraceLoggerListener listener = new MockTraceLoggerListener();
    logger.addListener(listener);
    final MockSqlProvider sqlProvider = new MockSqlProvider();
    final TraceList trace = new TraceList(1, "Foo", "Bar", sqlProvider);
    final Set<BreakpointAddress> addresses = new HashSet<BreakpointAddress>();
    addresses.add(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0x100))));
    addresses.add(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0x200))));
    logger.start(trace, addresses, 1);
    debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0x100)))));
    assertEquals("++-", listener.events);
    logger.stop();
    assertEquals("++--!", listener.events);
    // Start the trace mode again to make sure all resources were cleaned
    // up in the previous run.
    logger.start(trace, addresses, 1);
    logger.stop();
    debugger.close();
}
Also used : ITraceListProvider(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider) TraceLogger(com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with ITraceListProvider

use of com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider in project binnavi by google.

the class CTraceLoggerTest method testTargetClosed.

@Test
public void testTargetClosed() throws DebugExceptionWrapper {
    final ITraceListProvider provider = new MockTraceListProvider();
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(module));
    debugger.setAddressTranslator(module, new CAddress(0), new CAddress(0x1000));
    debugger.connect();
    final TraceLogger logger = new TraceLogger(provider, debugger);
    final MockTraceLoggerListener listener = new MockTraceLoggerListener();
    logger.addListener(listener);
    final MockSqlProvider sqlProvider = new MockSqlProvider();
    final TraceList trace = new TraceList(1, "Foo", "Bar", sqlProvider);
    final Set<BreakpointAddress> addresses = new HashSet<BreakpointAddress>();
    addresses.add(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0x100))));
    logger.start(trace, addresses, 1);
    debugger.getProcessManager().setAttached(false);
    assertEquals("+!", listener.events);
    logger.stop();
    // assertEquals(0, debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.ECHO));
    // Start the trace mode again to make sure all resources were cleaned
    // up in the previous run.
    logger.start(trace, addresses, 1);
    logger.stop();
    debugger.close();
}
Also used : ITraceListProvider(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider) TraceLogger(com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 3 with ITraceListProvider

use of com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider in project binnavi by google.

the class CDebugEventListPanelTest method test_2063.

/**
   * This test makes sure that listeners are removed correctly, unlike seen in Case 2063.
   */
@Test
public void test_2063() {
    final ITraceListProvider provider = new ProjectTraceProvider(new MockProject());
    final CDebugEventListPanel panel = new CDebugEventListPanel(provider);
    panel.dispose();
}
Also used : MockProject(com.google.security.zynamics.binnavi.disassembly.MockProject) ITraceListProvider(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider) ProjectTraceProvider(com.google.security.zynamics.binnavi.debug.models.trace.ProjectTraceProvider) CDebugEventListPanel(com.google.security.zynamics.binnavi.Gui.Debug.EventLists.CDebugEventListPanel) Test(org.junit.Test)

Example 4 with ITraceListProvider

use of com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider in project binnavi by google.

the class CEventListTableModelTest method test2056.

/**
   * This test makes sure that the listener issue described in Case 2056 does not happen again.
   * 
   * @throws CouldntLoadDataException
   * @throws LoadCancelledException
   * @throws CouldntSaveDataException
   */
@Test
public void test2056() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
    final INaviModule module = new MockModule(false);
    module.getContent().getTraceContainer().createTrace("foo", "bar");
    final ITraceListProvider traceListProvider = new ModuleTraceProvider(module);
    final CEventListTableModel model = new CEventListTableModel(traceListProvider);
    module.load();
    model.delete();
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) ITraceListProvider(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider) ModuleTraceProvider(com.google.security.zynamics.binnavi.debug.models.trace.ModuleTraceProvider) CEventListTableModel(com.google.security.zynamics.binnavi.Gui.Debug.EventLists.CEventListTableModel) Test(org.junit.Test)

Example 5 with ITraceListProvider

use of com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider in project binnavi by google.

the class CTraceLoggerTest method testAllBreakpointsBlocked.

@Test
public void testAllBreakpointsBlocked() throws DebugExceptionWrapper {
    // Scenario: All given addresses are already blocked by regular breakpoints
    final ITraceListProvider provider = new MockTraceListProvider();
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(module));
    debugger.setAddressTranslator(module, new CAddress(0), new CAddress(0x1000));
    debugger.connect();
    debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0x100)))));
    final TraceLogger logger = new TraceLogger(provider, debugger);
    final MockTraceLoggerListener listener = new MockTraceLoggerListener();
    logger.addListener(listener);
    final MockSqlProvider sqlProvider = new MockSqlProvider();
    final TraceList trace = new TraceList(1, "Foo", "Bar", sqlProvider);
    final Set<BreakpointAddress> addresses = new HashSet<BreakpointAddress>();
    addresses.add(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0x100))));
    logger.start(trace, addresses, 1);
    logger.stop();
    assertEquals("", listener.events);
    // Start the trace mode again to make sure all resources were cleaned
    // up in the previous run.
    logger.start(trace, addresses, 1);
    logger.stop();
    debugger.close();
}
Also used : ITraceListProvider(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider) TraceLogger(com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

ITraceListProvider (com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider)9 Test (org.junit.Test)9 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)7 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)7 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)7 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)7 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)7 TraceLogger (com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger)7 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)7 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)7 HashSet (java.util.HashSet)7 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)3 CDebugEventListPanel (com.google.security.zynamics.binnavi.Gui.Debug.EventLists.CDebugEventListPanel)1 CEventListTableModel (com.google.security.zynamics.binnavi.Gui.Debug.EventLists.CEventListTableModel)1 AbstractDebugger (com.google.security.zynamics.binnavi.debug.debugger.AbstractDebugger)1 DebuggerSynchronizer (com.google.security.zynamics.binnavi.debug.debugger.synchronizers.DebuggerSynchronizer)1 Breakpoint (com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint)1 ModuleTraceProvider (com.google.security.zynamics.binnavi.debug.models.trace.ModuleTraceProvider)1 ProjectTraceProvider (com.google.security.zynamics.binnavi.debug.models.trace.ProjectTraceProvider)1 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)1