Search in sources :

Example 36 with TraceList

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

the class Module method convertData.

/**
   * Converts internal module data to API module data.
   */
private void convertData() {
    m_traces = new ArrayList<Trace>();
    for (final TraceList trace : m_module.getContent().getTraceContainer().getTraces()) {
        m_traces.add(new Trace(trace));
    }
    m_module.getContent().getTraceContainer().addListener(m_traceListener);
    m_functions = new ArrayList<Function>();
    for (final INaviFunction function : m_module.getContent().getFunctionContainer().getFunctions()) {
        m_functions.add(new Function(this, function));
    }
    for (final Function function : m_functions) {
        m_functionMap.put(function.getNative(), function);
    }
    m_views = new ArrayList<View>();
    for (final INaviView view : m_module.getContent().getViewContainer().getViews()) {
        m_views.add(new View(this, view, m_nodeTagManager, m_viewTagManager));
    }
    createCallgraph();
}
Also used : INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) CView(com.google.security.zynamics.binnavi.disassembly.views.CView) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) IFlowgraphView(com.google.security.zynamics.binnavi.disassembly.IFlowgraphView) ICallgraphView(com.google.security.zynamics.binnavi.disassembly.ICallgraphView)

Example 37 with TraceList

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

the class TraceLogger method start.

// / Starts trace logging.
/**
   * Starts trace logging with this logger.
   *
   * @param name The name of the new trace.
   * @param description The description of the new trace.
   * @param addresses List of addresses where echo breakpoints should be set.
   *
   * @return The created event trace.
   *
   * @throws CouldntSaveDataException Thrown if the event trace could not be written to the
   *         database.
   */
public Trace start(final String name, final String description, final List<TracePoint> addresses) throws CouldntSaveDataException {
    Preconditions.checkArgument(debugger.isConnected(), "Error: Debugger must be connected");
    Preconditions.checkArgument(logger == null, "Error: Addresses argument can not be null");
    Preconditions.checkNotNull(addresses, "Error: Addresses argument can not be null");
    for (final TracePoint address : addresses) {
        Preconditions.checkNotNull(address, "Error: Addresses list contains null-elements");
    }
    try {
        final TraceList trace = createTrace(name, description);
        logger = createLogger();
        logger.start(trace, convertAddresses(addresses), 3);
        return ObjectFinders.getObject(trace, getTraces());
    } catch (final com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException e) {
        throw new CouldntSaveDataException(e);
    }
}
Also used : CouldntSaveDataException(com.google.security.zynamics.binnavi.API.disassembly.CouldntSaveDataException) TracePoint(com.google.security.zynamics.binnavi.API.disassembly.TracePoint) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList)

Example 38 with TraceList

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

the class CEventListTableMenu method addCombineMenu.

/**
   * Adds the sub menu that is makes it possible to combine multiple traces into one trace.
   *
   * @param parent Parent window used for dialogs.
   * @param traceProvider Trace provider that provides the trace information shown in the table.
   * @param selectedRows Table row indices of the selected traces.
   */
private void addCombineMenu(final JFrame parent, final ITraceListProvider traceProvider, final int[] selectedRows) {
    addSeparator();
    final JMenu combineMenu = new JMenu("Combine Traces");
    final List<TraceList> traces = getTraces(traceProvider, selectedRows);
    combineMenu.add(CActionProxy.proxy(new CActionCombineTraces(parent, traceProvider, traces)));
    combineMenu.add(CActionProxy.proxy(new CActionIntersectTraces(parent, traceProvider, traces)));
    if (traces.size() == 2) {
        combineMenu.addSeparator();
        combineMenu.add(CActionProxy.proxy(new CActionDifferenceTraces(parent, traceProvider, traces.get(0), traces.get(1))));
        combineMenu.add(CActionProxy.proxy(new CActionDifferenceTraces(parent, traceProvider, traces.get(1), traces.get(0))));
    }
    add(combineMenu);
}
Also used : CActionIntersectTraces(com.google.security.zynamics.binnavi.Gui.Debug.EventLists.Actions.CActionIntersectTraces) CActionCombineTraces(com.google.security.zynamics.binnavi.Gui.Debug.EventLists.Actions.CActionCombineTraces) CActionDifferenceTraces(com.google.security.zynamics.binnavi.Gui.Debug.EventLists.Actions.CActionDifferenceTraces) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) JMenu(javax.swing.JMenu)

Example 39 with TraceList

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

the class CTraceCombinationFunctions method unionizeTraces.

/**
   * Creates a new trace that contains those events that appear in any 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 unionizeTraces(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, getUnionizedAddresses(traces));
                operation.next();
                newTrace.save();
                operation.next();
                operation.stop();
            } catch (final CouldntSaveDataException e) {
                CUtilityFunctions.logException(e);
                final String innerMessage = "E00197: " + "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 40 with TraceList

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

the class CTraceCombinationFunctions method createCombinedTrace.

/**
   * Fills a combined trace from the events of multiple input traces.
   *
   * @param newTrace The trace to fill.
   * @param traces The input events.
   * @param addresses The addresses of the events to put into the combined trace.
   */
private static void createCombinedTrace(final TraceList newTrace, final List<TraceList> traces, final Set<BreakpointAddress> addresses) {
    final Set<BreakpointAddress> visitedAddresses = new LinkedHashSet<BreakpointAddress>();
    for (final TraceList trace : traces) {
        for (final ITraceEvent event : trace) {
            final BreakpointAddress address = event.getOffset();
            if (!addresses.contains(address)) {
                continue;
            }
            if (visitedAddresses.contains(address)) {
                continue;
            }
            visitedAddresses.add(address);
            newTrace.addEvent(event);
        }
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) ITraceEvent(com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceEvent)

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