cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IExpressions.java
changeset 129 723898599d35
parent 105 fbceb3d6fb44
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IExpressions.java	Tue Dec 15 14:25:31 2009 -0600
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IExpressions.java	Tue Jan 12 07:49:28 2010 -0600
@@ -11,8 +11,10 @@
  *******************************************************************************/
 package org.eclipse.cdt.dsf.debug.service;
 
+import java.math.BigInteger;
 import java.util.Map;
 
+import org.eclipse.cdt.core.IAddress;
 import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
 import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
 import org.eclipse.cdt.dsf.datamodel.IDMContext;
@@ -40,14 +42,61 @@
          */
         String getExpression();
     }
-    
+
+
     /**
      * The address and size of an expression.
      */
     public interface IExpressionDMAddress {
-    	Object getAddress();
+        
+        /**
+         * Returns the address of the expression.
+         */
+    	IAddress getAddress();
+    	
+    	/**
+    	 * Returns the size of the address.
+    	 */
     	int getSize();
     }
+ 
+    /**
+     * A representation of an expression location that does not correspond to 
+     * an address.  
+     * 
+     * @since 2.1
+     */
+    public interface IExpressionDMLocation extends IExpressionDMAddress {
+        
+        /**
+         * A constant that can be returned by {@link IExpressionDMAddress#getAddress()}
+         * to represent an invalid address.  Implementations of 
+         * <code>IExpressionDMLocation</code> can return this constant if no  
+         * valid address can be returned for a given expression location.  
+         */
+        public static final IAddress INVALID_ADDRESS = new IAddress() {
+            public IAddress add(BigInteger offset) { return this; }
+            public IAddress add(long offset) { return this; }
+            public BigInteger getMaxOffset() { return BigInteger.ZERO; }
+            public BigInteger distanceTo(IAddress other) { return BigInteger.ZERO; }
+            public BigInteger getValue() { return BigInteger.ZERO; }
+            public boolean isZero() { return false; }
+            public boolean isMax() { return false; }
+            public String toString(int radix) { return "INVALID"; }
+            public String toHexAddressString() { return toString(); }
+            public String toBinaryAddressString()  { return toString(); }
+            public int getCharsNum() { return 0; }
+            public int getSize() { return 0; }
+            public int compareTo(Object o) { return 0; }
+        };
+        
+        /**
+         * Returns a string representation of the expression location.
+         */
+    	public String getLocation();
+    }
+
+    
     
     /**
      * This is the model data interface that corresponds to IExpressionDMContext.
@@ -139,7 +188,9 @@
     /**
      * Retrieves the address and size of an expression given by the expression context(<tt>dmc</tt>).
      * Non-lvalues do not have an addresses (e.g., "x + 5").  When the expression
--    * has no address, the data request monitor will contain null.
+-    * has no address, the request monitor will have an error with code 
+     * <code>IDsfStatusConstants.REQUEST_FAILED</code> and the data request
+     * monitor will contain null.
      * 
      * @param dmc
      *            The ExpressionDMC for the expression
@@ -157,14 +208,18 @@
      *                
      * @param expression: The expression to evaluate.
      * 
-     * @return  An expression data model context object that must be passed to 
-     * getModelData() to obtain the value of the expression. 
+     * @return  An expression data model context object that must be passed to the appropriate
+     *          data retrieval routine to obtain the value of the expression.
      */
     IExpressionDMContext createExpression(IDMContext ctx, String expression);
 
     /**
      * Retrieves the 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.
+     * <br> 
+     * Note: Clients may call this method on any valid expression context, and before calling any other
+     * method to evaluate the expression value.  It is up to the implementation to internally evaluate the 
+     * expression if needed, in order to calculate sub expressions.    
      * 
      * @param exprCtx: The data model context representing an expression.
      * 
@@ -176,6 +231,10 @@
      * 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.
+     * <br> 
+     * Note: Clients may call this method on any valid expression context, and before calling any other
+     * method to evaluate the expression value.  It is up to the implementation to internally evaluate the 
+     * expression if needed, in order to calculate sub expressions.    
      * 
      * @param exprCtx: The data model context representing an expression.
      *        startIndex: Index of the first sub-expression to retrieve
@@ -190,6 +249,10 @@
     /**
      * 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.
+     * <br> 
+     * Note: Clients may call this method on any valid expression context, and before calling any other
+     * method to evaluate the expression value.  It is up to the implementation to internally evaluate the 
+     * expression if needed, in order to calculate sub expressions.    
      * 
      * @param exprCtx: The data model context representing an expression.
      * 
@@ -201,6 +264,10 @@
     /**
      * For object oriented languages, this method returns the expressions representing base types of
      * the given expression type.
+     * <br> 
+     * Note: Clients may call this method on any valid expression context, and before calling any other
+     * method to evaluate the expression value.  It is up to the implementation to internally evaluate the 
+     * expression if needed, in order to calculate sub expressions.    
      * 
      * @param exprContext: The data model context representing an expression.
      *