mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[237235] - [commands] CommandCache.isTargetAvailable/setContextAvailable don't work correctly with non-stop multithreading.
This commit is contained in:
parent
8d3e2ae792
commit
e90dbc258a
5 changed files with 25 additions and 14 deletions
|
@ -146,7 +146,7 @@ public class CommandCache implements ICommandListener
|
|||
* created. When the coalesced commands completes the results will be decomposed
|
||||
* when back into individual results from this command.
|
||||
*/
|
||||
private Set<IDMContext> fUnavailableContexts = new HashSet<IDMContext>();
|
||||
private Set<IDMContext> fAvailableContexts = new HashSet<IDMContext>();
|
||||
|
||||
private Map<IDMContext, HashMap<CommandInfo, CommandResultInfo>> fCachedContexts = new HashMap<IDMContext, HashMap<CommandInfo, CommandResultInfo>>();
|
||||
|
||||
|
@ -444,11 +444,11 @@ public class CommandCache implements ICommandListener
|
|||
* TODO
|
||||
*/
|
||||
public void setContextAvailable(IDMContext context, boolean isAvailable) {
|
||||
if (!isAvailable) {
|
||||
fUnavailableContexts.add(context);
|
||||
if (isAvailable) {
|
||||
fAvailableContexts.add(context);
|
||||
} else {
|
||||
fUnavailableContexts.remove(context);
|
||||
for (Iterator<IDMContext> itr = fUnavailableContexts.iterator(); itr.hasNext();) {
|
||||
fAvailableContexts.remove(context);
|
||||
for (Iterator<IDMContext> itr = fAvailableContexts.iterator(); itr.hasNext();) {
|
||||
if (DMContexts.isAncestorOf(itr.next(), context)) {
|
||||
itr.remove();
|
||||
}
|
||||
|
@ -461,9 +461,9 @@ public class CommandCache implements ICommandListener
|
|||
* @see #setContextAvailable(IDMContext, boolean)
|
||||
*/
|
||||
public boolean isTargetAvailable(IDMContext context) {
|
||||
for (IDMContext availableContext : fUnavailableContexts) {
|
||||
for (IDMContext availableContext : fAvailableContexts) {
|
||||
if (context.equals(availableContext) || DMContexts.isAncestorOf(context, availableContext)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.eclipse.dd.dsf.service.AbstractDsfService;
|
|||
import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||
import org.eclipse.dd.mi.service.command.AbstractMIControl;
|
||||
import org.eclipse.dd.mi.service.command.commands.ExprMetaGetAttributes;
|
||||
import org.eclipse.dd.mi.service.command.commands.ExprMetaGetChildCount;
|
||||
import org.eclipse.dd.mi.service.command.commands.ExprMetaGetChildren;
|
||||
|
@ -453,6 +454,8 @@ public class ExpressionService extends AbstractDsfService implements IExpression
|
|||
// Create the meta command cache which will use the variable manager
|
||||
// to actually send MI commands to the back-end
|
||||
fExpressionCache = new CommandCache(getSession(), varManager);
|
||||
AbstractMIControl miControl = getServicesTracker().getService(AbstractMIControl.class);
|
||||
fExpressionCache.setContextAvailable(miControl.getControlDMContext(), true);
|
||||
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
|
|
@ -35,12 +35,12 @@ import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMAddress;
|
|||
import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.StateChangeReason;
|
||||
import org.eclipse.dd.dsf.debug.service.command.CommandCache;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControl;
|
||||
import org.eclipse.dd.dsf.service.AbstractDsfService;
|
||||
import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||
import org.eclipse.dd.mi.service.ExpressionService.ExpressionChangedEvent;
|
||||
import org.eclipse.dd.mi.service.command.AbstractMIControl;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIDataReadMemory;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIDataWriteMemory;
|
||||
import org.eclipse.dd.mi.service.command.output.MIDataReadMemoryInfo;
|
||||
|
@ -437,7 +437,10 @@ public class MIMemory extends AbstractDsfService implements IMemory {
|
|||
|
||||
public MIMemoryCache() {
|
||||
// Create the command cache
|
||||
fCommandCache = new CommandCache(getSession(), getServicesTracker().getService(ICommandControl.class));
|
||||
AbstractMIControl miControl = getServicesTracker().getService(AbstractMIControl.class);
|
||||
fCommandCache = new CommandCache(getSession(), miControl);
|
||||
fCommandCache.setContextAvailable(miControl.getControlDMContext(), true);
|
||||
|
||||
// Create the memory block cache
|
||||
fMemoryBlockList = new SortedMemoryBlockList();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.dd.dsf.service.AbstractDsfService;
|
|||
import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||
import org.eclipse.dd.mi.service.command.AbstractMIControl;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIDataListRegisterNames;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIDataListRegisterValues;
|
||||
import org.eclipse.dd.mi.service.command.output.MIDataListRegisterNamesInfo;
|
||||
|
@ -170,8 +171,11 @@ public class MIRegisters extends AbstractDsfService implements IRegisters {
|
|||
/*
|
||||
* Create the lower level register cache.
|
||||
*/
|
||||
fRegisterValueCache = new CommandCache(getSession(), getServicesTracker().getService(ICommandControl.class));
|
||||
AbstractMIControl miControl = getServicesTracker().getService(AbstractMIControl.class);
|
||||
fRegisterValueCache = new CommandCache(getSession(), miControl);
|
||||
fRegisterValueCache.setContextAvailable(miControl.getControlDMContext(), true);
|
||||
fRegisterNameCache = new CommandCache(getSession(), getServicesTracker().getService(ICommandControl.class));
|
||||
fRegisterNameCache.setContextAvailable(miControl.getControlDMContext(), true);
|
||||
|
||||
/*
|
||||
* Sign up so we see events. We use these events to decide how to manage
|
||||
|
|
|
@ -24,11 +24,11 @@ import org.eclipse.dd.dsf.datamodel.IDMEvent;
|
|||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.CommandCache;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControl;
|
||||
import org.eclipse.dd.dsf.service.AbstractDsfService;
|
||||
import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||
import org.eclipse.dd.mi.service.command.AbstractMIControl;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIExecContinue;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIExecFinish;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIExecInterrupt;
|
||||
|
@ -257,7 +257,7 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
}
|
||||
}
|
||||
|
||||
private ICommandControl fConnection;
|
||||
private AbstractMIControl fConnection;
|
||||
private CommandCache fMICommandCache;
|
||||
|
||||
// state flags
|
||||
|
@ -286,8 +286,9 @@ public class MIRunControl extends AbstractDsfService implements IRunControl
|
|||
}
|
||||
|
||||
private void doInitialize(final RequestMonitor rm) {
|
||||
fConnection = getServicesTracker().getService(ICommandControl.class);
|
||||
fConnection = getServicesTracker().getService(AbstractMIControl.class);
|
||||
fMICommandCache = new CommandCache(getSession(), fConnection);
|
||||
fMICommandCache.setContextAvailable(fConnection.getControlDMContext(), true);
|
||||
getSession().addServiceEventListener(this, null);
|
||||
|
||||
//register(new String[]{IRunControl.class.getName(), MIRunControl.class.getName()}, new Hashtable<String,String>());
|
||||
|
|
Loading…
Add table
Reference in a new issue