mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 432888 - Properly update relative expression for existing child
Change-Id: If8cb1884c52366813e9613e4ef5e465db928d4f2 Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com> Reviewed-on: https://git.eclipse.org/r/25306 Tested-by: Hudson CI
This commit is contained in:
parent
283f86d8d9
commit
fa12f215f9
2 changed files with 22 additions and 4 deletions
|
@ -1541,14 +1541,24 @@ public class MIVariableManager implements ICommandControl {
|
||||||
childVar.deleteInGdb();
|
childVar.deleteInGdb();
|
||||||
childVar = null;
|
childVar = null;
|
||||||
} else {
|
} else {
|
||||||
|
// The child already exists so we can re-use it.
|
||||||
childVar.hasCastToBaseClassWorkaround = childHasCastToBaseClassWorkaround;
|
childVar.hasCastToBaseClassWorkaround = childHasCastToBaseClassWorkaround;
|
||||||
if (fakeChild) {
|
if (fakeChild) {
|
||||||
// I don't think this should happen, but we put it just in case
|
// I don't think this should happen, but we put it just in case
|
||||||
addRealChildrenOfFake(childVar, exprDmc, realChildren,
|
addRealChildrenOfFake(childVar, exprDmc, realChildren,
|
||||||
arrayPosition, countingRm);
|
arrayPosition, countingRm);
|
||||||
} else {
|
} else {
|
||||||
// This is a real child
|
// This is a real child, use it directly, however, we must
|
||||||
realChildren[arrayPosition] = new ExpressionInfo[] { childVar.exprInfo };
|
// make sure that its relative expression is expressed with respect
|
||||||
|
// to its parent, which may not be the case already, since that child
|
||||||
|
// might have been created directly (not through the parent).
|
||||||
|
// That is why we set the relative expression explicitly
|
||||||
|
// See bug 432888
|
||||||
|
ExpressionInfo oldInfo = childVar.getExpressionInfo();
|
||||||
|
realChildren[arrayPosition] =
|
||||||
|
new ExpressionInfo[] { new ExpressionInfo(
|
||||||
|
oldInfo.getFullExpr(), child.getExp(), oldInfo.isDynamic(),
|
||||||
|
oldInfo.getParent(), oldInfo.getIndexInParentExpression()) };
|
||||||
countingRm.done();
|
countingRm.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4117,6 +4117,7 @@ public class MIExpressionsTest extends BaseTestCase {
|
||||||
|
|
||||||
final String PARENT_EXPR = "b";
|
final String PARENT_EXPR = "b";
|
||||||
final String CHILD_EXPR = "((b).d)";
|
final String CHILD_EXPR = "((b).d)";
|
||||||
|
final String CHILD__REL_EXPR = "d";
|
||||||
|
|
||||||
// Fetch the child directly
|
// Fetch the child directly
|
||||||
final IExpressionDMContext childDmc = SyncUtil.createExpression(frameDmc, CHILD_EXPR);
|
final IExpressionDMContext childDmc = SyncUtil.createExpression(frameDmc, CHILD_EXPR);
|
||||||
|
@ -4154,12 +4155,19 @@ public class MIExpressionsTest extends BaseTestCase {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IExpressionDMContext firstChildContext = getData()[0];
|
MIExpressionDMC firstChildContext = (MIExpressionDMC)getData()[0];
|
||||||
if (firstChildContext.getExpression().equals(CHILD_EXPR) == false) {
|
if (firstChildContext.getExpression().equals(CHILD_EXPR) == false) {
|
||||||
rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
|
rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
|
||||||
"Got wrong first child. Expected " + CHILD_EXPR + " but got " + firstChildContext.getExpression(), null));
|
"Got wrong first child. Expected " + CHILD_EXPR + " but got " + firstChildContext.getExpression(), null));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (firstChildContext.getRelativeExpression().equals(CHILD__REL_EXPR) == false) {
|
||||||
|
rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
|
||||||
|
"Got wrong relative expression. Expected " + CHILD__REL_EXPR + " but got " + firstChildContext.getRelativeExpression(), null));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fExpService.getFormattedExpressionValue(
|
fExpService.getFormattedExpressionValue(
|
||||||
fExpService.getFormattedValueContext(firstChildContext, IFormattedValues.NATURAL_FORMAT),
|
fExpService.getFormattedValueContext(firstChildContext, IFormattedValues.NATURAL_FORMAT),
|
||||||
new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
|
new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue