From 3b1658988447133e72f890b3426c0b7f586562ac Mon Sep 17 00:00:00 2001 From: Pawel Piech Date: Mon, 10 Sep 2007 21:54:33 +0000 Subject: [PATCH] [187718, 185870] Applied patch simplifying the expressions interface. --- .../variable/VariableLayoutNode.java | 22 ++------ .../dd/dsf/debug/service/IExpressions.java | 55 ++++++++++++------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/variable/VariableLayoutNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/variable/VariableLayoutNode.java index 3805cf3ffcf..5b3942fa2fc 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/variable/VariableLayoutNode.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/variable/VariableLayoutNode.java @@ -10,7 +10,6 @@ package org.eclipse.dd.dsf.debug.ui.viewmodel.variable; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.eclipse.core.runtime.CoreException; @@ -192,7 +191,7 @@ public class VariableLayoutNode extends AbstractExpressionLayoutNode> rm = - new DataRequestMonitor>(dsfExecutor, null) { + final DataRequestMonitor rm = + new DataRequestMonitor(dsfExecutor, null) { @Override public void handleCompleted() { if (!getStatus().isOK()) { handleFailedUpdate(update); return; } - - // Fill the update with the the IExpressionDMContext objects returned by - // IExpressions.getSubExpressions(). - - List subExpressionDMCList = (List)getData(); - IExpressionDMContext[] subExpressionDMCArray = new IExpressionDMContext[subExpressionDMCList.size()]; - Iterator iter = subExpressionDMCList.iterator(); - - int i = 0; - while (iter.hasNext()) { - subExpressionDMCArray[i++] = iter.next(); - } - - fillUpdateWithVMCs(update, subExpressionDMCArray); + fillUpdateWithVMCs(update, getData()); update.done(); } }; diff --git a/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IExpressions.java b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IExpressions.java index a23ac975104..c959988c262 100644 --- a/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IExpressions.java +++ b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IExpressions.java @@ -29,7 +29,7 @@ import org.eclipse.dd.dsf.datamodel.IDMService; public interface IExpressions extends IDMService, IFormattedValues { /** - * Expression context. Since some expressions have children, expression contexts can be have an + * Expression context. Since some expressions have children, expression contexts can have an * arbitrary number of parents of type IExpressionDMContext. */ public interface IExpressionDMContext extends IFormattedDataDMContext { @@ -37,14 +37,6 @@ public interface IExpressions extends IDMService, IFormattedValues { * Returns a fully qualified expression string represented by this context. This * expression string is the same as the string that is sent to the debug engine to be * evaluated in context of a stack frame, thread, or a symbol context. - * @return - */ - String getQualifiedExpression(); - - /** - * If this expression is a sub-expression of another expression, this method returns - * the expression relative to the parent of this expression. Otherwise this method - * will return the same string as {@link #getQualifiedExpression()}. */ String getExpression(); } @@ -79,9 +71,9 @@ public interface IExpressions extends IDMService, IFormattedValues { } /** - * ISSUE: Should this method be named getExpression() instead? - * - * @return The original expression string that was supplied to IExpressions.createExpression(). + * If this expression is a sub-expression of another expression, this method returns + * the expression relative to the parent of this expression. Otherwise this method + * will return the same string as {@link #getExpression()}. */ String getName(); @@ -113,7 +105,7 @@ public interface IExpressions extends IDMService, IFormattedValues { * of bits in the field. For other types, this is 8 times the number of bytes in the value. */ int getBitCount(); - + /** * @return A string containing the value of the expression as returned by the debugger backend. */ @@ -123,8 +115,6 @@ public interface IExpressions extends IDMService, IFormattedValues { * @return An IAddress object representing the memory address of the value of the expression (if it * has one). Non-lvalues do not have memory addresses (e.g., "x + 5"). When the expression * has no address, this method returns an IAddress object on which isZero() returns true. - * ISSUE: It would be nice if there was a method IAddress.isValid() which could return false - * in this case. */ IAddress getAddress(); @@ -148,10 +138,10 @@ public interface IExpressions extends IDMService, IFormattedValues { interface IExpressionChangedDMEvent extends IDMEvent {} /** - * Returns the data model context object for the specified expression in the context of + * Returns the data model context object for the specified expression in the context * specified by ctx. * - * @param symbolsDmc: Context in which to evaluate the expression. This context could include the + * @param ctx: Context in which to evaluate the expression. This context could include the * PC location, stack frame, thread, or just a symbol context. * * @param expression: The expression to evaluate. @@ -167,11 +157,36 @@ public interface IExpressions extends IDMService, IFormattedValues { * * @param exprCtx: The data model context representing an expression. * - * @param rm: The return parameter is an Iterable because it's possible that the sub-expressions as - * members of an array which could be very large. + * @param rm: Request completion monitor containing an array of all sub-expressions */ - void getSubExpressions(IExpressionDMContext exprCtx, DataRequestMonitor> rm); + void getSubExpressions(IExpressionDMContext exprCtx, DataRequestMonitor rm); + + /** + * Retrieves a particular range of sub-expressions of the given expression. + * Sub-expressions are fields of a struct, union, or class, the enumerators + * of an enumeration, and the element of an array. + * + * @param exprCtx: The data model context representing an expression. + * startIndex: Index of the first sub-expression to retrieve + * length: Total number of sub-expressions to retrieve + * + * @param rm: Request completion monitor containing an array of the requested + * range of sub-expressions + */ + void getSubExpressions(IExpressionDMContext exprCtx, int startIndex, int length, + DataRequestMonitor rm); + /** + * Retrieves the number of sub-expressions of the given expression. Sub-expressions are fields of a struct, union, + * or class, the enumerators of an enumeration, and the element of an array. + * + * @param exprCtx: The data model context representing an expression. + * + * @param rm: Request completion monitor containing the number of sub-expressions + * of the specified expression + */ + void getSubExpressionCount(IExpressionDMContext exprCtx, DataRequestMonitor rm); + /** * For object oriented languages, this method returns the expressions representing base types of * the given expression type.