Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Re: [cdt-debug-dev] More Debugger Array Viewing Changes...

> 
> Hi,
> 
> Given GDB performance, we saw CDT start to time out on large array 
> requests. The following patch corrects this by scaling the time out with 
> the number of children being retrieved. I have not looked at the head on 
> this so your mileage may vary. On 1.0.1 with this and the MIParser change 
> you can open 16k arrays. I decided the value of testing larger sizes was 
> not worth it. :)
> 
> I should mention that there appears to be a bug / lack of feature in 
> VariablesViewContentProvider.getChildren(). It's my personal opinion that 
> it should use BusyIndicator and a runnable so that an hourglass icon pops 
> up for these long fetches. There's really no good place to put it lower in 
> the call chain. It is reasonable to want to look at a 4k array. There is a 
> noticeable pause for this, it should be covered with an hourglass but 
> there's really no way to hook it.
> 

Agreed, this is one reason why the patch was not applied.  For very big
arrays(if the request is done in the UI thread) we go behind the user
and change the settings ... uncool.

The code in the head branch is now trying to do some parsing and finding
the type i.e int, struct, enum ... so we can now isolate this for
arrays only.

FYI, knowing the type of the variable was necessary for the UI to do
some pretty printing and formating.

The patch is in and hopefully for the future we could have some
sort of progress monitor that would let the user cancel long actions. 

