diff options
author | John Cortell | 2007-02-02 17:00:57 +0000 |
---|---|---|
committer | John Cortell | 2007-02-02 17:00:57 +0000 |
commit | 254fd3131ec639c7ef202c511f7ce290ed9820f7 (patch) | |
tree | 034527dfccd37adb85d06d16be552cb40d4d2819 /debug | |
parent | 705e64de6c265a340eb48f7c1b30e2160a7f7b2d (diff) | |
download | org.eclipse.cdt-254fd3131ec639c7ef202c511f7ce290ed9820f7.tar.gz org.eclipse.cdt-254fd3131ec639c7ef202c511f7ce290ed9820f7.tar.xz org.eclipse.cdt-254fd3131ec639c7ef202c511f7ce290ed9820f7.zip |
Resolution for 172508. Update all variables and registers on the receipt of a memory changed event (if the backend wishes so).
Diffstat (limited to 'debug')
3 files changed, 65 insertions, 5 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration3.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration3.java new file mode 100644 index 00000000000..8bc524ea2e7 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITargetConfiguration3.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2007 Freescale Semiconductor and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Freescale Semiconductor - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.core.cdi.model; + +import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; + +public interface ICDITargetConfiguration3 extends ICDITargetConfiguration2 { + + /** + * It may be desirable to update all variables when a certain event occurs. + * For example, some CDI clients may want all variabless updated when memory + * is changed (when an ICDIMemoryChangedEvent is received) because it's + * impractical or impossible for those backends to determine what specific + * variables the memory change affected. + * + * CDT will call this method to determine desired behavior for a limited set + * of event types. The CDI backend should not expect to use this hook as a + * general control mechanism for when variables are updated. + * + * @return Whether the value for all active variables should be invalidated + * and re-fetched from the CDI backend on the occurence of the given + * event + */ + boolean needsVariablesUpdated(ICDIEvent event); + + /** + * Same idea as needsRegistersUpdated() but for registers. Embedded systems + * often have memory mapped registers; changing bytes in memory might, in + * effect, change a register value + * + * @return Whether the value for all active registers should be invalidated + * and re-fetched from the CDI backend on the occurence of the given + * event + */ + boolean needsRegistersUpdated(ICDIEvent event); +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java index ff6e7d3518c..1b3f39f5f99 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java @@ -15,12 +15,14 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.ICDebugConstants; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; +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.ICDIArgumentDescriptor; import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; +import org.eclipse.cdt.debug.core.cdi.model.ICDITargetConfiguration3; import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor; @@ -366,14 +368,20 @@ public class CRegister extends CVariable implements IRegister { public void handleDebugEvents( ICDIEvent[] events ) { for( int i = 0; i < events.length; i++ ) { ICDIEvent event = events[i]; - if ( event instanceof ICDIResumedEvent ) { - ICDIObject source = event.getSource(); - if ( source != null ) { - ICDITarget cdiTarget = source.getTarget(); + ICDIObject source = event.getSource(); + ICDITarget cdiTarget = source.getTarget(); + if (source != null) { + if ( event instanceof ICDIResumedEvent ) { if ( getCDITarget().equals( cdiTarget ) ) { setChanged( false ); } } + else if ( event instanceof ICDIMemoryChangedEvent && + cdiTarget.getConfiguration() instanceof ICDITargetConfiguration3 && + ((ICDITargetConfiguration3)cdiTarget.getConfiguration()).needsRegistersUpdated(event)) { + resetValue(); + return; // avoid similar but logic inappropriate for us in CVariable + } } } super.handleDebugEvents( events ); 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 c91cede0994..cc18c0ae06e 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 @@ -17,9 +17,11 @@ import org.eclipse.cdt.debug.core.ICDebugConstants; import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; +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.ICDITargetConfiguration3; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor; import org.eclipse.cdt.debug.core.model.CVariableFormat; @@ -422,7 +424,12 @@ public abstract class CVariable extends AbstractCVariable implements ICDIEventLi continue; ICDITarget target = source.getTarget(); if ( target.equals( getCDITarget() ) ) { - if ( event instanceof ICDIChangedEvent ) { + if ( event instanceof ICDIMemoryChangedEvent && + target.getConfiguration() instanceof ICDITargetConfiguration3 && + ((ICDITargetConfiguration3)target.getConfiguration()).needsVariablesUpdated(event)) { + resetValue(); + } + else if ( event instanceof ICDIChangedEvent ) { if ( source instanceof ICDIVariable && iv.isSameVariable( (ICDIVariable)source ) ) { handleChangedEvent( (ICDIChangedEvent)event ); } |