Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2004-08-17 15:38:33 +0000
committerAlain Magloire2004-08-17 15:38:33 +0000
commit503ce8b7628d64832a0b00c819d8e50899df9ef7 (patch)
tree1c18ee4870d887b777c79027b08696991cf60e75
parent46a7e3d2ade0e16e7d27d4fdfbd66e436676406d (diff)
downloadorg.eclipse.cdt-503ce8b7628d64832a0b00c819d8e50899df9ef7.tar.gz
org.eclipse.cdt-503ce8b7628d64832a0b00c819d8e50899df9ef7.tar.xz
org.eclipse.cdt-503ce8b7628d64832a0b00c819d8e50899df9ef7.zip
Deffered breakpoint fix.
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/ChangeLog6
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java21
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java49
3 files changed, 54 insertions, 22 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
index 99825293b57..36644eeb96a 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
@@ -1,3 +1,9 @@
+2004-08-17 Alain Magloire
+
+ Deferred breakpoint when disable was not respected.
+ * src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
+ * src/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java
+
2004-08-14 Alain Magloire
Fix for 71992.
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
index ebf8c4fdd58..b090a7e1ef4 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
@@ -370,11 +370,18 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
if (bpoints[i] instanceof Breakpoint) {
Breakpoint bkpt = (Breakpoint)bpoints[i];
try {
+ boolean enable = bkpt.isEnabled();
bpMgr.setLocationBreakpoint(bkpt);
bpMgr.deleteFromDeferredList(bkpt);
bpMgr.addToBreakpointList(bkpt);
+ // If the breakpoint was disable in the IDE
+ // install it but keep it disable
+ if (!enable) {
+ bpMgr.disableBreakpoint(bkpt);
+ }
eventList.add(new MIBreakpointCreatedEvent(bkpt.getMIBreakpoint().getNumber()));
} catch (CDIException e) {
+ // ignore
}
}
}
@@ -422,25 +429,26 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
int miLevel = 0;
int tid = 0;
- ICDIThread oldThread = null;
+ ICDIThread currentThread = null;
try {
- oldThread = currentTarget.getCurrentThread();
+ currentThread = currentTarget.getCurrentThread();
} catch (CDIException e1) {
}
- if (oldThread instanceof Thread) {
- tid = ((Thread)oldThread).getId();
+ if (currentThread instanceof Thread) {
+ tid = ((Thread)currentThread).getId();
}
- // select the old thread now
+ // Select the old thread now.
if (tid > 0) {
MIThreadSelect selectThread = factory.createMIThreadSelect(tid);
try {
mi.postCommand(selectThread);
} catch (MIException e) {
+ // ignore
}
}
ICDIStackFrame frame = null;
try {
- frame = oldThread.getCurrentStackFrame();
+ frame = currentThread.getCurrentStackFrame();
} catch (CDIException e2) {
}
int count = 0;
@@ -471,6 +479,7 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
mi.postCommand(selectFrame);
mi.postCommand(finish);
} catch (MIException e) {
+ // ignore
}
} else {
// if we are still at the same level in the backtrace
diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java
index 9eb28458d57..4edaeb908e4 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java
@@ -1,7 +1,13 @@
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException;
@@ -24,6 +30,7 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
BreakpointManager mgr;
int type;
String tid;
+ boolean enable;
public Breakpoint(BreakpointManager m, int kind, ICDILocation loc, ICDICondition cond, String threadId) {
super(m.getSession().getCurrentTarget());
@@ -32,6 +39,7 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
location = loc;
condition = cond;
tid = threadId;
+ enable = true;
}
public Breakpoint(BreakpointManager m, MIBreakpoint miBreak) {
@@ -46,9 +54,9 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
public void setMIBreakpoint(MIBreakpoint newMIBreakpoint) {
miBreakpoint = newMIBreakpoint;
- // Force the reset of the location and condition.
- location = null;
+ // Force the reset to use GDB's values.
condition = null;
+ location = null;
}
public boolean isDeferred() {
@@ -60,8 +68,9 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
*/
public ICDICondition getCondition() throws CDIException {
if (condition == null) {
- if (miBreakpoint != null)
+ if (miBreakpoint != null) {
condition = new Condition(miBreakpoint.getIgnoreCount(), miBreakpoint.getCondition());
+ }
}
return condition;
}
@@ -70,8 +79,9 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#getThreadId()
*/
public String getThreadId() throws CDIException {
- if (miBreakpoint != null)
+ if (miBreakpoint != null) {
return miBreakpoint.getThreadId();
+ }
return tid;
}
@@ -79,17 +89,19 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isEnabled()
*/
public boolean isEnabled() throws CDIException {
- if (miBreakpoint != null)
+ if (miBreakpoint != null) {
return miBreakpoint.isEnabled();
- return false;
+ }
+ return enable;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isHardware()
*/
public boolean isHardware() {
- if (miBreakpoint != null)
+ if (miBreakpoint != null) {
return miBreakpoint.isHardware();
+ }
return (type == ICDIBreakpoint.HARDWARE);
}
@@ -97,8 +109,9 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#isTemporary()
*/
public boolean isTemporary() {
- if (miBreakpoint != null)
+ if (miBreakpoint != null) {
return miBreakpoint.isTemporary();
+ }
return (type == ICDIBreakpoint.TEMPORARY);
}
@@ -115,12 +128,15 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
/**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpoint#setEnabled(boolean)
*/
- public void setEnabled(boolean enable) throws CDIException {
- if (enable == false && isEnabled() == true) {
+ public void setEnabled(boolean on) throws CDIException {
+ if (miBreakpoint != null) {
+ if (on == false && isEnabled() == true) {
mgr.disableBreakpoint(this);
- } else if (enable == true && isEnabled() == false) {
+ } else if (on == true && isEnabled() == false) {
mgr.enableBreakpoint(this);
+ }
}
+ enable = on;
}
/**
@@ -128,11 +144,12 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
*/
public ICDILocation getLocation() throws CDIException {
if (location == null) {
- if (miBreakpoint != null)
+ if (miBreakpoint != null) {
location = new Location (miBreakpoint.getFile(),
miBreakpoint.getFunction(),
miBreakpoint.getLine(),
miBreakpoint.getAddress());
+ }
}
return location;
}

Back to the top