mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 04:15:35 +02:00
Resolution for 172508. Update all variables and registers on the receipt of a memory changed event (if the backend wishes so).
This commit is contained in:
parent
705e64de6c
commit
254fd3131e
3 changed files with 65 additions and 5 deletions
|
@ -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);
|
||||
}
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue