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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations