1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Support for ICDIBreakpointManagment2, breaks are enabled/disabled when they are set.

This commit is contained in:
Ken Ryall 2007-02-16 04:30:03 +00:00
parent 608dfc4e8f
commit b4340ada20
9 changed files with 61 additions and 39 deletions

View file

@ -425,7 +425,7 @@ public class BreakpointManager extends Manager {
if (allMIBreakpoints[i].isAccessWatchpoint() || allMIBreakpoints[i].isWriteWatchpoint()) { if (allMIBreakpoints[i].isAccessWatchpoint() || allMIBreakpoints[i].isWriteWatchpoint()) {
watchType |= ICDIWatchpoint.WRITE; 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]}); wpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]});
bList.add(wpoint); bList.add(wpoint);
} else { } else {
@ -433,25 +433,26 @@ public class BreakpointManager extends Manager {
String file = allMIBreakpoints[i].getFile(); String file = allMIBreakpoints[i].getFile();
int line = allMIBreakpoints[i].getLine(); int line = allMIBreakpoints[i].getLine();
String addr = allMIBreakpoints[i].getAddress(); String addr = allMIBreakpoints[i].getAddress();
boolean enabled = allMIBreakpoints[i].isEnabled();
if (file != null && file.length() > 0 && line > 0) { if (file != null && file.length() > 0 && line > 0) {
LineLocation location = createLineLocation (allMIBreakpoints[i].getFile(), LineLocation location = createLineLocation (allMIBreakpoints[i].getFile(),
allMIBreakpoints[i].getLine()); allMIBreakpoints[i].getLine());
// By default new breakpoint are LineBreakpoint // 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]}); newBreakpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]});
bList.add(newBreakpoint); bList.add(newBreakpoint);
} else if (function != null && function.length() > 0) { } else if (function != null && function.length() > 0) {
FunctionLocation location = createFunctionLocation(file, function); FunctionLocation location = createFunctionLocation(file, function);
// By default new breakpoint are LineBreakpoint // 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]}); newBreakpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]});
bList.add(newBreakpoint); bList.add(newBreakpoint);
} else if (addr != null && addr.length() > 0) { } else if (addr != null && addr.length() > 0) {
BigInteger big = MIFormat.getBigInteger(addr); BigInteger big = MIFormat.getBigInteger(addr);
AddressLocation location = createAddressLocation (big); AddressLocation location = createAddressLocation (big);
// By default new breakpoint are LineBreakpoint // 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]}); newBreakpoint.setMIBreakpoints(new MIBreakpoint[] {allMIBreakpoints[i]});
bList.add(newBreakpoint); 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) * @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, public ICDILineBreakpoint setLineBreakpoint(Target target, int type, ICDILineLocation location,
ICDICondition condition, boolean deferred) throws CDIException { ICDICondition condition, boolean deferred, boolean enabled) throws CDIException {
LineBreakpoint bkpt = new LineBreakpoint(target, type, location, condition); LineBreakpoint bkpt = new LineBreakpoint(target, type, location, condition, enabled);
setNewLocationBreakpoint(bkpt, deferred); setNewLocationBreakpoint(bkpt, deferred);
return bkpt; 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) * @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, public ICDIFunctionBreakpoint setFunctionBreakpoint(Target target, int type, ICDIFunctionLocation location,
ICDICondition condition, boolean deferred) throws CDIException { ICDICondition condition, boolean deferred, boolean enabled) throws CDIException {
FunctionBreakpoint bkpt = new FunctionBreakpoint(target, type, location, condition); FunctionBreakpoint bkpt = new FunctionBreakpoint(target, type, location, condition, enabled);
setNewLocationBreakpoint(bkpt, deferred); setNewLocationBreakpoint(bkpt, deferred);
return bkpt; 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) * @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, public ICDIAddressBreakpoint setAddressBreakpoint(Target target, int type, ICDIAddressLocation location,
ICDICondition condition, boolean deferred) throws CDIException { ICDICondition condition, boolean deferred, boolean enabled) throws CDIException {
AddressBreakpoint bkpt = new AddressBreakpoint(target, type, location, condition); AddressBreakpoint bkpt = new AddressBreakpoint(target, type, location, condition, enabled);
setNewLocationBreakpoint(bkpt, deferred); setNewLocationBreakpoint(bkpt, deferred);
return bkpt; return bkpt;
} }
@ -664,7 +665,7 @@ public class BreakpointManager extends Manager {
} }
public ICDIWatchpoint setWatchpoint(Target target, int type, int watchType, String expression, 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, // HACK: for the IDE,
try { try {
@ -674,7 +675,7 @@ public class BreakpointManager extends Manager {
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// //
} }
Watchpoint bkpt = new Watchpoint(target, expression, type, watchType, condition); Watchpoint bkpt = new Watchpoint(target, expression, type, watchType, condition, enabled);
setWatchpoint(bkpt); setWatchpoint(bkpt);
List bList = getBreakpointsList(target); List bList = getBreakpointsList(target);
@ -821,7 +822,7 @@ public class BreakpointManager extends Manager {
public ICDIExceptionpoint setExceptionpoint(Target target, String clazz, boolean stopOnThrow, public ICDIExceptionpoint setExceptionpoint(Target target, String clazz, boolean stopOnThrow,
boolean stopOnCatch) throws CDIException { boolean stopOnCatch, boolean enabled) throws CDIException {
if (!stopOnThrow && !stopOnCatch) { if (!stopOnThrow && !stopOnCatch) {
throw new CDIException("Must suspend on throw or catch"); //$NON-NLS-1$ 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; int id = EXCEPTION_THROW_IDX;
if (exceptionBps[EXCEPTION_THROW_IDX] == null) { if (exceptionBps[EXCEPTION_THROW_IDX] == null) {
FunctionLocation location = new FunctionLocation(null, EXCEPTION_FUNCS[id]); 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); setLocationBreakpoint(bp);
exceptionBps[id] = bp; exceptionBps[id] = bp;
miBreakpoints = bp.getMIBreakpoints(); miBreakpoints = bp.getMIBreakpoints();
@ -846,7 +847,7 @@ public class BreakpointManager extends Manager {
int id = EXCEPTION_THROW_IDX; int id = EXCEPTION_THROW_IDX;
if (exceptionBps[id] == null) { if (exceptionBps[id] == null) {
FunctionLocation location = new FunctionLocation(null, EXCEPTION_FUNCS[id]); 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); setLocationBreakpoint(bp);
exceptionBps[id] = bp; exceptionBps[id] = bp;
if (miBreakpoints != null) { 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) { if (miBreakpoints != null && miBreakpoints.length > 0) {
excp.setMIBreakpoints(miBreakpoints); excp.setMIBreakpoints(miBreakpoints);
List blist = getBreakpointsList(target); List blist = getBreakpointsList(target);

View file

@ -19,8 +19,8 @@ public class AddressBreakpoint extends LocationBreakpoint implements
ICDIAddressBreakpoint { ICDIAddressBreakpoint {
public AddressBreakpoint(Target target, int kind, ICDILocation loc, public AddressBreakpoint(Target target, int kind, ICDILocation loc,
ICDICondition cond) { ICDICondition cond, boolean enabled) {
super(target, kind, loc, cond); super(target, kind, loc, cond, enabled);
} }
} }

View file

@ -30,11 +30,11 @@ public abstract class Breakpoint extends CObject implements ICDIBreakpoint {
int type; int type;
boolean enable; boolean enable;
public Breakpoint(Target target, int kind, ICDICondition cond) { public Breakpoint(Target target, int kind, ICDICondition cond, boolean enabled) {
super(target); super(target);
type = kind; type = kind;
condition = cond; condition = cond;
enable = true; enable = enabled;
} }
public MIBreakpoint[] getMIBreakpoints() { public MIBreakpoint[] getMIBreakpoints() {

View file

@ -26,8 +26,8 @@ public class Exceptionpoint extends Breakpoint implements ICDIExceptionpoint {
/** /**
*/ */
public Exceptionpoint(Target target, String clazz, boolean stopOnThrow, boolean stopOnCatch, ICDICondition cond) { public Exceptionpoint(Target target, String clazz, boolean stopOnThrow, boolean stopOnCatch, ICDICondition cond, boolean enabled) {
super(target, ICDIBreakpoint.REGULAR, cond); super(target, ICDIBreakpoint.REGULAR, cond, enabled);
fClazz = clazz; fClazz = clazz;
fStopOnThrow = stopOnThrow; fStopOnThrow = stopOnThrow;
fStopOnCatch = stopOnCatch; fStopOnCatch = stopOnCatch;

View file

@ -19,8 +19,8 @@ public class FunctionBreakpoint extends LocationBreakpoint implements
ICDIFunctionBreakpoint { ICDIFunctionBreakpoint {
public FunctionBreakpoint(Target target, int kind, ICDILocation loc, public FunctionBreakpoint(Target target, int kind, ICDILocation loc,
ICDICondition cond) { ICDICondition cond, boolean enabled) {
super(target, kind, loc, cond); super(target, kind, loc, cond, enabled);
} }
} }

View file

@ -17,8 +17,8 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDILineBreakpoint;
public class LineBreakpoint extends LocationBreakpoint implements ICDILineBreakpoint { public class LineBreakpoint extends LocationBreakpoint implements ICDILineBreakpoint {
public LineBreakpoint(Target target, int kind, ICDILineLocation loc, ICDICondition cond) { public LineBreakpoint(Target target, int kind, ICDILineLocation loc, ICDICondition cond, boolean enabled) {
super(target, kind, loc, cond); super(target, kind, loc, cond, enabled);
} }
} }

View file

@ -27,8 +27,8 @@ public abstract class LocationBreakpoint extends Breakpoint implements ICDIBreak
ICDILocation fLocation; ICDILocation fLocation;
public LocationBreakpoint(Target target, int kind, ICDILocation loc, ICDICondition cond) { public LocationBreakpoint(Target target, int kind, ICDILocation loc, ICDICondition cond, boolean enabled) {
super(target, kind, cond); super(target, kind, cond, enabled);
fLocation = loc; fLocation = loc;
} }

View file

@ -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.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressBreakpoint; 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.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.ICDIExceptionpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
import org.eclipse.cdt.debug.core.cdi.model.ICDIFunctionBreakpoint; 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 { public class Lock {
@ -864,8 +865,7 @@ public class Target extends SessionObject implements ICDITarget {
*/ */
public ICDILineBreakpoint setLineBreakpoint(int type, ICDILineLocation location, public ICDILineBreakpoint setLineBreakpoint(int type, ICDILineLocation location,
ICDICondition condition, boolean deferred) throws CDIException { ICDICondition condition, boolean deferred) throws CDIException {
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); return this.setLineBreakpoint(type, location, condition, deferred, true);
return bMgr.setLineBreakpoint(this, type, location, condition, deferred);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -873,8 +873,7 @@ public class Target extends SessionObject implements ICDITarget {
*/ */
public ICDIFunctionBreakpoint setFunctionBreakpoint(int type, ICDIFunctionLocation location, public ICDIFunctionBreakpoint setFunctionBreakpoint(int type, ICDIFunctionLocation location,
ICDICondition condition, boolean deferred) throws CDIException { ICDICondition condition, boolean deferred) throws CDIException {
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); return this.setFunctionBreakpoint(type, location, condition, deferred, true);
return bMgr.setFunctionBreakpoint(this, type, location, condition, deferred);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -882,8 +881,7 @@ public class Target extends SessionObject implements ICDITarget {
*/ */
public ICDIAddressBreakpoint setAddressBreakpoint(int type, ICDIAddressLocation location, public ICDIAddressBreakpoint setAddressBreakpoint(int type, ICDIAddressLocation location,
ICDICondition condition, boolean deferred) throws CDIException { ICDICondition condition, boolean deferred) throws CDIException {
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); return this.setAddressBreakpoint(type, location, condition, deferred, true);
return bMgr.setAddressBreakpoint(this, type, location, condition, deferred);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -891,8 +889,7 @@ public class Target extends SessionObject implements ICDITarget {
*/ */
public ICDIWatchpoint setWatchpoint(int type, int watchType, String expression, public ICDIWatchpoint setWatchpoint(int type, int watchType, String expression,
ICDICondition condition) throws CDIException { ICDICondition condition) throws CDIException {
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); return this.setWatchpoint(type, watchType, expression, condition, true);
return bMgr.setWatchpoint(this, type, watchType, expression, condition);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -1192,4 +1189,28 @@ public class Target extends SessionObject implements ICDITarget {
public boolean isVerboseModeEnabled() { public boolean isVerboseModeEnabled() {
return miSession.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);
}
} }

View file

@ -22,8 +22,8 @@ public class Watchpoint extends Breakpoint implements ICDIWatchpoint {
int watchType; int watchType;
String what; String what;
public Watchpoint(Target target, String expression, int type, int wType, ICDICondition cond) { public Watchpoint(Target target, String expression, int type, int wType, ICDICondition cond, boolean enabled) {
super(target, type, cond); super(target, type, cond, enabled);
watchType = wType; watchType = wType;
what = expression; what = expression;
} }