==========================================================================
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.147
diff -u -r1.147 ChangeLog
--- ChangeLog	10 Jul 2003 19:25:41 -0000	1.147
+++ ChangeLog	16 Jul 2003 19:04:54 -0000
@@ -1,3 +1,23 @@
+2003-07-16 Alain Magloire
+
+	Provide FunctionValue, PointerValue and ArrayValue.
+	For ArrayValue apply the patch from Chris Songer, excerpt from
+	his email:
+		Given GDB performance, we saw CDT start to time out on large array 
+ 		requests. The following patch corrects this by scaling the time out with 
+		the number of children being retrieved. I have not looked at the head on 
+		this so your mileage may vary. On 1.0.1 with this and the MIParser change 
+		you can open 16k arrays.
+
+	* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateValue.java
+	* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedValue.java
+	* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java
+	* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValueValue.java
+	* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java
+	* src/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructValue.java
+	* src/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java
+	* src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
+
 2003-07-10 Alain Magloire
 
 	In the case of not having a PTY to unmixed inferior output from gdb commands
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java,v
retrieving revision 1.6
diff -u -r1.6 Value.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java	12 Feb 2003 05:24:58 -0000	1.6
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/Value.java	16 Jul 2003 19:04:54 -0000
@@ -19,7 +19,7 @@
  */
 public class Value extends CObject implements ICDIValue {
 
-	Variable variable;
+	protected Variable variable;
 
 	public Value(Variable v) {
 		super(v.getTarget());
@@ -86,6 +86,7 @@
 	*/
 		return (getChildrenNumber() > 0);	
 	}
+
 	/**
 	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getVariables()
 	 */
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java,v
retrieving revision 1.13
diff -u -r1.13 Variable.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java	19 Jun 2003 03:38:37 -0000	1.13
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java	16 Jul 2003 19:04:54 -0000
@@ -35,11 +35,13 @@
 import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
 import org.eclipse.cdt.debug.mi.core.cdi.Session;
 import org.eclipse.cdt.debug.mi.core.cdi.SourceManager;
+import org.eclipse.cdt.debug.mi.core.cdi.model.type.ArrayValue;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.BoolValue;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.CharValue;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.DoubleValue;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.EnumValue;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.FloatValue;
+import org.eclipse.cdt.debug.mi.core.cdi.model.type.FunctionValue;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.IncompleteType;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.IntValue;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.LongLongValue;
@@ -47,6 +49,7 @@
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.PointerValue;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.ReferenceValue;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.ShortValue;
+import org.eclipse.cdt.debug.mi.core.cdi.model.type.StructValue;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.Type;
 import org.eclipse.cdt.debug.mi.core.cdi.model.type.WCharValue;
 import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
@@ -101,13 +104,22 @@
 	}
 
 	public ICDIVariable[] getChildren() throws CDIException {
+		// Use the default timeout.
+		return getChildren(-1);
+	}
+
+	public ICDIVariable[] getChildren(int timeout) throws CDIException {
 		Session session = (Session)(getTarget().getSession());
 		MISession mi = session.getMISession();
 		CommandFactory factory = mi.getCommandFactory();
 		MIVarListChildren var =
 			factory.createMIVarListChildren(getMIVar().getVarName());
 		try {
-			mi.postCommand(var);
+			if (timeout >= 0) {
+				mi.postCommand(var, timeout);
+			} else {
+				mi.postCommand(var);
+			}
 			MIVarListChildrenInfo info = var.getMIVarListChildrenInfo();
 			if (info == null) {
 				throw new CDIException("No answer");
@@ -172,21 +184,15 @@
 			} else if (t instanceof ICDIDoubleType) {
 				value = new DoubleValue(this);
 			} else if (t instanceof ICDIFunctionType) {
-				//value = new FunctionValue(this);
-				value = new Value(this);
+				value = new FunctionValue(this);
 			} else if (t instanceof ICDIPointerType) {
-				//((ICDIPointerType)t).getComponentType();
 				value = new PointerValue(this);
-				//value = new Value(this);
 			} else if (t instanceof ICDIReferenceType) {
 				value = new ReferenceValue(this);
 			} else if (t instanceof ICDIArrayType) {
-				//((ICDIArrayType)t).getComponentType();
-				//value = new ArrayValue(this);
-				value = new Value(this);
+				value = new ArrayValue(this);
 			} else if (t instanceof ICDIStructType) {
-				//value = new StructValue(this);	
-				value = new Value(this);
+				value = new StructValue(this);	
 			} else {
 				value = new Value(this);
 			}
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateValue.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateValue.java
diff -N src/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateValue.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/type/AggregateValue.java	16 Jul 2003 19:04:54 -0000
@@ -0,0 +1,19 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ * 
+ */
+package org.eclipse.cdt.debug.mi.core.cdi.model.type;
+
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIAggregateValue;
+import org.eclipse.cdt.debug.mi.core.cdi.model.Value;
+import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
+
+/**
+ */
+public abstract class AggregateValue extends Value implements ICDIAggregateValue {
+
+	public AggregateValue(Variable v) {
+		super(v);
+	}
+}
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java
diff -N src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java	16 Jul 2003 19:04:54 -0000
@@ -0,0 +1,41 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ * 
+ */
+
+package org.eclipse.cdt.debug.mi.core.cdi.model.type;
+
+import org.eclipse.cdt.debug.core.cdi.CDIException;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue;
+import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
+
+/**
+ * Enter type comment.
+ * 
+ * @since Jun 3, 2003
+ */
+public class ArrayValue extends DerivedValue implements ICDIArrayValue {
+
+	public ArrayValue(Variable v) {
+		super(v);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getVariables()
+	 */
+	public ICDIVariable[] getVariables() throws CDIException {
+
+		/* GDB is appallingly slow on array fetches. As as slow as 128 entries
+		 * per second on NT gdbs with slow processors. We need to set a timeout
+		 * that's appropraitely scaled by number of children to give the slave
+		 * GDB time to respond. In the end perhaps we want a UI for this. As it 
+		 * is, let's just make up a number that's 5 seconds for us plus one 
+		 * second for every 128 entries. */
+		int timeout = variable.getMIVar().getNumChild() * 8 + 5000;
+
+		return variable.getChildren(timeout);
+	}
+
+}
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedValue.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedValue.java
diff -N src/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedValue.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/type/DerivedValue.java	16 Jul 2003 19:04:54 -0000
@@ -0,0 +1,20 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ * 
+ */
+package org.eclipse.cdt.debug.mi.core.cdi.model.type;
+
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDerivedValue;
+import org.eclipse.cdt.debug.mi.core.cdi.model.Value;
+import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
+
+/**
+ */
+public abstract class DerivedValue extends Value implements ICDIDerivedValue {
+
+	public DerivedValue(Variable v) {
+		super(v);
+	}
+
+}
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FunctionValue.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FunctionValue.java
diff -N src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FunctionValue.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/type/FunctionValue.java	16 Jul 2003 19:04:54 -0000
@@ -0,0 +1,22 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ * 
+ */
+
+package org.eclipse.cdt.debug.mi.core.cdi.model.type;
+
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFunctionValue;
+import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
+
+/**
+ * Enter type comment.
+ * 
+ * @since Jun 3, 2003
+ */
+public class FunctionValue extends DerivedValue implements ICDIFunctionValue {
+
+	public FunctionValue(Variable v) {
+		super(v);
+	}
+}
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java,v
retrieving revision 1.1
diff -u -r1.1 PointerValue.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java	4 Jun 2003 16:13:35 -0000	1.1
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java	16 Jul 2003 19:04:54 -0000
@@ -8,7 +8,6 @@
 
 import org.eclipse.cdt.debug.core.cdi.CDIException;
 import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue;
-import org.eclipse.cdt.debug.mi.core.cdi.model.Value;
 import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
 
 /**
@@ -16,7 +15,7 @@
  * 
  * @since Jun 3, 2003
  */
-public class PointerValue extends Value implements ICDIPointerValue {
+public class PointerValue extends DerivedValue implements ICDIPointerValue {
 
 	public PointerValue(Variable v) {
 		super(v);
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java,v
retrieving revision 1.2
diff -u -r1.2 ReferenceValue.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java	4 Jun 2003 17:41:53 -0000	1.2
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java	16 Jul 2003 19:04:54 -0000
@@ -8,7 +8,6 @@
 
 import org.eclipse.cdt.debug.core.cdi.CDIException;
 import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue;
-import org.eclipse.cdt.debug.mi.core.cdi.model.Value;
 import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
 
 /**
@@ -16,7 +15,7 @@
  * 
  * @since Jun 3, 2003
  */
-public class ReferenceValue extends Value implements ICDIReferenceValue {
+public class ReferenceValue extends DerivedValue implements ICDIReferenceValue {
 
 	/**
 	 * @param v
Index: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructValue.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructValue.java
diff -N src/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructValue.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/mi/core/cdi/model/type/StructValue.java	16 Jul 2003 19:04:54 -0000
@@ -0,0 +1,22 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ * 
+ */
+
+package org.eclipse.cdt.debug.mi.core.cdi.model.type;
+
+import org.eclipse.cdt.debug.core.cdi.model.type.ICDIStructValue;
+import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
+
+/**
+ * Enter type comment.
+ * 
+ * @since Jun 3, 2003
+ */
+public class StructValue extends AggregateValue implements ICDIStructValue {
+
+	public StructValue(Variable v) {
+		super(v);
+	}
+}



Back to the top