1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

[236765] - Additional fixes for use of command cache.

This commit is contained in:
Pawel Piech 2008-06-17 03:46:41 +00:00
parent 25500c44ab
commit a8fe7f6a27
17 changed files with 49 additions and 59 deletions

View file

@ -292,11 +292,7 @@ public class PDAExpressions extends AbstractDsfService implements IExpressions {
// Send the command to evaluate the variable. // Send the command to evaluate the variable.
fCommandCache.execute( fCommandCache.execute(
new PDAVarCommand( new PDAVarCommand(threadCtx, frameId, exprCtx.getExpression()),
fCommandControl.getVirtualMachineDMContext(),
threadCtx.getID(),
frameId,
exprCtx.getExpression()),
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) { new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
@ -331,12 +327,7 @@ public class PDAExpressions extends AbstractDsfService implements IExpressions {
// Send the "write" command to PDA debugger // Send the "write" command to PDA debugger
fCommandCache.execute( fCommandCache.execute(
new PDASetVarCommand( new PDASetVarCommand( threadCtx, frameId, exprCtx.getExpression(), exprValue),
fCommandControl.getVirtualMachineDMContext(),
threadCtx.getID(),
frameId,
exprCtx.getExpression(),
exprValue),
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) { new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {

View file

@ -530,7 +530,7 @@ public class PDARunControl extends AbstractDsfService
final PDAThreadDMContext threadCtx = (PDAThreadDMContext)context; final PDAThreadDMContext threadCtx = (PDAThreadDMContext)context;
fThreads.get(threadCtx.getID()).fResumePending = true; fThreads.get(threadCtx.getID()).fResumePending = true;
fCommandControl.queueCommand( fCommandControl.queueCommand(
new PDAResumeCommand(fDMContext, threadCtx.getID()), new PDAResumeCommand(threadCtx),
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) { new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
@Override @Override
protected void handleFailure() { protected void handleFailure() {
@ -618,8 +618,8 @@ public class PDARunControl extends AbstractDsfService
AbstractPDACommand<PDACommandResult> stepCommand = AbstractPDACommand<PDACommandResult> stepCommand =
stepType == StepType.STEP_RETURN stepType == StepType.STEP_RETURN
? new PDAStepReturnCommand(fDMContext, threadCtx.getID()) ? new PDAStepReturnCommand(threadCtx)
: new PDAStepCommand(fDMContext, threadCtx.getID()); : new PDAStepCommand(threadCtx);
fCommandControl.queueCommand( fCommandControl.queueCommand(

View file

@ -232,7 +232,7 @@ public class PDAStack extends AbstractDsfService implements IStack {
// Execute the PDA stack command, or retrieve the result from cache if already available. // Execute the PDA stack command, or retrieve the result from cache if already available.
fCommandCache.execute( fCommandCache.execute(
new PDAStackCommand(fCommandControl.getVirtualMachineDMContext(), threadCtx.getID()), new PDAStackCommand(threadCtx),
new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) { new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
@ -268,7 +268,7 @@ public class PDAStack extends AbstractDsfService implements IStack {
// Execute the stack command and create the corresponding frame contexts. // Execute the stack command and create the corresponding frame contexts.
fCommandCache.execute( fCommandCache.execute(
new PDAStackCommand(fCommandControl.getVirtualMachineDMContext(), threadCtx.getID()), new PDAStackCommand(threadCtx),
new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) { new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
@ -300,7 +300,7 @@ public class PDAStack extends AbstractDsfService implements IStack {
} }
fCommandCache.execute( fCommandCache.execute(
new PDAStackCommand(fCommandControl.getVirtualMachineDMContext(), threadCtx.getID()), new PDAStackCommand(threadCtx),
new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) { new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
@ -336,7 +336,7 @@ public class PDAStack extends AbstractDsfService implements IStack {
// Execute stack command and return the data's size. // Execute stack command and return the data's size.
fCommandCache.execute( fCommandCache.execute(
new PDAStackCommand(fCommandControl.getVirtualMachineDMContext(), threadCtx.getID()), new PDAStackCommand(threadCtx),
new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) { new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {

View file

@ -14,7 +14,6 @@ import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.debug.service.command.ICommand; import org.eclipse.dd.dsf.debug.service.command.ICommand;
import org.eclipse.dd.dsf.debug.service.command.ICommandResult; import org.eclipse.dd.dsf.debug.service.command.ICommandResult;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
/** /**
* Base class for PDA commands. The PDA commands consist of a text request and * Base class for PDA commands. The PDA commands consist of a text request and
@ -27,7 +26,7 @@ abstract public class AbstractPDACommand<V extends PDACommandResult> implements
final private IDMContext fContext; final private IDMContext fContext;
final private String fRequest; final private String fRequest;
public AbstractPDACommand(PDAVirtualMachineDMContext context, String request) { public AbstractPDACommand(IDMContext context, String request) {
fContext = context; fContext = context;
fRequest = request; fRequest = request;
} }

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Retrieves data stack information * Retrieves data stack information
@ -27,8 +27,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDADataCommand extends AbstractPDACommand<PDADataCommandResult> { public class PDADataCommand extends AbstractPDACommand<PDADataCommandResult> {
public PDADataCommand(PDAVirtualMachineDMContext context, int threadId) { public PDADataCommand(PDAThreadDMContext thread) {
super(context, "data " + threadId); super(thread, "data " + thread.getID());
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Returns from the current frame without executing the rest of instructions. * Returns from the current frame without executing the rest of instructions.
@ -36,8 +36,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDADropFrameCommand extends AbstractPDACommand<PDACommandResult> { public class PDADropFrameCommand extends AbstractPDACommand<PDACommandResult> {
public PDADropFrameCommand(PDAVirtualMachineDMContext context, int threadId) { public PDADropFrameCommand(PDAThreadDMContext thread) {
super(context, "drop " + threadId); super(thread, "drop " + thread.getID());
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Sets what events cause the execution to stop. * Sets what events cause the execution to stop.
@ -34,8 +34,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDAEvalCommand extends AbstractPDACommand<PDACommandResult> { public class PDAEvalCommand extends AbstractPDACommand<PDACommandResult> {
public PDAEvalCommand(PDAVirtualMachineDMContext context, int threadId, String operation) { public PDAEvalCommand(PDAThreadDMContext thread, String operation) {
super(context, "eval " + threadId + " " + operation); super(thread, "eval " + thread.getID() + " " + operation);
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Pops the top value from the data stack * Pops the top value from the data stack
@ -27,8 +27,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDAPopDataCommand extends AbstractPDACommand<PDACommandResult> { public class PDAPopDataCommand extends AbstractPDACommand<PDACommandResult> {
public PDAPopDataCommand(PDAVirtualMachineDMContext context, int threadId) { public PDAPopDataCommand(PDAThreadDMContext thread) {
super(context, "popdata " + threadId); super(thread, "popdata " + thread.getID());
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Pushes the given value on top of the data stack. * Pushes the given value on top of the data stack.
@ -27,8 +27,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDAPushDataCommand extends AbstractPDACommand<PDACommandResult> { public class PDAPushDataCommand extends AbstractPDACommand<PDACommandResult> {
public PDAPushDataCommand(PDAVirtualMachineDMContext context, int threadId, int value) { public PDAPushDataCommand(PDAThreadDMContext thread, int value) {
super(context, "pushdata " + threadId + " " + value); super(thread, "pushdata " + thread.getID() + " " + value);
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Resumes the execution of a single thread. Can be issued only if the virtual * Resumes the execution of a single thread. Can be issued only if the virtual
@ -31,8 +31,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDAResumeCommand extends AbstractPDACommand<PDACommandResult> { public class PDAResumeCommand extends AbstractPDACommand<PDACommandResult> {
public PDAResumeCommand(PDAVirtualMachineDMContext context, int threadId) { public PDAResumeCommand(PDAThreadDMContext thread) {
super(context, "resume " + threadId); super(thread, "resume " + thread.getID());
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Sets a data value in the data stack at the given location * Sets a data value in the data stack at the given location
@ -27,8 +27,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDASetDataCommand extends AbstractPDACommand<PDACommandResult> { public class PDASetDataCommand extends AbstractPDACommand<PDACommandResult> {
public PDASetDataCommand(PDAVirtualMachineDMContext context, int threadId, int index, String value) { public PDASetDataCommand(PDAThreadDMContext thread, int index, String value) {
super(context, "setdata " + threadId + " " + index + " " + value); super(thread, "setdata " + thread.getID() + " " + index + " " + value);
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Sets a variable value * Sets a variable value
@ -27,8 +27,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDASetVarCommand extends AbstractPDACommand<PDACommandResult> { public class PDASetVarCommand extends AbstractPDACommand<PDACommandResult> {
public PDASetVarCommand(PDAVirtualMachineDMContext context, int threadId, int frame, String variable, String value) { public PDASetVarCommand(PDAThreadDMContext thread, int frame, String variable, String value) {
super(context, "setvar " + threadId + " " + frame + " " + variable + " " + value); super(thread, "setvar " + thread.getID() + " " + frame + " " + variable + " " + value);
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Retrieves command stack information * Retrieves command stack information
@ -27,8 +27,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDAStackCommand extends AbstractPDACommand<PDAStackCommandResult> { public class PDAStackCommand extends AbstractPDACommand<PDAStackCommandResult> {
public PDAStackCommand(PDAVirtualMachineDMContext context, int threadId) { public PDAStackCommand(PDAThreadDMContext thread) {
super(context, "stack " + threadId); super(thread, "stack " + thread.getID());
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Executes next instruction * Executes next instruction
@ -36,8 +36,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDAStepCommand extends AbstractPDACommand<PDACommandResult> { public class PDAStepCommand extends AbstractPDACommand<PDACommandResult> {
public PDAStepCommand(PDAVirtualMachineDMContext context, int threadId) { public PDAStepCommand(PDAThreadDMContext thread) {
super(context, "step " + threadId); super(thread, "step " + thread.getID());
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Executes instructions until the current subroutine is finished * Executes instructions until the current subroutine is finished
@ -36,8 +36,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDAStepReturnCommand extends AbstractPDACommand<PDACommandResult> { public class PDAStepReturnCommand extends AbstractPDACommand<PDACommandResult> {
public PDAStepReturnCommand(PDAVirtualMachineDMContext context, int threadId) { public PDAStepReturnCommand(PDAThreadDMContext thread) {
super(context, "stepreturn " + threadId); super(thread, "stepreturn " + thread.getID());
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Suspends execution of a single thread. Can be issued only if the virtual * Suspends execution of a single thread. Can be issued only if the virtual
@ -31,8 +31,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDASuspendCommand extends AbstractPDACommand<PDACommandResult> { public class PDASuspendCommand extends AbstractPDACommand<PDACommandResult> {
public PDASuspendCommand(PDAVirtualMachineDMContext context, int threadId) { public PDASuspendCommand(PDAThreadDMContext thread) {
super(context, "suspend " + threadId); super(thread, "suspend " + thread.getID());
} }
@Override @Override

View file

@ -11,7 +11,7 @@
package org.eclipse.dd.examples.pda.service.commands; package org.eclipse.dd.examples.pda.service.commands;
import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.Immutable;
import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext; import org.eclipse.dd.examples.pda.service.PDAThreadDMContext;
/** /**
* Retrieves variable value * Retrieves variable value
@ -28,8 +28,8 @@ import org.eclipse.dd.examples.pda.service.PDAVirtualMachineDMContext;
@Immutable @Immutable
public class PDAVarCommand extends AbstractPDACommand<PDACommandResult> { public class PDAVarCommand extends AbstractPDACommand<PDACommandResult> {
public PDAVarCommand(PDAVirtualMachineDMContext context, int threadId, int frameId, String name) { public PDAVarCommand(PDAThreadDMContext thread, int frameId, String name) {
super(context, "var " + threadId + " " + frameId + " " + name); super(thread, "var " + thread.getID() + " " + frameId + " " + name);
} }
@Override @Override