Search in sources :

Example 11 with TraceList

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();
}
Also used : CDefaultProgressOperation(com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList)

Example 12 with TraceList

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());
}
Also used : Trace(com.google.security.zynamics.binnavi.API.disassembly.Trace) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) Test(org.junit.Test)

Example 13 with TraceList

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);
}
Also used : Trace(com.google.security.zynamics.binnavi.API.disassembly.Trace) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) Test(org.junit.Test)

Example 14 with TraceList

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();
}
Also used : Trace(com.google.security.zynamics.binnavi.API.disassembly.Trace) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) Test(org.junit.Test)

Example 15 with TraceList

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);
}
Also used : Trace(com.google.security.zynamics.binnavi.API.disassembly.Trace) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) Address(com.google.security.zynamics.binnavi.API.disassembly.Address) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) Test(org.junit.Test)

Aggregations

TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)46 Test (org.junit.Test)26 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)14 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)11 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)10 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)10 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)10 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)9 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)7 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)7 TraceLogger (com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger)7 ITraceListProvider (com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider)7 ArrayList (java.util.ArrayList)7 HashSet (java.util.HashSet)7 INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)6 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)6 Trace (com.google.security.zynamics.binnavi.API.disassembly.Trace)5 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)5 FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)5 CouldntDeleteException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException)4