Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Khodjaiants2010-01-08 10:59:47 +0000
committerMikhail Khodjaiants2010-01-08 10:59:47 +0000
commit1e262f08ea2af40192c64138b75727e1be97795b (patch)
tree22f7032cc51fc4a5473b8ad045c17203e5c7963b
parentabf0bf05a39aac41da0cc675f377a192a4d443ba (diff)
downloadorg.eclipse.cdt-1e262f08ea2af40192c64138b75727e1be97795b.tar.gz
org.eclipse.cdt-1e262f08ea2af40192c64138b75727e1be97795b.tar.xz
org.eclipse.cdt-1e262f08ea2af40192c64138b75727e1be97795b.zip
Bug 250037 - Debug value view fails to update 'Value' column.
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdate.java47
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdateInfo.java131
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java11
3 files changed, 189 insertions, 0 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdate.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdate.java
new file mode 100644
index 00000000000..3500c3cd72e
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdate.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * Marc-Andre Laperle - patch for bug #250037
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.core.command.factories.macos;
+
+import org.eclipse.cdt.debug.mi.core.MIException;
+import org.eclipse.cdt.debug.mi.core.command.MIVarUpdate;
+import org.eclipse.cdt.debug.mi.core.output.MIInfo;
+import org.eclipse.cdt.debug.mi.core.output.MIOutput;
+
+/**
+ *@see MIVarUpdate
+ *
+ * Apple gdb needs special handling for MIVarUpdateInfo so we need this class
+ * to override getMIInfo to return a MacOSMIVarUpdateInfo instead
+ */
+class MacOSMIVarUpdate extends MIVarUpdate {
+
+ public MacOSMIVarUpdate(String miVersion) {
+ super(miVersion);
+ }
+
+ public MacOSMIVarUpdate(String miVersion, String name) {
+ super(miVersion, name);
+ }
+
+ public MIInfo getMIInfo() throws MIException {
+ MIInfo info = null;
+ MIOutput out = getMIOutput();
+ if (out != null) {
+ info = new MacOSMIVarUpdateInfo(out);
+ if (info.isError()) {
+ throwMIException(info, out);
+ }
+ }
+ return info;
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdateInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdateInfo.java
new file mode 100644
index 00000000000..f1f353b8ccc
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/MacOSMIVarUpdateInfo.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 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
+ * Marc-Andre Laperle - patch for bug #250037
+ *******************************************************************************/
+package org.eclipse.cdt.debug.mi.core.command.factories.macos;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.cdt.debug.mi.core.output.MIConst;
+import org.eclipse.cdt.debug.mi.core.output.MIList;
+import org.eclipse.cdt.debug.mi.core.output.MIOutput;
+import org.eclipse.cdt.debug.mi.core.output.MIResult;
+import org.eclipse.cdt.debug.mi.core.output.MIResultRecord;
+import org.eclipse.cdt.debug.mi.core.output.MITuple;
+import org.eclipse.cdt.debug.mi.core.output.MIValue;
+import org.eclipse.cdt.debug.mi.core.output.MIVarChange;
+import org.eclipse.cdt.debug.mi.core.output.MIVarUpdateInfo;
+
+/**
+ * GDB/MI var-update for Apple gdb
+ * -var-update *
+ * ^done,changelist=[varobj={name="var1",in_scope="true",type_changed="false"}],time={.....}
+ */
+class MacOSMIVarUpdateInfo extends MIVarUpdateInfo {
+
+ MIVarChange[] changeList;
+
+ public MacOSMIVarUpdateInfo(MIOutput record) {
+ super(record);
+ parse();
+ }
+
+ public MIVarChange[] getMIVarChanges() {
+ return changeList;
+ }
+
+ void parse() {
+ List aList = new ArrayList();
+ if (isDone()) {
+ MIOutput out = getMIOutput();
+ MIResultRecord rr = out.getMIResultRecord();
+ if (rr != null) {
+ MIResult[] results = rr.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("changelist")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MITuple) {
+ parseChangeList((MITuple)value, aList);
+ } else if (value instanceof MIList) {
+ parseChangeList((MIList)value, aList);
+ }
+ }
+ }
+ }
+ }
+ changeList = (MIVarChange[])aList.toArray(new MIVarChange[aList.size()]);
+ }
+
+ /**
+ * For MI2 the format is now a MIList.
+ * @param tuple
+ * @param aList
+ */
+ void parseChangeList(MIList miList, List aList) {
+ MIValue[] values = miList.getMIValues();
+ for (int i = 0; i < values.length; ++i) {
+ if (values[i] instanceof MITuple) {
+ parseChangeList((MITuple)values[i], aList);
+ } else if (values[i] instanceof MIList) {
+ parseChangeList((MIList)values[i], aList);
+ }
+ }
+
+ // The MIList in Apple gdb contains MIResults instead of MIValues. It looks like:
+ // ^done,changelist=[varobj={name="var1",in_scope="true",type_changed="false"}],time={.....}
+ // Bug 250037
+ MIResult[] results = miList.getMIResults();
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ if (var.equals("varobj")) { //$NON-NLS-1$
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MITuple) {
+ parseChangeList((MITuple) value, aList);
+ } else if (value instanceof MIList) {
+ parseChangeList((MIList) value, aList);
+ }
+ }
+ }
+ }
+
+ void parseChangeList(MITuple tuple, List aList) {
+ MIResult[] results = tuple.getMIResults();
+ MIVarChange change = null;
+ for (int i = 0; i < results.length; i++) {
+ String var = results[i].getVariable();
+ MIValue value = results[i].getMIValue();
+ if (value instanceof MITuple) {
+ parseChangeList((MITuple)value, aList);
+ }
+ else
+ {
+ String str = ""; //$NON-NLS-1$
+ if (value instanceof MIConst) {
+ str = ((MIConst)value).getString();
+ }
+ if (var.equals("name")) { //$NON-NLS-1$
+ change = new MIVarChange(str);
+ aList.add(change);
+ } else if (var.equals("in_scope")) { //$NON-NLS-1$
+ if (change != null) {
+ change.setInScope("true".equals(str)); //$NON-NLS-1$
+ }
+ } else if (var.equals("type_changed")) { //$NON-NLS-1$
+ if (change != null) {
+ change.setChanged("true".equals(str)); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java
index a794356e8fe..f2b4065d382 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/factories/macos/StandardMacOSCommandFactory.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Nokia - Initial API and implementation
+ * Marc-Andre Laperle - patch for bug #250037
*******************************************************************************/
package org.eclipse.cdt.debug.mi.core.command.factories.macos;
@@ -14,6 +15,7 @@ import java.io.File;
import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentCD;
import org.eclipse.cdt.debug.mi.core.command.MIInfoSharedLibrary;
+import org.eclipse.cdt.debug.mi.core.command.MIVarUpdate;
import org.eclipse.cdt.debug.mi.core.command.factories.StandardCommandFactory;
public class StandardMacOSCommandFactory extends StandardCommandFactory {
@@ -44,4 +46,13 @@ public class StandardMacOSCommandFactory extends StandardCommandFactory {
return new MIInfoSharedLibrary(getMIVersion());
}
+ public MIVarUpdate createMIVarUpdate() {
+ return new MacOSMIVarUpdate(getMIVersion());
+ }
+
+ public MIVarUpdate createMIVarUpdate(String name) {
+ return new MacOSMIVarUpdate(getMIVersion(), name);
+ }
+
+
}

Back to the top