mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +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 = null;
|
||||
} else {
|
||||
// The child already exists so we can re-use it.
|
||||
childVar.hasCastToBaseClassWorkaround = childHasCastToBaseClassWorkaround;
|
||||
if (fakeChild) {
|
||||
// I don't think this should happen, but we put it just in case
|
||||
addRealChildrenOfFake(childVar, exprDmc, realChildren,
|
||||
arrayPosition, countingRm);
|
||||
} else {
|
||||
// This is a real child
|
||||
realChildren[arrayPosition] = new ExpressionInfo[] { childVar.exprInfo };
|
||||
// This is a real child, use it directly, however, we must
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4117,6 +4117,7 @@ public class MIExpressionsTest extends BaseTestCase {
|
|||
|
||||
final String PARENT_EXPR = "b";
|
||||
final String CHILD_EXPR = "((b).d)";
|
||||
final String CHILD__REL_EXPR = "d";
|
||||
|
||||
// Fetch the child directly
|
||||
final IExpressionDMContext childDmc = SyncUtil.createExpression(frameDmc, CHILD_EXPR);
|
||||
|
@ -4154,12 +4155,19 @@ public class MIExpressionsTest extends BaseTestCase {
|
|||
return;
|
||||
}
|
||||
|
||||
IExpressionDMContext firstChildContext = getData()[0];
|
||||
MIExpressionDMC firstChildContext = (MIExpressionDMC)getData()[0];
|
||||
if (firstChildContext.getExpression().equals(CHILD_EXPR) == false) {
|
||||
rm.done(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID,
|
||||
"Got wrong first child. Expected " + CHILD_EXPR + " but got " + firstChildContext.getExpression(), null));
|
||||
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.getFormattedValueContext(firstChildContext, IFormattedValues.NATURAL_FORMAT),
|
||||
new ImmediateDataRequestMonitor<FormattedValueDMData>(rm) {
|
||||
|
|
Loading…
Add table
Reference in a new issue