Search in sources :

Example 1 with NodeBreakpointDecider

use of com.google.security.zynamics.binnavi.debug.helpers.NodeBreakpointDecider in project binnavi by google.

the class CTraceFunctions method startTrace.

/**
   * Starts trace mode for a given graph.
   *
   * @param parent Parent window used for dialogs.
   * @param debugger Debugger that sets the breakpoints.
   * @param graph Graph for which trace mode is activated.
   * @param logger The trace logger used to log the events.
   */
public static void startTrace(final JFrame parent, final IDebugger debugger, final ZyGraph graph, final TraceLogger logger) {
    checkArguments(parent, debugger, logger);
    Preconditions.checkNotNull(graph, "IE01569: Graph argument can not be null");
    if (!debugger.isConnected()) {
        return;
    }
    if (logger.hasEchoBreakpoints()) {
        final TraceList trace = createTrace(parent, logger);
        if (trace == null) {
            return;
        }
        final TraceList oldTrace = logger.switchTargetList(trace);
        saveTrace(oldTrace);
    } else {
        final int bps = countEchoBreakpoints(debugger.getBreakpointManager(), graph);
        if (bps == 0) {
            CMessageBox.showError(parent, "All nodes of the graph are already covered by another active trace");
        } else {
            final CTraceOptionsDialog dlg = CTraceOptionsDialog.show(parent);
            if (!dlg.wasCancelled()) {
                final int maximumHits = dlg.getMaximumHits();
                if (maximumHits == 0) {
                    return;
                }
                final EchoBreakpointCollector ebc = new EchoBreakpointCollector(debugger.getBreakpointManager());
                graph.iterate(new NodeBreakpointDecider(ebc));
                showStartTraceProgressWindow(parent, ebc.getBreakpoints(), logger, maximumHits);
            }
        }
    }
}
Also used : TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) EchoBreakpointCollector(com.google.security.zynamics.binnavi.debug.helpers.EchoBreakpointCollector) CTraceOptionsDialog(com.google.security.zynamics.binnavi.Gui.Debug.TraceOptionsDialog.CTraceOptionsDialog) NodeBreakpointDecider(com.google.security.zynamics.binnavi.debug.helpers.NodeBreakpointDecider)

Aggregations

CTraceOptionsDialog (com.google.security.zynamics.binnavi.Gui.Debug.TraceOptionsDialog.CTraceOptionsDialog)1 EchoBreakpointCollector (com.google.security.zynamics.binnavi.debug.helpers.EchoBreakpointCollector)1 NodeBreakpointDecider (com.google.security.zynamics.binnavi.debug.helpers.NodeBreakpointDecider)1 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)1