1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

Fix for PR 66338

* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/Condition.java
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
	* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java
This commit is contained in:
Alain Magloire 2004-06-10 02:51:50 +00:00
parent 788cbb7b7e
commit 7d75673d86
5 changed files with 43 additions and 25 deletions

View file

@ -1,3 +1,10 @@
2004-06-09 Alain Magloire
Fix for PR 66338
* cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/Condition.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java
2004-06-09 Alain Magloire 2004-06-09 Alain Magloire
Keep the breakpoint disable when doing Keep the breakpoint disable when doing

View file

@ -403,16 +403,15 @@ public class BreakpointManager extends Manager implements ICDIBreakpointManager
} catch (CDIException e) { } catch (CDIException e) {
if (!deferred) { if (!deferred) {
throw e; throw e;
} else { }
Session session = (Session)getSession(); Session session = (Session)getSession();
ICDISharedLibraryManager sharedMgr = session.getSharedLibraryManager(); ICDISharedLibraryManager sharedMgr = session.getSharedLibraryManager();
if (sharedMgr instanceof SharedLibraryManager) { if (sharedMgr instanceof SharedLibraryManager) {
SharedLibraryManager mgr = (SharedLibraryManager)sharedMgr; SharedLibraryManager mgr = (SharedLibraryManager)sharedMgr;
if (mgr.isDeferredBreakpoint()) { if (mgr.isDeferredBreakpoint()) {
deferredList.add(bkpt); deferredList.add(bkpt);
} else { } else {
throw e; throw e;
}
} }
} }
} }

View file

@ -15,7 +15,7 @@ public class Condition implements ICDICondition {
public Condition(int ignore, String exp) { public Condition(int ignore, String exp) {
ignoreCount = ignore; ignoreCount = ignore;
expression = exp; expression = (exp == null) ? new String() : exp;
} }
/** /**

View file

@ -358,12 +358,13 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
if (bpoints[i] instanceof Breakpoint) { if (bpoints[i] instanceof Breakpoint) {
Breakpoint bkpt = (Breakpoint)bpoints[i]; Breakpoint bkpt = (Breakpoint)bpoints[i];
try { try {
boolean enable = bkpt.isEnabled();
bpMgr.setLocationBreakpoint(bkpt); bpMgr.setLocationBreakpoint(bkpt);
bpMgr.deleteFromDeferredList(bkpt); bpMgr.deleteFromDeferredList(bkpt);
bpMgr.addToBreakpointList(bkpt); bpMgr.addToBreakpointList(bkpt);
// If the breakpoint was disable // If the breakpoint was disable in the IDE
// install it but keep it disable // install it but keep it disable
if (!bkpt.isEnabled()) { if (!enable) {
bpMgr.disableBreakpoint(bkpt); bpMgr.disableBreakpoint(bkpt);
} }
eventList.add(new MIBreakpointCreatedEvent(bkpt.getMIBreakpoint().getNumber())); eventList.add(new MIBreakpointCreatedEvent(bkpt.getMIBreakpoint().getNumber()));

View file

@ -24,6 +24,7 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
BreakpointManager mgr; BreakpointManager mgr;
int type; int type;
String tid; String tid;
boolean enable;
public Breakpoint(BreakpointManager m, int kind, ICDILocation loc, ICDICondition cond, String threadId) { public Breakpoint(BreakpointManager m, int kind, ICDILocation loc, ICDICondition cond, String threadId) {
super(m.getSession().getCurrentTarget()); super(m.getSession().getCurrentTarget());
@ -32,6 +33,7 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
location = loc; location = loc;
condition = cond; condition = cond;
tid = threadId; tid = threadId;
enable = true;
} }
public Breakpoint(BreakpointManager m, MIBreakpoint miBreak) { public Breakpoint(BreakpointManager m, MIBreakpoint miBreak) {
@ -46,9 +48,9 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
public void setMIBreakpoint(MIBreakpoint newMIBreakpoint) { public void setMIBreakpoint(MIBreakpoint newMIBreakpoint) {
miBreakpoint = newMIBreakpoint; miBreakpoint = newMIBreakpoint;
// Force the reset of the location and condition. // Force the reset to use GDB's values.
location = null;
condition = null; condition = null;
location = null;
} }
public boolean isDeferred() { public boolean isDeferred() {
@ -60,8 +62,9 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
*/ */
public ICDICondition getCondition() throws CDIException { public ICDICondition getCondition() throws CDIException {
if (condition == null) { if (condition == null) {
if (miBreakpoint != null) if (miBreakpoint != null) {
condition = new Condition(miBreakpoint.getIgnoreCount(), miBreakpoint.getCondition()); condition = new Condition(miBreakpoint.getIgnoreCount(), miBreakpoint.getCondition());
}
} }
return condition; return condition;
} }
@ -70,8 +73,9 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#getThreadId() * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#getThreadId()
*/ */
public String getThreadId() throws CDIException { public String getThreadId() throws CDIException {
if (miBreakpoint != null) if (miBreakpoint != null) {
return miBreakpoint.getThreadId(); return miBreakpoint.getThreadId();
}
return tid; return tid;
} }
@ -79,17 +83,19 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isEnabled() * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isEnabled()
*/ */
public boolean isEnabled() throws CDIException { public boolean isEnabled() throws CDIException {
if (miBreakpoint != null) if (miBreakpoint != null) {
return miBreakpoint.isEnabled(); return miBreakpoint.isEnabled();
return false; }
return enable;
} }
/** /**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isHardware() * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isHardware()
*/ */
public boolean isHardware() { public boolean isHardware() {
if (miBreakpoint != null) if (miBreakpoint != null) {
return miBreakpoint.isHardware(); return miBreakpoint.isHardware();
}
return (type == ICDIBreakpoint.HARDWARE); return (type == ICDIBreakpoint.HARDWARE);
} }
@ -97,8 +103,9 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isTemporary() * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isTemporary()
*/ */
public boolean isTemporary() { public boolean isTemporary() {
if (miBreakpoint != null) if (miBreakpoint != null) {
return miBreakpoint.isTemporary(); return miBreakpoint.isTemporary();
}
return (type == ICDIBreakpoint.TEMPORARY); return (type == ICDIBreakpoint.TEMPORARY);
} }
@ -115,12 +122,15 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
/** /**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#setEnabled(boolean) * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#setEnabled(boolean)
*/ */
public void setEnabled(boolean enable) throws CDIException { public void setEnabled(boolean on) throws CDIException {
if (enable == false && isEnabled() == true) { if (miBreakpoint != null) {
if (on == false && isEnabled() == true) {
mgr.disableBreakpoint(this); mgr.disableBreakpoint(this);
} else if (enable == true && isEnabled() == false) { } else if (on == true && isEnabled() == false) {
mgr.enableBreakpoint(this); mgr.enableBreakpoint(this);
}
} }
enable = on;
} }
/** /**
@ -128,11 +138,12 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
*/ */
public ICDILocation getLocation() throws CDIException { public ICDILocation getLocation() throws CDIException {
if (location == null) { if (location == null) {
if (miBreakpoint != null) if (miBreakpoint != null) {
location = new Location (miBreakpoint.getFile(), location = new Location (miBreakpoint.getFile(),
miBreakpoint.getFunction(), miBreakpoint.getFunction(),
miBreakpoint.getLine(), miBreakpoint.getLine(),
miBreakpoint.getAddress()); miBreakpoint.getAddress());
}
} }
return location; return location;
} }