Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2004-10-18 23:16:09 +0000
committerAlain Magloire2004-10-18 23:16:09 +0000
commitcad896ca60aa3706d1f80662276192be562fd4bb (patch)
tree6d3b26b3cda2cb32152d28e555e21b7eba4474be
parent1f3df7b1c73404b4afd8996726852d867ddb3d19 (diff)
downloadorg.eclipse.cdt-cad896ca60aa3706d1f80662276192be562fd4bb.tar.gz
org.eclipse.cdt-cad896ca60aa3706d1f80662276192be562fd4bb.tar.xz
org.eclipse.cdt-cad896ca60aa3706d1f80662276192be562fd4bb.zip
2004-10-18 Alain Magloire
Adjust to changes in CDI * src/org/eclipse/cdt/debug/mi/core/cdi/model/RuntimeOptions.java * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java * src/org/eclipse/cdt/debug/mi/core/cdi/Session.java
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/ChangeLog6
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java12
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RuntimeOptions.java114
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java8
4 files changed, 129 insertions, 11 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
index ab20941f7fb..8629eecf0a8 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog
@@ -1,3 +1,9 @@
+2004-10-18 Alain Magloire
+ Adjust to changes in CDI
+ * src/org/eclipse/cdt/debug/mi/core/cdi/model/RuntimeOptions.java
+ * src/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java
+ * src/org/eclipse/cdt/debug/mi/core/cdi/Session.java
+
2004-10-17 Alain Magloire
Remove deprecated method in CDI adjust the implementation.
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java
index 28d4f6456cb..70c7f7ee3bc 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java
@@ -19,7 +19,6 @@ import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
import org.eclipse.cdt.debug.core.cdi.ICDIExpressionManager;
import org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager;
import org.eclipse.cdt.debug.core.cdi.ICDIRegisterManager;
-import org.eclipse.cdt.debug.core.cdi.ICDIRuntimeOptions;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
@@ -198,9 +197,7 @@ public class Session implements ICDISession, ICDISessionObject {
public void setCurrentTarget(Target target) throws CDIException {
ProcessManager pMgr = getProcessManager();
pMgr.setCurrentTarget((Target)target);
-// } else {
-// throw new CDIException(CdiResources.getString("cdi.Session.Unknown_target")); //$NON-NLS-1$
-// }
+// throw new CDIException(CdiResources.getString("cdi.Session.Unknown_target")); //$NON-NLS-1$
}
/**
@@ -222,13 +219,6 @@ public class Session implements ICDISession, ICDISessionObject {
}
/**
- * @see org.eclipse.cdt.debug.core.cdi.ICDISession#getRuntimeOptions()
- */
- public ICDIRuntimeOptions getRuntimeOptions() {
- return new RuntimeOptions(this);
- }
-
- /**
* @see org.eclipse.cdt.debug.core.cdi.ICDISessionObject#getSession()
*/
public ICDISession getSession() {
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RuntimeOptions.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RuntimeOptions.java
new file mode 100644
index 00000000000..7b790efddec
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/RuntimeOptions.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * 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 java.util.Iterator;
+import java.util.Properties;
+
+import org.eclipse.cdt.debug.core.cdi.CDIException;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions;
+import org.eclipse.cdt.debug.mi.core.MIException;
+import org.eclipse.cdt.debug.mi.core.MISession;
+import org.eclipse.cdt.debug.mi.core.cdi.CdiResources;
+import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
+import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD;
+import org.eclipse.cdt.debug.mi.core.command.MIExecArguments;
+import org.eclipse.cdt.debug.mi.core.command.MIGDBSetEnvironment;
+import org.eclipse.cdt.debug.mi.core.output.MIInfo;
+
+/**
+ */
+public class RuntimeOptions extends CObject implements ICDIRuntimeOptions {
+
+ Target target;
+
+ public RuntimeOptions(Target t) {
+ super(t);
+ }
+
+ /**
+ * @see org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions#setArguments(String)
+ */
+ public void setArguments(String[] args) throws CDIException {
+ Target target = (Target)getTarget();
+ if (args == null || args.length == 0) {
+ return;
+ }
+ MISession mi = target.getMISession();
+ CommandFactory factory = mi.getCommandFactory();
+ MIExecArguments arguments = factory.createMIExecArguments(args);
+ try {
+ mi.postCommand(arguments);
+ MIInfo info = arguments.getMIInfo();
+ if (info == null) {
+ throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_args_target_not_responding")); //$NON-NLS-1$
+ }
+ } catch (MIException e) {
+ throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_args") + e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @see org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions#setEnvironment(Properties)
+ */
+ public void setEnvironment(Properties props) throws CDIException {
+ Target target = (Target)getTarget();
+ if (props == null) {
+ return;
+ }
+ MISession mi = target.getMISession();
+ CommandFactory factory = mi.getCommandFactory();
+ Iterator iterator = props.keySet().iterator();
+ while (iterator.hasNext()) {
+ String key = (String)iterator.next();
+ String value = props.getProperty(key);
+ String params[] = null;
+ if (value == null || value.length() == 0) {
+ params = new String[] {key};
+ } else {
+ params = new String[] {key, value};
+ }
+ MIGDBSetEnvironment set = factory.createMIGDBSetEnvironment(params);
+ try {
+ mi.postCommand(set);
+ MIInfo info = set.getMIInfo();
+ if (info == null) {
+ throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_args_target_not_responding")); //$NON-NLS-1$
+ }
+ } catch (MIException e) {
+ throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_environment") + e.getMessage()); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions#setWorkingDirectory(String)
+ */
+ public void setWorkingDirectory(String wd) throws CDIException {
+ Target target = (Target)getTarget();
+ if (wd == null || wd.length() == 0) {
+ return;
+ }
+ MISession mi = target.getMISession();
+ CommandFactory factory = mi.getCommandFactory();
+ MIEnvironmentCD cd = factory.createMIEnvironmentCD(wd);
+ try {
+ mi.postCommand(cd);
+ MIInfo info = cd.getMIInfo();
+ if (info == null) {
+ throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_args_target_not_responding")); //$NON-NLS-1$
+ }
+ } catch (MIException e) {
+ throw new CDIException(CdiResources.getString("cdi.RuntimeOptions.Unable_to_set_working_dir") + e.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+}
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 dca33ff371f..40f94397fbf 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
@@ -20,6 +20,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIRuntimeOptions;
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
@@ -751,4 +752,11 @@ public class Target implements ICDITarget {
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager();
return bMgr.createLocation(address);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRuntimeOptions()
+ */
+ public ICDIRuntimeOptions getRuntimeOptions() {
+ return new RuntimeOptions(this);
+ }
}

Back to the top