Search in sources :

Example 1 with Condition

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.interfaces.Condition in project binnavi by google.

the class CBreakpointTableModel method getBreakpointCondition.

/**
   * Returns the breakpoint condition for the breakpoint in the given row.
   * 
   * @param row Row index of the breakpoint.
   * 
   * @return Formula string of the breakpoint condition.
   */
private String getBreakpointCondition(final int row) {
    final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(m_debuggerProvider, row);
    final BreakpointManager manager = breakpoint.first().getBreakpointManager();
    final int breakpointIndex = breakpoint.second();
    final Condition condition = manager.getBreakpoint(BreakpointType.REGULAR, breakpointIndex).getCondition();
    return condition == null ? "" : condition.toString();
}
Also used : Condition(com.google.security.zynamics.binnavi.debug.models.breakpoints.interfaces.Condition) BreakpointManager(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager) IDebugger(com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)

Example 2 with Condition

use of com.google.security.zynamics.binnavi.debug.models.breakpoints.interfaces.Condition in project binnavi by google.

the class BreakpointManager method setBreakpointCondition.

public void setBreakpointCondition(final int breakpointIndex, final String formula) {
    Preconditions.checkNotNull(formula, "Error: formula argument can not be null.");
    final Breakpoint breakpoint = getBreakpoint(BreakpointType.REGULAR, breakpointIndex);
    final Set<Breakpoint> conditinalBreakPoints = Sets.newHashSet();
    Condition condition = null;
    try {
        condition = BreakpointConditionParser.evaluate(formula);
    } catch (final InvalidFormulaException exception) {
        CUtilityFunctions.logException(exception);
    }
    breakpoint.setCondition(condition);
    conditinalBreakPoints.add(breakpoint);
    for (final BreakpointManagerListener listener : listeners) {
        try {
            listener.breakpointsConditionChanged(conditinalBreakPoints);
        } catch (final Exception exception) {
            CUtilityFunctions.logException(exception);
        }
    }
}
Also used : Condition(com.google.security.zynamics.binnavi.debug.models.breakpoints.interfaces.Condition) BreakpointManagerListener(com.google.security.zynamics.binnavi.debug.models.breakpoints.interfaces.BreakpointManagerListener)

Aggregations

Condition (com.google.security.zynamics.binnavi.debug.models.breakpoints.interfaces.Condition)2 IDebugger (com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)1 BreakpointManager (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager)1 BreakpointManagerListener (com.google.security.zynamics.binnavi.debug.models.breakpoints.interfaces.BreakpointManagerListener)1