1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 09:15:38 +02:00

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.

This commit is contained in:
John Cortell 2007-12-12 16:05:13 +00:00
parent 786fa6383c
commit 4ba7e8ddeb
2 changed files with 29 additions and 8 deletions

View file

@ -30,9 +30,15 @@ public interface ICDITargetConfiguration2 extends ICDITargetConfiguration {
* maintaining its own variable cache and having to keep it in sync with * 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 * 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 * 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(); boolean supportsPassiveVariableUpdate();

View file

@ -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.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; 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.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.ICDITargetConfiguration3;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor; 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) * @see org.eclipse.cdt.debug.core.model.ICVariable#setEnabled(boolean)
*/ */
public void setEnabled( boolean enabled ) throws DebugException { public void setEnabled( boolean enabled ) throws DebugException {
IInternalVariable iv = getOriginal(); // Debugger engines that use active variable objects will benefit
if ( iv != null ) // performance-wise if we dispose the internal variable when it's
iv.dispose( true ); // disabled by the user (it will automatically get lazily recreated if
iv = getShadow(); // it's ever needed again). Engines using passive variables probably
if ( iv != null ) // won't, so we can defer the dispose until we have no use for the
iv.dispose( true ); // 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; fIsEnabled = enabled;
fireChangeEvent( DebugEvent.STATE ); fireChangeEvent( DebugEvent.STATE );
} }