Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Khouzam2010-05-11 20:21:36 +0000
committerMarc Khouzam2010-05-11 20:21:36 +0000
commita9b247a3f2fbd1eb87dd2c2ab518ebad5b305db0 (patch)
tree3a9ebcf9a7764dcc0e5ef7d23440831d3c4c0b4f
parent8a3597ae0ab2ff8e355888b37f2391ed9aa04e81 (diff)
downloadorg.eclipse.cdt-a9b247a3f2fbd1eb87dd2c2ab518ebad5b305db0.tar.gz
org.eclipse.cdt-a9b247a3f2fbd1eb87dd2c2ab518ebad5b305db0.tar.xz
org.eclipse.cdt-a9b247a3f2fbd1eb87dd2c2ab518ebad5b305db0.zip
Bug 306555: Need extra parens for Cast To Type
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java
index 80a1b250c34..261fbc06374 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java
@@ -29,7 +29,6 @@ import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IExpressions;
import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
-import org.eclipse.cdt.dsf.debug.service.IExpressions2.CastInfo;
import org.eclipse.cdt.dsf.debug.service.IExpressions2.ICastedExpressionDMContext;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues;
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContext;
@@ -650,15 +649,13 @@ public class MIVariableManager implements ICommandControl {
ExpressionInfo[] childrenOfArray = new ExpressionInfo[getNumChildrenHint()];
String exprName = exprDmc.getExpression();
- int castingLength = 0;
int castingIndex = 0;
// in case of casts, need to resolve that before dereferencing, to be safe
if (exprDmc instanceof ICastedExpressionDMContext) {
- CastInfo castInfo = ((ICastedExpressionDMContext)exprDmc).getCastInfo();
- castingLength = castInfo.getArrayCount();
- castingIndex = castInfo.getArrayStartIndex();
- if (castingLength > 0)
- exprName = '(' + exprName + ')';
+ // When casting, if we are dealing with a resulting array, we should surround
+ // it with parenthesis before we subscript it.
+ exprName = '(' + exprName + ')';
+ castingIndex = ((ICastedExpressionDMContext)exprDmc).getCastInfo().getArrayStartIndex();
}
for (int i= 0; i < childrenOfArray.length; i++) {
String fullExpr = exprName + "[" + i + "]";//$NON-NLS-1$//$NON-NLS-2$

Back to the top