diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProviderModelProxyStrategy.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProviderModelProxyStrategy.java index d6c779ef281..173d90d5c77 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProviderModelProxyStrategy.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionVMProviderModelProxyStrategy.java @@ -155,7 +155,10 @@ public class ExpressionVMProviderModelProxyStrategy extends DefaultVMModelProxyS { switch (event.getType()) { case ADDED: - parentDelta.addNode(element, -1, IModelDelta.ADDED); + // New expressions are always added one element before last. + // Last element is the "Add new expression" element. + int parentCount = parentDelta.getChildCount(); + parentDelta.addNode(element, parentCount > 1 ? parentCount - 2 : -1, IModelDelta.ADDED); break; case CHANGED: parentDelta.setFlags(parentDelta.getFlags() | IModelDelta.CONTENT);