use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList in project binnavi by google.
the class CTraceCombinationFunctions method intersectTraces.
/**
* Creates a new trace that contains those events that appear in all of the input traces.
*
* @param parent Parent window used for dialogs.
* @param provider Creates the new trace.
* @param traces The input traces.
*/
public static void intersectTraces(final JFrame parent, final ITraceListProvider provider, final List<TraceList> traces) {
new Thread() {
@Override
public void run() {
try {
final CDefaultProgressOperation operation = new CDefaultProgressOperation("", false, false);
operation.getProgressPanel().setMaximum(3);
operation.getProgressPanel().setText("Combining traces");
final TraceList newTrace = provider.createTrace("Combined Trace", "");
operation.next();
createCombinedTrace(newTrace, traces, getIntersectedAddresses(traces));
operation.next();
newTrace.save();
operation.next();
operation.stop();
} catch (final CouldntSaveDataException e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00196: " + "Could not combine debug traces";
final String innerDescription = CUtilityFunctions.createDescription("The selected traces could not be combined into a larger trace.", new String[] { "There was a problem with the database connection." }, new String[] { "The trace list was not created. You could try to combine the lists again once the connection problem was resolved." });
NaviErrorDialog.show(parent, innerMessage, innerDescription, e);
}
}
}.start();
}
use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList in project binnavi by google.
the class TraceTest method testConstructor.
@Test
public void testConstructor() {
final Trace trace = new Trace(new TraceList(1, "Name", "Description", new MockSqlProvider()));
assertEquals("Name", trace.getName());
assertEquals("Description", trace.getDescription());
assertEquals("Trace 'Name' [0 events]", trace.toString());
assertEquals(0, trace.getEvents().size());
}
use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList in project binnavi by google.
the class TraceTest method testSetName.
@Test
public void testSetName() throws CouldntSaveDataException {
final Trace trace = new Trace(new TraceList(1, "Name", "Description", new MockSqlProvider()));
final MockTraceListener listener = new MockTraceListener();
trace.addListener(listener);
trace.setName("N1");
assertEquals("N1", trace.getName());
assertEquals("changedName;", listener.events);
trace.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList in project binnavi by google.
the class TraceTest method testSave.
@Test
public void testSave() throws CouldntSaveDataException {
final Trace trace = new Trace(new TraceList(1, "Name", "Description", new MockSqlProvider()));
trace.save();
}
use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList in project binnavi by google.
the class TraceTest method testEvent.
@Test
public void testEvent() {
final Trace trace = new Trace(new TraceList(1, "Name", "Description", new MockSqlProvider()));
final MockTraceListener listener = new MockTraceListener();
trace.addListener(listener);
final MockModule module = new MockModule();
final Module m = ModuleFactory.get(module);
trace.addEvent(0, m, new Address(123), TraceEventType.Breakpoint);
trace.addEvent(0, m, new Address(124), TraceEventType.EchoBreakpoint);
assertEquals(2, trace.getEvents().size());
assertEquals(123, trace.getEvents().get(0).getAddress().toLong());
assertEquals(TraceEventType.Breakpoint, trace.getEvents().get(0).getType());
assertEquals(124, trace.getEvents().get(1).getAddress().toLong());
assertEquals(TraceEventType.EchoBreakpoint, trace.getEvents().get(1).getType());
assertEquals("addedEvent;addedEvent;", listener.events);
trace.removeListener(listener);
}
Aggregations