From b4340ada20ff0c527090d647e6f58d5d58f6e87c Mon Sep 17 00:00:00 2001 From: Ken Ryall Date: Fri, 16 Feb 2007 04:30:03 +0000 Subject: [PATCH] Support for ICDIBreakpointManagment2, breaks are enabled/disabled when they are set. --- .../debug/mi/core/cdi/BreakpointManager.java | 33 ++++++++-------- .../mi/core/cdi/model/AddressBreakpoint.java | 4 +- .../debug/mi/core/cdi/model/Breakpoint.java | 4 +- .../mi/core/cdi/model/Exceptionpoint.java | 4 +- .../mi/core/cdi/model/FunctionBreakpoint.java | 4 +- .../mi/core/cdi/model/LineBreakpoint.java | 4 +- .../mi/core/cdi/model/LocationBreakpoint.java | 4 +- .../cdt/debug/mi/core/cdi/model/Target.java | 39 ++++++++++++++----- .../debug/mi/core/cdi/model/Watchpoint.java | 4 +- 9 files changed, 61 insertions(+), 39 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java index e8fb7682857..66fb5561736 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java @@ -425,7 +425,7 @@ public class BreakpointManager extends Manager { if (allMIBreakpoints[i].isAccessWatchpoint() || allMIBreakpoints[i].isWriteWatchpoint()) { watchType |= ICDIWatchpoint.WRITE; } - Watchpoint wpoint = new Watchpoint(target, allMIBreakpoints[i].getWhat(), type, watchType, condition); + Watchpoint wpoint = new Watchpoint(target, allMIBreakpoints[i].getWhat(), type, watchType, condition, allMIBreakpoints[i].isEnabled()); wpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]}); bList.add(wpoint); } else { @@ -433,25 +433,26 @@ public class BreakpointManager extends Manager { String file = allMIBreakpoints[i].getFile(); int line = allMIBreakpoints[i].getLine(); String addr = allMIBreakpoints[i].getAddress(); + boolean enabled = allMIBreakpoints[i].isEnabled(); if (file != null && file.length() > 0 && line > 0) { LineLocation location = createLineLocation (allMIBreakpoints[i].getFile(), allMIBreakpoints[i].getLine()); // By default new breakpoint are LineBreakpoint - Breakpoint newBreakpoint = new LineBreakpoint(target, type, location, condition); + Breakpoint newBreakpoint = new LineBreakpoint(target, type, location, condition, enabled); newBreakpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]}); bList.add(newBreakpoint); } else if (function != null && function.length() > 0) { FunctionLocation location = createFunctionLocation(file, function); // By default new breakpoint are LineBreakpoint - Breakpoint newBreakpoint = new FunctionBreakpoint(target, type, location, condition); + Breakpoint newBreakpoint = new FunctionBreakpoint(target, type, location, condition, enabled); newBreakpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]}); bList.add(newBreakpoint); } else if (addr != null && addr.length() > 0) { BigInteger big = MIFormat.getBigInteger(addr); AddressLocation location = createAddressLocation (big); // By default new breakpoint are LineBreakpoint - Breakpoint newBreakpoint = new AddressBreakpoint(target, type, location, condition); + Breakpoint newBreakpoint = new AddressBreakpoint(target, type, location, condition, enabled); newBreakpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]}); bList.add(newBreakpoint); } @@ -604,8 +605,8 @@ public class BreakpointManager extends Manager { * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#setLineBreakpoint(int, org.eclipse.cdt.debug.core.cdi.ICDILineLocation, org.eclipse.cdt.debug.core.cdi.ICDICondition, boolean) */ public ICDILineBreakpoint setLineBreakpoint(Target target, int type, ICDILineLocation location, - ICDICondition condition, boolean deferred) throws CDIException { - LineBreakpoint bkpt = new LineBreakpoint(target, type, location, condition); + ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { + LineBreakpoint bkpt = new LineBreakpoint(target, type, location, condition, enabled); setNewLocationBreakpoint(bkpt, deferred); return bkpt; } @@ -614,8 +615,8 @@ public class BreakpointManager extends Manager { * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#setFunctionBreakpoint(int, org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation, org.eclipse.cdt.debug.core.cdi.ICDICondition, boolean) */ public ICDIFunctionBreakpoint setFunctionBreakpoint(Target target, int type, ICDIFunctionLocation location, - ICDICondition condition, boolean deferred) throws CDIException { - FunctionBreakpoint bkpt = new FunctionBreakpoint(target, type, location, condition); + ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { + FunctionBreakpoint bkpt = new FunctionBreakpoint(target, type, location, condition, enabled); setNewLocationBreakpoint(bkpt, deferred); return bkpt; } @@ -624,8 +625,8 @@ public class BreakpointManager extends Manager { * @see org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement#setAddressBreakpoint(int, org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation, org.eclipse.cdt.debug.core.cdi.ICDICondition, boolean) */ public ICDIAddressBreakpoint setAddressBreakpoint(Target target, int type, ICDIAddressLocation location, - ICDICondition condition, boolean deferred) throws CDIException { - AddressBreakpoint bkpt = new AddressBreakpoint(target, type, location, condition); + ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { + AddressBreakpoint bkpt = new AddressBreakpoint(target, type, location, condition, enabled); setNewLocationBreakpoint(bkpt, deferred); return bkpt; } @@ -664,7 +665,7 @@ public class BreakpointManager extends Manager { } public ICDIWatchpoint setWatchpoint(Target target, int type, int watchType, String expression, - ICDICondition condition) throws CDIException { + ICDICondition condition, boolean enabled) throws CDIException { // HACK: for the IDE, try { @@ -674,7 +675,7 @@ public class BreakpointManager extends Manager { } catch (NumberFormatException e) { // } - Watchpoint bkpt = new Watchpoint(target, expression, type, watchType, condition); + Watchpoint bkpt = new Watchpoint(target, expression, type, watchType, condition, enabled); setWatchpoint(bkpt); List bList = getBreakpointsList(target); @@ -821,7 +822,7 @@ public class BreakpointManager extends Manager { public ICDIExceptionpoint setExceptionpoint(Target target, String clazz, boolean stopOnThrow, - boolean stopOnCatch) throws CDIException { + boolean stopOnCatch, boolean enabled) throws CDIException { if (!stopOnThrow && !stopOnCatch) { throw new CDIException("Must suspend on throw or catch"); //$NON-NLS-1$ @@ -834,7 +835,7 @@ public class BreakpointManager extends Manager { int id = EXCEPTION_THROW_IDX; if (exceptionBps[EXCEPTION_THROW_IDX] == null) { FunctionLocation location = new FunctionLocation(null, EXCEPTION_FUNCS[id]); - FunctionBreakpoint bp = new FunctionBreakpoint(target, ICDIBreakpoint.REGULAR, location, null); + FunctionBreakpoint bp = new FunctionBreakpoint(target, ICDIBreakpoint.REGULAR, location, null, enabled); setLocationBreakpoint(bp); exceptionBps[id] = bp; miBreakpoints = bp.getMIBreakpoints(); @@ -846,7 +847,7 @@ public class BreakpointManager extends Manager { int id = EXCEPTION_THROW_IDX; if (exceptionBps[id] == null) { FunctionLocation location = new FunctionLocation(null, EXCEPTION_FUNCS[id]); - FunctionBreakpoint bp = new FunctionBreakpoint(target, ICDIBreakpoint.REGULAR, location, null); + FunctionBreakpoint bp = new FunctionBreakpoint(target, ICDIBreakpoint.REGULAR, location, null, enabled); setLocationBreakpoint(bp); exceptionBps[id] = bp; if (miBreakpoints != null) { @@ -861,7 +862,7 @@ public class BreakpointManager extends Manager { } } - Exceptionpoint excp = new Exceptionpoint(target, clazz, stopOnThrow, stopOnCatch, null); + Exceptionpoint excp = new Exceptionpoint(target, clazz, stopOnThrow, stopOnCatch, null, enabled); if (miBreakpoints != null && miBreakpoints.length > 0) { excp.setMIBreakpoints(miBreakpoints); List blist = getBreakpointsList(target); diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/AddressBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/AddressBreakpoint.java index 0074fe3451a..bbdf0ba3d1a 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/AddressBreakpoint.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/AddressBreakpoint.java @@ -19,8 +19,8 @@ public class AddressBreakpoint extends LocationBreakpoint implements ICDIAddressBreakpoint { public AddressBreakpoint(Target target, int kind, ICDILocation loc, - ICDICondition cond) { - super(target, kind, loc, cond); + ICDICondition cond, boolean enabled) { + super(target, kind, loc, cond, enabled); } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java index 7b22442a177..8937a102699 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java @@ -30,11 +30,11 @@ public abstract class Breakpoint extends CObject implements ICDIBreakpoint { int type; boolean enable; - public Breakpoint(Target target, int kind, ICDICondition cond) { + public Breakpoint(Target target, int kind, ICDICondition cond, boolean enabled) { super(target); type = kind; condition = cond; - enable = true; + enable = enabled; } public MIBreakpoint[] getMIBreakpoints() { diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Exceptionpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Exceptionpoint.java index 1af0370c2dd..58fdf867f46 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Exceptionpoint.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Exceptionpoint.java @@ -26,8 +26,8 @@ public class Exceptionpoint extends Breakpoint implements ICDIExceptionpoint { /** */ - public Exceptionpoint(Target target, String clazz, boolean stopOnThrow, boolean stopOnCatch, ICDICondition cond) { - super(target, ICDIBreakpoint.REGULAR, cond); + public Exceptionpoint(Target target, String clazz, boolean stopOnThrow, boolean stopOnCatch, ICDICondition cond, boolean enabled) { + super(target, ICDIBreakpoint.REGULAR, cond, enabled); fClazz = clazz; fStopOnThrow = stopOnThrow; fStopOnCatch = stopOnCatch; diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/FunctionBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/FunctionBreakpoint.java index abe59e3a20a..ef63ae72e8e 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/FunctionBreakpoint.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/FunctionBreakpoint.java @@ -19,8 +19,8 @@ public class FunctionBreakpoint extends LocationBreakpoint implements ICDIFunctionBreakpoint { public FunctionBreakpoint(Target target, int kind, ICDILocation loc, - ICDICondition cond) { - super(target, kind, loc, cond); + ICDICondition cond, boolean enabled) { + super(target, kind, loc, cond, enabled); } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LineBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LineBreakpoint.java index 321dd750d6c..56e4de73191 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LineBreakpoint.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LineBreakpoint.java @@ -17,8 +17,8 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDILineBreakpoint; public class LineBreakpoint extends LocationBreakpoint implements ICDILineBreakpoint { - public LineBreakpoint(Target target, int kind, ICDILineLocation loc, ICDICondition cond) { - super(target, kind, loc, cond); + public LineBreakpoint(Target target, int kind, ICDILineLocation loc, ICDICondition cond, boolean enabled) { + super(target, kind, loc, cond, enabled); } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java index 9f8113f8c4e..8bb4fbedcd0 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/LocationBreakpoint.java @@ -27,8 +27,8 @@ public abstract class LocationBreakpoint extends Breakpoint implements ICDIBreak ICDILocation fLocation; - public LocationBreakpoint(Target target, int kind, ICDILocation loc, ICDICondition cond) { - super(target, kind, cond); + public LocationBreakpoint(Target target, int kind, ICDILocation loc, ICDICondition cond, boolean enabled) { + super(target, kind, cond, enabled); fLocation = loc; } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java index f5f0edb69b7..d425c099fd4 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java @@ -22,6 +22,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressBreakpoint; import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; +import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement2; import org.eclipse.cdt.debug.core.cdi.model.ICDIExceptionpoint; import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; import org.eclipse.cdt.debug.core.cdi.model.ICDIFunctionBreakpoint; @@ -87,7 +88,7 @@ import org.eclipse.core.runtime.Path; /** */ -public class Target extends SessionObject implements ICDITarget { +public class Target extends SessionObject implements ICDITarget, ICDIBreakpointManagement2 { public class Lock { @@ -864,8 +865,7 @@ public class Target extends SessionObject implements ICDITarget { */ public ICDILineBreakpoint setLineBreakpoint(int type, ICDILineLocation location, ICDICondition condition, boolean deferred) throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.setLineBreakpoint(this, type, location, condition, deferred); + return this.setLineBreakpoint(type, location, condition, deferred, true); } /* (non-Javadoc) @@ -873,8 +873,7 @@ public class Target extends SessionObject implements ICDITarget { */ public ICDIFunctionBreakpoint setFunctionBreakpoint(int type, ICDIFunctionLocation location, ICDICondition condition, boolean deferred) throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.setFunctionBreakpoint(this, type, location, condition, deferred); + return this.setFunctionBreakpoint(type, location, condition, deferred, true); } /* (non-Javadoc) @@ -882,8 +881,7 @@ public class Target extends SessionObject implements ICDITarget { */ public ICDIAddressBreakpoint setAddressBreakpoint(int type, ICDIAddressLocation location, ICDICondition condition, boolean deferred) throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.setAddressBreakpoint(this, type, location, condition, deferred); + return this.setAddressBreakpoint(type, location, condition, deferred, true); } /* (non-Javadoc) @@ -891,8 +889,7 @@ public class Target extends SessionObject implements ICDITarget { */ public ICDIWatchpoint setWatchpoint(int type, int watchType, String expression, ICDICondition condition) throws CDIException { - BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); - return bMgr.setWatchpoint(this, type, watchType, expression, condition); + return this.setWatchpoint(type, watchType, expression, condition, true); } /* (non-Javadoc) @@ -1192,4 +1189,28 @@ public class Target extends SessionObject implements ICDITarget { public boolean isVerboseModeEnabled() { return miSession.isVerboseModeEnabled(); } + + public ICDIAddressBreakpoint setAddressBreakpoint(int type, ICDIAddressLocation location, ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { + BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); + return bMgr.setAddressBreakpoint(this, type, location, condition, deferred, enabled); + } + + public ICDIExceptionpoint setExceptionBreakpoint(String clazz, boolean stopOnThrow, boolean stopOnCatch, boolean enabled) throws CDIException { + throw new CDIException(CdiResources.getString("cdi.Common.Not_implemented")); //$NON-NLS-1$ + } + + public ICDIFunctionBreakpoint setFunctionBreakpoint(int type, ICDIFunctionLocation location, ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { + BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); + return bMgr.setFunctionBreakpoint(this, type, location, condition, deferred, enabled); + } + + public ICDILineBreakpoint setLineBreakpoint(int type, ICDILineLocation location, ICDICondition condition, boolean deferred, boolean enabled) throws CDIException { + BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); + return bMgr.setLineBreakpoint(this, type, location, condition, deferred, enabled); + } + + public ICDIWatchpoint setWatchpoint(int type, int watchType, String expression, ICDICondition condition, boolean enabled) throws CDIException { + BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); + return bMgr.setWatchpoint(this, type, watchType, expression, condition, enabled); + } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java index b3ba0513674..3daa66afe3a 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Watchpoint.java @@ -22,8 +22,8 @@ public class Watchpoint extends Breakpoint implements ICDIWatchpoint { int watchType; String what; - public Watchpoint(Target target, String expression, int type, int wType, ICDICondition cond) { - super(target, type, cond); + public Watchpoint(Target target, String expression, int type, int wType, ICDICondition cond, boolean enabled) { + super(target, type, cond, enabled); watchType = wType; what = expression; }