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:
parent
786fa6383c
commit
4ba7e8ddeb
2 changed files with 29 additions and 8 deletions
|
@ -32,7 +32,13 @@ public interface ICDITargetConfiguration2 extends ICDITargetConfiguration {
|
|||
* when a variable value has changed and fire a changedEvent in its
|
||||
* 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();
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue