diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/Breakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/Breakpoint.java index 81132fc30e1..9a40ea941dc 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/Breakpoint.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/Breakpoint.java @@ -1,3 +1,7 @@ +/* + * (c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + */ package org.eclipse.cdt.debug.mi.core.cdi; import org.eclipse.cdt.debug.core.cdi.CDIException; @@ -68,6 +72,7 @@ public class Breakpoint extends SessionObject implements ICDILocationBreakpoint * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#setCondition(ICDICondition) */ public void setCondition(ICDICondition condition) throws CDIException { + mgr.setCondition(this, condition); this.condition = condition; } diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java index bae84dc69c9..0b44e67ead2 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java @@ -19,6 +19,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDILocationBreakpoint; import org.eclipse.cdt.debug.core.cdi.ICDIWatchpoint; import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.command.CommandFactory; +import org.eclipse.cdt.debug.mi.core.command.MIBreakCondition; import org.eclipse.cdt.debug.mi.core.command.MIBreakDelete; import org.eclipse.cdt.debug.mi.core.command.MIBreakDisable; import org.eclipse.cdt.debug.mi.core.command.MIBreakEnable; @@ -160,6 +161,34 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa ((Breakpoint) breakpoint).getMIBreakPoint().setEnabled(false); } + public void setCondition(ICDIBreakpoint breakpoint, ICDICondition condition) throws CDIException { + int number = 0; + if (breakpoint instanceof Breakpoint + && breakList.contains(breakpoint)) { + number = ((Breakpoint) breakpoint).getMIBreakPoint().getNumber(); + } else { + throw new CDIException("Not a CDT breakpoint"); + } + + // We only suppor expression not ignore count reset. + String exprCond = condition.getExpression(); + if (exprCond == null) { + throw new CDIException("ignore count not supported"); + } + CSession s = getCSession(); + CommandFactory factory = s.getMISession().getCommandFactory(); + MIBreakCondition breakCondition = + factory.createMIBreakCondition(number, exprCond); + try { + s.getMISession().postCommand(breakCondition); + MIInfo info = breakCondition.getMIInfo(); + if (info == null) { + throw new CDIException("No answer"); + } + } catch (MIException e) { + throw new CDIException(e.toString()); + } + } /** * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#getBreakpoints() */