Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Cortell2007-12-12 16:05:13 +0000
committerJohn Cortell2007-12-12 16:05:13 +0000
commit4ba7e8ddeb7364394494310cc73597ba134d42b1 (patch)
tree7422cc47c8e86cae847ada4de2dc89d247514a3c /debug/org.eclipse.cdt.debug.core
parent786fa6383cef37c06b5bab95758d72a470c23ead (diff)
downloadorg.eclipse.cdt-4ba7e8ddeb7364394494310cc73597ba134d42b1.tar.gz
org.eclipse.cdt-4ba7e8ddeb7364394494310cc73597ba134d42b1.tar.xz
org.eclipse.cdt-4ba7e8ddeb7364394494310cc73597ba134d42b1.zip
When the user disables a variable, don't dispose the CDI variable for targets (engines) that use passive variables. The dispose is only there for performance reasons, and it's not needed with passive variables.
Diffstat (limited to 'debug/org.eclipse.cdt.debug.core')
-rw-r--r--debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration2.java10
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java27
2 files changed, 29 insertions, 8 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration2.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration2.java
index 5ae1cb042b1..09a50345f41 100644
--- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration2.java
+++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration2.java
@@ -30,9 +30,15 @@ public interface ICDITargetConfiguration2 extends ICDITargetConfiguration {
* maintaining its own variable cache and having to keep it in sync with
* CDT's. Targets that support this feature will need to be able to detect
* when a variable value has changed and fire a changedEvent in its
- * implementation of ICDIValue.getValueString().
+ * implementation of ICDIValue.getValueString().
*
- * @return whether this target supports passive variable updating.
+ * Also, targets that support this feature will not have their variables
+ * disposed when the user disables them in the GUI. Such a dispose only
+ * serves to reduce step-time overhead in the debugger engine. As such
+ * overhead is negligible for engines with passive variables, the dispose
+ * is unnecessary.
+ *
+ * @return whether this target supports passive variable updating.
*/
boolean supportsPassiveVariableUpdate();
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java
index 5a2ad5a2b17..4c1ab6f4fd0 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java
@@ -21,6 +21,8 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
+import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration;
+import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration2;
import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration3;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor;
@@ -142,12 +144,25 @@ public abstract class CVariable extends AbstractCVariable implements ICDIEventLi
* @see org.eclipse.cdt.debug.core.model.ICVariable#setEnabled(boolean)
*/
public void setEnabled( boolean enabled ) throws DebugException {
- IInternalVariable iv = getOriginal();
- if ( iv != null )
- iv.dispose( true );
- iv = getShadow();
- if ( iv != null )
- iv.dispose( true );
+ // Debugger engines that use active variable objects will benefit
+ // performance-wise if we dispose the internal variable when it's
+ // disabled by the user (it will automatically get lazily recreated if
+ // it's ever needed again). Engines using passive variables probably
+ // won't, so we can defer the dispose until we have no use for the
+ // variable altogether.
+ boolean disposeVariable = true;
+ ICDITargetConfiguration configuration = getParent().getCDITarget().getConfiguration();
+ if (configuration instanceof ICDITargetConfiguration2) {
+ disposeVariable = !((ICDITargetConfiguration2)configuration).supportsPassiveVariableUpdate();
+ }
+ if (disposeVariable) {
+ IInternalVariable iv = getOriginal();
+ if ( iv != null )
+ iv.dispose( true );
+ iv = getShadow();
+ if ( iv != null )
+ iv.dispose( true );
+ }
fIsEnabled = enabled;
fireChangeEvent( DebugEvent.STATE );
}

Back to the top