Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2005-06-28 16:57:33 +0000
committerAlain Magloire2005-06-28 16:57:33 +0000
commit52a370c3ae6e69324580f0b7933ba196728156bf (patch)
tree8b90ef0a848c73c0bfb4b2790383540452f9afb7
parent03cb2a3ec9c458dda9054dc46e48268045dbfc4e (diff)
downloadorg.eclipse.cdt-52a370c3ae6e69324580f0b7933ba196728156bf.tar.gz
org.eclipse.cdt-52a370c3ae6e69324580f0b7933ba196728156bf.tar.xz
org.eclipse.cdt-52a370c3ae6e69324580f0b7933ba196728156bf.zip
2005-06-27 Alain Magloire
New command from newer version of gdb "set breakpoint pending" better handling of the breakpoint while the target is running. * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java * mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java + mi/org/eclipse/cdt/debug/mi/core/ccommand/MIGDBSetBreakpoinPending.java
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/ChangeLog10
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java24
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java24
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java15
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java4
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetBreakpointPending.java25
6 files changed, 96 insertions, 6 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
index 3dc3cfa97a6..3b09cf8021f 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
@@ -1,4 +1,14 @@
2005-06-27 Alain Magloire
+ New command from newer version of gdb "set breakpoint pending"
+ better handling of the breakpoint while the target is running.
+ * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
+ * cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
+ * cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java
+ * cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
+ * mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
+ + mi/org/eclipse/cdt/debug/mi/core/ccommand/MIGDBSetBreakpoinPending.java
+
+2005-06-27 Alain Magloire
Bug when parsing "int *&" corrected.
Change in ICDIReferenceValue.
Use the type in the response of the var-create instead of reissuing -var-info-type
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 2051a7c14ab..8ae4464eed1 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
@@ -52,6 +52,7 @@ import org.eclipse.cdt.debug.mi.core.command.MIBreakEnable;
import org.eclipse.cdt.debug.mi.core.command.MIBreakInsert;
import org.eclipse.cdt.debug.mi.core.command.MIBreakList;
import org.eclipse.cdt.debug.mi.core.command.MIBreakWatch;
+import org.eclipse.cdt.debug.mi.core.command.MIGDBSetBreakpointPending;
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointCreatedEvent;
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointDeletedEvent;
@@ -153,9 +154,9 @@ public class BreakpointManager extends Manager {
void resumeInferior(Target target, boolean shouldRestart) throws CDIException {
if (shouldRestart) {
+ target.resume();
// Enable events again.
((EventManager)getSession().getEventManager()).allowProcessingEvents(true);
- target.resume();
}
}
@@ -865,6 +866,27 @@ public class BreakpointManager extends Manager {
return excp;
}
+ /**
+ * Call -gdb-set breakpoint pending set
+ * @param target
+ * @param set
+ * @throws CDIException
+ */
+ public void setBreakpointPending(Target target, boolean set) throws CDIException {
+ MISession miSession = target.getMISession();
+ CommandFactory factory = miSession.getCommandFactory();
+ MIGDBSetBreakpointPending bpp = factory.createMIGDBSetBreakpointPending(set);
+ try {
+ miSession.postCommand(bpp);
+ MIInfo info = bpp.getMIInfo();
+ if (info == null) {
+ throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
+ }
+ } catch (MIException e) {
+ throw new MI2CDIException(e);
+ }
+ }
+
public Condition createCondition(int ignoreCount, String expression, String[] tids) {
return new Condition(ignoreCount, expression, tids);
}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
index 2c69f4a6143..8d5a83c62f3 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java
@@ -87,11 +87,6 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
*/
public void update(Observable o, Object arg) {
- // Bailout early if we do not want to process any events.
- if (!isAllowingProcessingEvents()) {
- return;
- }
-
MIEvent miEvent = (MIEvent)arg;
Session session = (Session)getSession();
Target currentTarget = session.getTarget(miEvent.getMISession());
@@ -265,6 +260,14 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
Session session = (Session)getSession();
MISession miSession = stopped.getMISession();
Target currentTarget = session.getTarget(miSession);
+ currentTarget.setSupended(true);
+
+ // Bailout early if we do not want to process any events.
+ if (!isAllowingProcessingEvents()) {
+ return false;
+ }
+
+
if (processSharedLibEvent(stopped)) {
// Event was consumed by the shared lib processing bailout
return false;
@@ -506,6 +509,17 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
*/
boolean processRunningEvent(MIRunningEvent running) {
lastRunningEvent = running;
+
+ Session session = (Session)getSession();
+ MISession miSession = running.getMISession();
+ Target currentTarget = session.getTarget(miSession);
+ currentTarget.setSupended(false);
+
+ // Bailout early if we do not want to process any events.
+ if (!isAllowingProcessingEvents()) {
+ return false;
+ }
+
return true;
}
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 5af36ae20a5..e4fe3a0a78e 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
@@ -90,6 +90,7 @@ public class Target extends SessionObject implements ICDITarget {
Thread[] currentThreads;
int currentThreadId;
String fEndian = null;
+ boolean suspended = true;
public Target(Session s, MISession mi) {
super(s);
@@ -130,6 +131,11 @@ public class Target extends SessionObject implements ICDITarget {
}
}
+ public synchronized void setSupended(boolean state) {
+ suspended = state;
+ notifyAll();
+ }
+
/**
*/
public void setCurrentThread(Thread cthread, boolean doUpdate) throws CDIException {
@@ -545,6 +551,15 @@ public class Target extends SessionObject implements ICDITarget {
public void suspend() throws CDIException {
try {
miSession.getMIInferior().interrupt();
+ // Wait till the EventManager tell us the go ahead
+ synchronized (this) {
+ for (int i = 0; !suspended && i < 6; i++) {
+ try {
+ wait(1000);
+ } catch (InterruptedException e) {
+ }
+ }
+ }
} catch (MIException e) {
throw new MI2CDIException(e);
}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
index f577d7b30fc..e2acee8c6ba 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java
@@ -220,6 +220,10 @@ public class CommandFactory {
return new MIGDBSetSolibSearchPath(getMIVersion(), params);
}
+ public MIGDBSetBreakpointPending createMIGDBSetBreakpointPending(boolean set) {
+ return new MIGDBSetBreakpointPending(getMIVersion(), set);
+ }
+
public MIGDBShow createMIGDBShow(String[] params) {
return new MIGDBShow(getMIVersion(), params);
}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetBreakpointPending.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetBreakpointPending.java
new file mode 100644
index 00000000000..6d2843a8601
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBSetBreakpointPending.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2005 QnX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Qnx Software Systems - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.debug.mi.core.command;
+
+/**
+ *
+ * MIGDBSetBreakpointPending
+ *
+ */
+public class MIGDBSetBreakpointPending extends MIGDBSet {
+
+ public MIGDBSetBreakpointPending(String miVersion, boolean set) {
+ super(miVersion, new String[] {"breakpoint", "pending", (set) ? "on" : "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+
+}

Back to the top