mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[216854] Completed features for EclipseCon tutorial.
This commit is contained in:
parent
886229a1a9
commit
1416e8c3e9
47 changed files with 780 additions and 424 deletions
|
@ -169,7 +169,7 @@ public class PDAPlugin extends Plugin {
|
|||
Query<Object> launchShutdownQuery = new Query<Object>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<Object> rm) {
|
||||
pdaLaunch.shutdownSession(rm);
|
||||
pdaLaunch.shutdownServices(rm);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class PDALineBreakpoint extends LineBreakpoint {
|
|||
public PDALineBreakpoint(final IResource resource, final int lineNumber) throws CoreException {
|
||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint");
|
||||
IMarker marker = resource.createMarker("org.eclipse.dd.examples.pda.markerType.lineBreakpoint");
|
||||
setMarker(marker);
|
||||
marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
|
||||
marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
|
||||
|
|
|
@ -59,7 +59,7 @@ public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint {
|
|||
public PDAWatchpoint(final IResource resource, final int lineNumber, final String functionName, final String varName, final boolean access, final boolean modification) throws CoreException {
|
||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.markerType.watchpoint");
|
||||
IMarker marker = resource.createMarker("org.eclipse.dd.examples.pda.markerType.watchpoint");
|
||||
setMarker(marker);
|
||||
setEnabled(true);
|
||||
ensureMarker().setAttribute(IMarker.LINE_NUMBER, lineNumber);
|
||||
|
|
|
@ -10,18 +10,12 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.launch;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.MultiStatus;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.dd.dsf.concurrent.ConfinedToDsfExecutor;
|
||||
import org.eclipse.dd.dsf.concurrent.DefaultDsfExecutor;
|
||||
import org.eclipse.dd.dsf.concurrent.DsfExecutor;
|
||||
import org.eclipse.dd.dsf.concurrent.DsfRunnable;
|
||||
import org.eclipse.dd.dsf.concurrent.ImmediateExecutor;
|
||||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.dd.dsf.concurrent.Sequence;
|
||||
|
@ -29,7 +23,6 @@ import org.eclipse.dd.dsf.concurrent.ThreadSafe;
|
|||
import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
|
||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.dsf.service.IDsfService;
|
||||
import org.eclipse.dd.examples.pda.PDAPlugin;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDATerminatedEvent;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
|
@ -52,8 +45,9 @@ public class PDALaunch extends Launch
|
|||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||
private DsfServicesTracker fTracker;
|
||||
|
||||
private AtomicBoolean fInitialized = new AtomicBoolean(false);
|
||||
private AtomicBoolean fShutDown = new AtomicBoolean(false);
|
||||
private Sequence fInitializationSequence = null;
|
||||
private boolean fInitialized = false;
|
||||
private boolean fShutDown = false;
|
||||
|
||||
public PDALaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
|
||||
super(launchConfiguration, mode, locator);
|
||||
|
@ -70,42 +64,53 @@ public class PDALaunch extends Launch
|
|||
|
||||
public DsfSession getSession() { return fSession; }
|
||||
|
||||
@ConfinedToDsfExecutor("getExecutor")
|
||||
public void initializeControl()
|
||||
throws CoreException
|
||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||
public void initializeServices(String program, int requestPort, int eventPort, final RequestMonitor rm)
|
||||
{
|
||||
fTracker = new DsfServicesTracker(PDAPlugin.getBundleContext(), fSession.getId());
|
||||
fSession.addServiceEventListener(PDALaunch.this, null);
|
||||
|
||||
Runnable initRunnable = new DsfRunnable() {
|
||||
public void run() {
|
||||
fTracker = new DsfServicesTracker(PDAPlugin.getBundleContext(), fSession.getId());
|
||||
fSession.addServiceEventListener(PDALaunch.this, null);
|
||||
fInitialized.set(true);
|
||||
fireChanged();
|
||||
}
|
||||
};
|
||||
|
||||
// Invoke the execution code and block waiting for the result.
|
||||
try {
|
||||
fExecutor.submit(initRunnable).get();
|
||||
} catch (InterruptedException e) {
|
||||
throw new CoreException(new Status(
|
||||
IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INTERNAL_ERROR, "Error initializing launch", e)); //$NON-NLS-1$
|
||||
} catch (ExecutionException e) {
|
||||
throw new CoreException(new Status(
|
||||
IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INTERNAL_ERROR, "Error initializing launch", e.getCause())); //$NON-NLS-1$
|
||||
synchronized(this) {
|
||||
fInitializationSequence = new PDAServicesInitSequence(
|
||||
getSession(), this, program, requestPort, eventPort,
|
||||
new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
boolean doShutdown = false;
|
||||
synchronized (this)
|
||||
{
|
||||
fInitialized = true;
|
||||
fInitializationSequence = null;
|
||||
if (fShutDown) {
|
||||
doShutdown = true;
|
||||
}
|
||||
}
|
||||
if (doShutdown) {
|
||||
doShutdown(rm);
|
||||
} else {
|
||||
if (getStatus().getSeverity() == IStatus.ERROR) {
|
||||
rm.setStatus(getStatus());
|
||||
}
|
||||
rm.done();
|
||||
}
|
||||
fireChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
getSession().getExecutor().execute(fInitializationSequence);
|
||||
}
|
||||
|
||||
@DsfServiceEventHandler public void eventDispatched(PDATerminatedEvent event) {
|
||||
shutdownSession(new RequestMonitor(ImmediateExecutor.getInstance(), null));
|
||||
@DsfServiceEventHandler
|
||||
public void eventDispatched(PDATerminatedEvent event) {
|
||||
shutdownServices(new RequestMonitor(ImmediateExecutor.getInstance(), null));
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
return fInitialized.get();
|
||||
public synchronized boolean isInitialized() {
|
||||
return fInitialized;
|
||||
}
|
||||
|
||||
public boolean isShutDown() {
|
||||
return fShutDown.get();
|
||||
public synchronized boolean isShutDown() {
|
||||
return fShutDown;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -138,13 +143,27 @@ public class PDALaunch extends Launch
|
|||
* @param rm The request monitor invoked when the shutdown is complete.
|
||||
*/
|
||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||
public void shutdownSession(final RequestMonitor rm) {
|
||||
if (fShutDown.getAndSet(true)) {
|
||||
rm.done();
|
||||
return;
|
||||
public void shutdownServices(final RequestMonitor rm) {
|
||||
boolean doShutdown = false;
|
||||
synchronized (this) {
|
||||
if (!fInitialized && fInitializationSequence != null) {
|
||||
fInitializationSequence.cancel(false);
|
||||
} else {
|
||||
doShutdown = !fShutDown && fInitialized;
|
||||
}
|
||||
fShutDown = true;
|
||||
}
|
||||
|
||||
Sequence shutdownSeq = new PDAServicesShutdownSequence(
|
||||
|
||||
if (doShutdown) {
|
||||
doShutdown(rm);
|
||||
} else {
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||
private void doShutdown(final RequestMonitor rm) {
|
||||
fExecutor.execute( new PDAServicesShutdownSequence(
|
||||
getDsfExecutor(), fSession.getId(),
|
||||
new RequestMonitor(fSession.getExecutor(), rm) {
|
||||
@Override
|
||||
|
@ -166,8 +185,7 @@ public class PDALaunch extends Launch
|
|||
rm.setStatus(getStatus());
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
fExecutor.execute(shutdownSeq);
|
||||
}) );
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -28,6 +28,8 @@ import org.eclipse.core.runtime.Path;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.variables.IValueVariable;
|
||||
import org.eclipse.core.variables.VariablesPlugin;
|
||||
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.dd.dsf.concurrent.Query;
|
||||
import org.eclipse.dd.examples.pda.PDAPlugin;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
|
@ -99,12 +101,8 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
|
|||
}
|
||||
|
||||
launchProcess(launch, program, requestPort, eventPort);
|
||||
|
||||
PDALaunch pdaLaunch = (PDALaunch)launch;
|
||||
|
||||
initServices(pdaLaunch, program, requestPort, eventPort);
|
||||
|
||||
pdaLaunch.initializeControl();
|
||||
}
|
||||
|
||||
private void launchProcess(ILaunch launch, String program, int requestPort, int eventPort) throws CoreException {
|
||||
|
@ -149,12 +147,19 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
|
|||
DebugPlugin.newProcess(launch, process, path);
|
||||
}
|
||||
|
||||
private void initServices(PDALaunch pdaLaunch, String program, int requestPort, int eventPort) throws CoreException {
|
||||
final PDAServicesInitSequence initSequence =
|
||||
new PDAServicesInitSequence(pdaLaunch.getSession(), pdaLaunch, program, requestPort, eventPort);
|
||||
pdaLaunch.getSession().getExecutor().execute(initSequence);
|
||||
private void initServices(final PDALaunch pdaLaunch, final String program, final int requestPort, final int eventPort)
|
||||
throws CoreException
|
||||
{
|
||||
Query<Object> initQuery = new Query<Object>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<Object> rm) {
|
||||
pdaLaunch.initializeServices(program, requestPort, eventPort, rm);
|
||||
}
|
||||
};
|
||||
|
||||
pdaLaunch.getSession().getExecutor().execute(initQuery);
|
||||
try {
|
||||
initSequence.get();
|
||||
initQuery.get();
|
||||
} catch (InterruptedException e1) {
|
||||
throw new DebugException(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, DebugException.INTERNAL_ERROR, "Interrupted Exception in dispatch thread", e1)); //$NON-NLS-1$
|
||||
} catch (ExecutionException e1) {
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.dd.dsf.service.DsfSession;
|
|||
import org.eclipse.dd.examples.pda.service.breakpoints.PDABreakpointAttributeTranslator;
|
||||
import org.eclipse.dd.examples.pda.service.breakpoints.PDABreakpoints;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControl;
|
||||
import org.eclipse.dd.examples.pda.service.expressions.PDAExpressions;
|
||||
import org.eclipse.dd.examples.pda.service.runcontrol.PDARunControl;
|
||||
import org.eclipse.dd.examples.pda.service.stack.PDAStack;
|
||||
import org.eclipse.debug.examples.core.pda.sourcelookup.PDASourceLookupDirector;
|
||||
|
@ -37,7 +38,8 @@ public class PDAServicesInitSequence extends Sequence {
|
|||
new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
new PDARunControl(fSession).initialize(requestMonitor);
|
||||
fRunControl = new PDARunControl(fSession);
|
||||
fRunControl.initialize(requestMonitor);
|
||||
}
|
||||
},
|
||||
new Step() {
|
||||
|
@ -71,38 +73,16 @@ public class PDAServicesInitSequence extends Sequence {
|
|||
new PDAStack(fSession).initialize(requestMonitor);
|
||||
}
|
||||
},
|
||||
/*new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
new ExpressionService(fSession).initialize(requestMonitor);
|
||||
}},
|
||||
new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
fSourceLookup = new CSourceLookup(fSession);
|
||||
fSourceLookup.initialize(requestMonitor);
|
||||
}},
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
new PDAExpressions(fSession).initialize(requestMonitor);
|
||||
}
|
||||
},
|
||||
new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
fSourceLookup.setSourceLookupDirector(
|
||||
fCommandControl.getGDBDMContext(),
|
||||
((CSourceLookupDirector)fLaunch.getSourceLocator()));
|
||||
requestMonitor.done();
|
||||
}},
|
||||
new Step() { @Override
|
||||
public void execute(final RequestMonitor requestMonitor) {
|
||||
// Create high-level breakpoint service and install breakpoints
|
||||
// for the GDB debug context.
|
||||
final MIBreakpointsManager bpmService = new MIBreakpointsManager(fSession, CDebugCorePlugin.PLUGIN_ID);
|
||||
bpmService.initialize(new RequestMonitor(getExecutor(), requestMonitor) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
bpmService.startTrackingBreakpoints(fCommandControl.getGDBDMContext(), requestMonitor);
|
||||
}
|
||||
});
|
||||
}},
|
||||
new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
new MIRegisters(fSession).initialize(requestMonitor);
|
||||
}},*/
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
fRunControl.resume(fCommandControl.getDMContext(), requestMonitor);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
private DsfSession fSession;
|
||||
|
@ -112,12 +92,13 @@ public class PDAServicesInitSequence extends Sequence {
|
|||
private int fEventPort;
|
||||
|
||||
PDACommandControl fCommandControl;
|
||||
PDARunControl fRunControl;
|
||||
PDASourceLookupDirector fSourceLookup;
|
||||
|
||||
public PDAServicesInitSequence(DsfSession session, PDALaunch launch, String program, int requestPort,
|
||||
int eventPort)
|
||||
int eventPort, RequestMonitor rm)
|
||||
{
|
||||
super(session.getExecutor());
|
||||
super(session.getExecutor(), rm);
|
||||
fSession = session;
|
||||
fLaunch = launch;
|
||||
fProgram = program;
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.dd.dsf.service.IDsfService;
|
|||
import org.eclipse.dd.examples.pda.PDAPlugin;
|
||||
import org.eclipse.dd.examples.pda.service.breakpoints.PDABreakpoints;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControl;
|
||||
import org.eclipse.dd.examples.pda.service.expressions.PDAExpressions;
|
||||
import org.eclipse.dd.examples.pda.service.runcontrol.PDARunControl;
|
||||
import org.eclipse.dd.examples.pda.service.stack.PDAStack;
|
||||
|
||||
|
@ -75,12 +76,13 @@ public class PDAServicesShutdownSequence extends Sequence {
|
|||
public void execute(RequestMonitor requestMonitor) {
|
||||
shutdownService(CSourceLookup.class, requestMonitor);
|
||||
}
|
||||
}, new Step() {
|
||||
},*/
|
||||
new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
shutdownService(ExpressionService.class, requestMonitor);
|
||||
shutdownService(PDAExpressions.class, requestMonitor);
|
||||
}
|
||||
},*/
|
||||
},
|
||||
new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
|
|
|
@ -25,9 +25,11 @@ import org.eclipse.dd.dsf.service.DsfSession;
|
|||
import org.eclipse.dd.dsf.service.IDsfService;
|
||||
import org.eclipse.dd.examples.pda.PDAPlugin;
|
||||
import org.eclipse.dd.examples.pda.breakpoints.PDAWatchpoint;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControl;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDAClearBreakpointCommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDASetBreakpointCommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDAWatchCommand;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
|
@ -148,7 +150,7 @@ public class PDABreakpoints extends AbstractDsfService implements IBreakpoints
|
|||
|
||||
fBreakpoints.add(breakpointCtx);
|
||||
fCommandControl.queueCommand(
|
||||
new PDACommand(fCommandControl.getDMContext(), "set " + line),
|
||||
new PDASetBreakpointCommand(fCommandControl.getDMContext(), line),
|
||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
|
@ -191,20 +193,18 @@ public class PDABreakpoints extends AbstractDsfService implements IBreakpoints
|
|||
return;
|
||||
}
|
||||
|
||||
int watchOperation = 0;
|
||||
PDAWatchCommand.WatchOperation watchOperation = PDAWatchCommand.WatchOperation.NONE;
|
||||
if (isAccess && isModification) {
|
||||
watchOperation = 3;
|
||||
watchOperation = PDAWatchCommand.WatchOperation.BOTH;
|
||||
} else if (isAccess) {
|
||||
watchOperation = 1;
|
||||
watchOperation = PDAWatchCommand.WatchOperation.READ;
|
||||
} else if (isModification) {
|
||||
watchOperation = 2;
|
||||
watchOperation = PDAWatchCommand.WatchOperation.WRITE;
|
||||
}
|
||||
|
||||
String watchCommand = "watch " + function + "::" + variable + " " + watchOperation;
|
||||
|
||||
fBreakpoints.add(watchpointCtx);
|
||||
fCommandControl.queueCommand(
|
||||
new PDACommand(fCommandControl.getDMContext(), watchCommand),
|
||||
new PDAWatchCommand(fCommandControl.getDMContext(), function, variable, watchOperation),
|
||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
|
@ -244,7 +244,7 @@ public class PDABreakpoints extends AbstractDsfService implements IBreakpoints
|
|||
fBreakpoints.remove(bpCtx);
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
new PDACommand(fCommandControl.getDMContext(), "clear " + bpCtx.fLine),
|
||||
new PDAClearBreakpointCommand(fCommandControl.getDMContext(), bpCtx.fLine),
|
||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
||||
}
|
||||
|
||||
|
@ -252,9 +252,9 @@ public class PDABreakpoints extends AbstractDsfService implements IBreakpoints
|
|||
fBreakpoints.remove(bpCtx);
|
||||
|
||||
// Watchpoints are cleared using the same command, but with a "no watch" operation
|
||||
String command = "watch " + bpCtx.fFunction + "::" + bpCtx.fVariable + " 0";
|
||||
fCommandControl.queueCommand(
|
||||
new PDACommand(fCommandControl.getDMContext(), command),
|
||||
new PDAWatchCommand(fCommandControl.getDMContext(), bpCtx.fFunction, bpCtx.fVariable,
|
||||
PDAWatchCommand.WatchOperation.NONE),
|
||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,7 @@ import org.eclipse.dd.dsf.service.AbstractDsfService;
|
|||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.dsf.service.IDsfService;
|
||||
import org.eclipse.dd.examples.pda.PDAPlugin;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDACommandBase;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDACommandBaseResult;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.AbstractPDACommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDAExitCommand;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
|
@ -45,10 +44,10 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon
|
|||
|
||||
// Structure used to store command information in services internal queues.
|
||||
private static class CommandHandle {
|
||||
final private PDACommandBase<PDACommandBaseResult> fCommand;
|
||||
final private DataRequestMonitor<PDACommandBaseResult> fRequestMonitor;
|
||||
final private AbstractPDACommand<PDACommandResult> fCommand;
|
||||
final private DataRequestMonitor<PDACommandResult> fRequestMonitor;
|
||||
|
||||
CommandHandle(PDACommandBase<PDACommandBaseResult> c, DataRequestMonitor<PDACommandBaseResult> rm) {
|
||||
CommandHandle(AbstractPDACommand<PDACommandResult> c, DataRequestMonitor<PDACommandResult> rm) {
|
||||
fCommand = c;
|
||||
fRequestMonitor = rm;
|
||||
}
|
||||
|
@ -300,16 +299,16 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon
|
|||
}
|
||||
|
||||
public <V extends ICommandResult> void queueCommand(ICommand<V> command, DataRequestMonitor<V> rm) {
|
||||
if (command instanceof PDACommandBase<?>) {
|
||||
if (command instanceof AbstractPDACommand<?>) {
|
||||
// Cast from command with "<V extends ICommandResult>" to a more concrete
|
||||
// type to use internally in the command control.
|
||||
@SuppressWarnings("unchecked")
|
||||
PDACommandBase<PDACommandBaseResult> pdaCommand = (PDACommandBase<PDACommandBaseResult>)command;
|
||||
AbstractPDACommand<PDACommandResult> pdaCommand = (AbstractPDACommand<PDACommandResult>)command;
|
||||
|
||||
// Similarly, cast the request monitor to a more concrete type.
|
||||
@SuppressWarnings("unchecked")
|
||||
DataRequestMonitor<PDACommandBaseResult> pdaRM = (DataRequestMonitor<PDACommandBaseResult>)rm;
|
||||
|
||||
DataRequestMonitor<PDACommandResult> pdaRM = (DataRequestMonitor<PDACommandResult>)rm;
|
||||
|
||||
fCommandQueue.add( new CommandHandle(pdaCommand, pdaRM) );
|
||||
for (ICommandListener listener : fCommandListeners) {
|
||||
listener.commandQueued(command);
|
||||
|
@ -362,9 +361,9 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon
|
|||
}
|
||||
|
||||
private void processCommandDone(CommandHandle handle, String response) {
|
||||
PDAPlugin.debug(response);
|
||||
PDAPlugin.debug("R: " + response);
|
||||
|
||||
PDACommandBaseResult result = handle.fCommand.createResult(response);
|
||||
PDACommandResult result = handle.fCommand.createResult(response);
|
||||
handle.fRequestMonitor.setData(result);
|
||||
handle.fRequestMonitor.done();
|
||||
|
||||
|
@ -385,7 +384,7 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon
|
|||
}
|
||||
|
||||
private void processEventReceived(String event) {
|
||||
PDAPlugin.debug(event);
|
||||
PDAPlugin.debug("E: " + event);
|
||||
for (IEventListener listener : fEventListeners) {
|
||||
listener.eventReceived(event);
|
||||
}
|
||||
|
@ -408,7 +407,7 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon
|
|||
// - and there are commands waiting to be sent.
|
||||
CommandHandle handle = fCommandQueue.remove(0);
|
||||
fTxCommands.add(handle);
|
||||
PDAPlugin.debug(handle.fCommand.getRequest());
|
||||
PDAPlugin.debug("C: " + handle.fCommand.getRequest());
|
||||
for (ICommandListener listener : fCommandListeners) {
|
||||
listener.commandSent(handle.fCommand);
|
||||
}
|
||||
|
@ -468,7 +467,7 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon
|
|||
if (!isTerminated()) {
|
||||
queueCommand(
|
||||
new PDAExitCommand(fDMContext),
|
||||
new DataRequestMonitor<PDACommandBaseResult>(getExecutor(), rm));
|
||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
||||
} else {
|
||||
// If already terminated, indicate success.
|
||||
rm.done();
|
||||
|
|
|
@ -10,14 +10,36 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command;
|
||||
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDACommandBaseResult;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommand;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandResult;
|
||||
|
||||
|
||||
/**
|
||||
* @see PDACommand
|
||||
*
|
||||
*/
|
||||
public class PDACommandResult extends PDACommandBaseResult {
|
||||
PDACommandResult(String response) {
|
||||
super(response);
|
||||
public class PDACommandResult implements ICommandResult {
|
||||
|
||||
final public String fResponseText;
|
||||
|
||||
public PDACommandResult(String response) {
|
||||
fResponseText = response;
|
||||
}
|
||||
|
||||
public <V extends ICommandResult> V getSubsetResult(ICommand<V> command) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof PDACommandResult) {
|
||||
PDACommandResult result = (PDACommandResult)obj;
|
||||
return fResponseText.equals(result.fResponseText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return fResponseText.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,16 +13,18 @@ package org.eclipse.dd.examples.pda.service.command.commands;
|
|||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommand;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandResult;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract public class PDACommandBase<V extends PDACommandBaseResult> implements ICommand<V> {
|
||||
abstract public class AbstractPDACommand<V extends PDACommandResult> implements ICommand<V> {
|
||||
|
||||
final private IDMContext fContext;
|
||||
final private String fRequest;
|
||||
|
||||
public PDACommandBase(IDMContext context, String request) {
|
||||
public AbstractPDACommand(PDACommandControlDMContext context, String request) {
|
||||
fContext = context;
|
||||
fRequest = request;
|
||||
}
|
||||
|
@ -43,8 +45,8 @@ abstract public class PDACommandBase<V extends PDACommandBaseResult> implements
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof PDACommandBase) {
|
||||
PDACommandBase<?> cmd = (PDACommandBase<?>)obj;
|
||||
if (obj instanceof AbstractPDACommand) {
|
||||
AbstractPDACommand<?> cmd = (AbstractPDACommand<?>)obj;
|
||||
return fContext.equals(cmd.fContext) && fRequest.equals(cmd.fRequest);
|
||||
}
|
||||
return false;
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Clears any breakpoint set on given line
|
||||
|
@ -21,14 +22,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* </pre>
|
||||
|
||||
*/
|
||||
public class PDAClearBreakpointCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAClearBreakpointCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDAClearBreakpointCommand(IDMContext context, int line) {
|
||||
super(context, "clear " + line);
|
||||
public PDAClearBreakpointCommand(PDACommandControlDMContext context, int line) {
|
||||
super(context, "clear " + (line - 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Wind River Systems 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:
|
||||
* Wind River Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommand;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandResult;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class PDACommandBaseResult implements ICommandResult {
|
||||
|
||||
final public String fResponseText;
|
||||
|
||||
protected PDACommandBaseResult(String response) {
|
||||
fResponseText = response;
|
||||
}
|
||||
|
||||
public <V extends ICommandResult> V getSubsetResult(ICommand<V> command) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof PDACommandBaseResult) {
|
||||
PDACommandBaseResult result = (PDACommandBaseResult)obj;
|
||||
return fResponseText.equals(result.fResponseText);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return fResponseText.hashCode();
|
||||
}
|
||||
}
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Retrieves data stack information
|
||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* R: {value 1}|{value 2}|{value 3}|...|
|
||||
* </pre>
|
||||
*/
|
||||
public class PDADataCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDADataCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDADataCommand(IDMContext context) {
|
||||
public PDADataCommand(PDACommandControlDMContext context) {
|
||||
super(context, "data");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,12 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* @see PDADataCommand
|
||||
*/
|
||||
public class PDADataCommandResult extends PDACommandBaseResult {
|
||||
public class PDADataCommandResult extends PDACommandResult {
|
||||
|
||||
final public int[] fValues;
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Returns from the current frame without executing the rest of instructions.
|
||||
|
@ -23,14 +24,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* </pre>
|
||||
|
||||
*/
|
||||
public class PDADropFrameCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDADropFrameCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDADropFrameCommand(IDMContext context) {
|
||||
public PDADropFrameCommand(PDACommandControlDMContext context) {
|
||||
super(context, "drop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Sets what events cause the execution to stop.
|
||||
|
@ -25,14 +26,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
*
|
||||
* Where event_name could be <code>unimpinstr</code> or <code>nosuchlabel</code>.
|
||||
*/
|
||||
public class PDAEvalCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAEvalCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDAEvalCommand(IDMContext context, String operation) {
|
||||
public PDAEvalCommand(PDACommandControlDMContext context, String operation) {
|
||||
super(context, "eval " + operation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Sets what events cause the execution to stop.
|
||||
|
@ -24,11 +25,11 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
*
|
||||
* Where event_name could be <code>unimpinstr</code> or <code>nosuchlabel</code>.
|
||||
*/
|
||||
public class PDAEventStopCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAEventStopCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public enum Event { UNIMPINSTR, NOSUCHLABEL };
|
||||
|
||||
public PDAEventStopCommand(IDMContext context, Event event, boolean enable) {
|
||||
public PDAEventStopCommand(PDACommandControlDMContext context, Event event, boolean enable) {
|
||||
super(context,
|
||||
"eventstop " +
|
||||
(event == Event.UNIMPINSTR ? "unimpinstr " : "nosuchlabel ") +
|
||||
|
@ -36,7 +37,7 @@ public class PDAEventStopCommand extends PDACommandBase<PDACommandBaseResult> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Instructs the debugger to exit.
|
||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* R: ok
|
||||
* </pre>
|
||||
*/
|
||||
public class PDAExitCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAExitCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDAExitCommand(IDMContext context) {
|
||||
public PDAExitCommand(PDACommandControlDMContext context) {
|
||||
super(context, "exit");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems 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:
|
||||
* Wind River Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
public class PDAFrame {
|
||||
PDAFrame(String frameString) {
|
||||
StringTokenizer st = new StringTokenizer(frameString, "|");
|
||||
|
||||
fFilePath = new Path(st.nextToken());
|
||||
fLine = Integer.parseInt(st.nextToken());
|
||||
fFunction = st.nextToken();
|
||||
|
||||
List<String> variablesList = new ArrayList<String>();
|
||||
while (st.hasMoreTokens()) {
|
||||
variablesList.add(st.nextToken());
|
||||
}
|
||||
fVariables = variablesList.toArray(new String[variablesList.size()]);
|
||||
}
|
||||
final public IPath fFilePath;
|
||||
final public int fLine;
|
||||
final public String fFunction;
|
||||
final public String[] fVariables;
|
||||
}
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Pops the top value from the data stack
|
||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* R: ok
|
||||
* </pre>
|
||||
*/
|
||||
public class PDAPopDataCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAPopDataCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDAPopDataCommand(IDMContext context) {
|
||||
public PDAPopDataCommand(PDACommandControlDMContext context) {
|
||||
super(context, "popdata");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Pushes the given value on top of the data stack.
|
||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* R: ok
|
||||
* </pre>
|
||||
*/
|
||||
public class PDAPushDataCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAPushDataCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDAPushDataCommand(IDMContext context, int value) {
|
||||
public PDAPushDataCommand(PDACommandControlDMContext context, int value) {
|
||||
super(context, "pushdata " + value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Resumes the execution
|
||||
|
@ -21,14 +22,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* E: resumed client
|
||||
* </pre>
|
||||
*/
|
||||
public class PDAResumeCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAResumeCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDAResumeCommand(IDMContext context) {
|
||||
public PDAResumeCommand(PDACommandControlDMContext context) {
|
||||
super(context, "resume");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Sets a breakpoint at given line
|
||||
|
@ -23,14 +24,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* E: suspended breakpoint line_number
|
||||
* </pre>
|
||||
*/
|
||||
public class PDASetBreakpointCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDASetBreakpointCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDASetBreakpointCommand(IDMContext context, int line) {
|
||||
super(context, "set " + line);
|
||||
public PDASetBreakpointCommand(PDACommandControlDMContext context, int line) {
|
||||
super(context, "set " + (line - 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Sets a data value in the data stack at the given location
|
||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* R: ok
|
||||
* </pre>
|
||||
*/
|
||||
public class PDASetDataCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDASetDataCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDASetDataCommand(IDMContext context, int index, int value) {
|
||||
public PDASetDataCommand(PDACommandControlDMContext context, int index, int value) {
|
||||
super(context, "setdata " + index + " " + value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Sets a variable value
|
||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* R: ok
|
||||
* </pre>
|
||||
*/
|
||||
public class PDASetVarCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDASetVarCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDASetVarCommand(IDMContext context, String variable, int value) {
|
||||
public PDASetVarCommand(PDACommandControlDMContext context, String variable, String value) {
|
||||
super(context, "setvar " + variable + " " + value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
|
||||
/**
|
||||
* Retrieves command stack information
|
||||
|
@ -20,14 +20,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* R: {file}|{line}|{function}|{var_1}|{var_2}|...#{file}|{line}|{function}|{var_1}|{var_2}|...#...
|
||||
* </pre>
|
||||
*/
|
||||
public class PDAStackCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAStackCommand extends AbstractPDACommand<PDAStackCommandResult> {
|
||||
|
||||
public PDAStackCommand(IDMContext context) {
|
||||
public PDAStackCommand(PDACommandControlDMContext context) {
|
||||
super(context, "stack");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDAStackCommandResult createResult(String resultText) {
|
||||
return new PDAStackCommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,44 +14,23 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* @see PDAStackCommand
|
||||
*/
|
||||
public class PDAStackCommandResult extends PDACommandBaseResult {
|
||||
public class PDAStackCommandResult extends PDACommandResult {
|
||||
|
||||
public static class Frame {
|
||||
Frame(String frameString) {
|
||||
StringTokenizer st = new StringTokenizer(frameString, "|");
|
||||
|
||||
fFilePath = new Path(st.nextToken());
|
||||
fLine = Integer.parseInt(st.nextToken());
|
||||
fFunction = st.nextToken();
|
||||
|
||||
List<String> variablesList = new ArrayList<String>();
|
||||
while (st.hasMoreTokens()) {
|
||||
variablesList.add(st.nextToken());
|
||||
}
|
||||
fVariables = variablesList.toArray(new String[variablesList.size()]);
|
||||
}
|
||||
final public IPath fFilePath;
|
||||
final public int fLine;
|
||||
final public String fFunction;
|
||||
final public String[] fVariables;
|
||||
}
|
||||
|
||||
final public Frame[] fFrames;
|
||||
final public PDAFrame[] fFrames;
|
||||
|
||||
PDAStackCommandResult(String response) {
|
||||
super(response);
|
||||
StringTokenizer st = new StringTokenizer(response, "#");
|
||||
List<Frame> framesList = new ArrayList<Frame>();
|
||||
List<PDAFrame> framesList = new ArrayList<PDAFrame>();
|
||||
|
||||
while (st.hasMoreTokens()) {
|
||||
framesList.add(new Frame(st.nextToken()));
|
||||
framesList.add(new PDAFrame(st.nextToken()));
|
||||
}
|
||||
fFrames = framesList.toArray(new Frame[framesList.size()]);
|
||||
fFrames = framesList.toArray(new PDAFrame[framesList.size()]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Executes next instruciton
|
||||
|
@ -22,14 +23,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* E: suspended step
|
||||
* </pre>
|
||||
*/
|
||||
public class PDAStepCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAStepCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDAStepCommand(IDMContext context) {
|
||||
public PDAStepCommand(PDACommandControlDMContext context) {
|
||||
super(context, "step");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Executes instructions until the current subroutine is finished
|
||||
|
@ -22,14 +23,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* E: suspended step
|
||||
* </pre>
|
||||
*/
|
||||
public class PDAStepReturnCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAStepReturnCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDAStepReturnCommand(IDMContext context) {
|
||||
public PDAStepReturnCommand(PDACommandControlDMContext context) {
|
||||
super(context, "stepreturn");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Suspends execution
|
||||
|
@ -21,14 +22,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* E: suspended client
|
||||
* </pre>
|
||||
*/
|
||||
public class PDASuspendCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDASuspendCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDASuspendCommand(IDMContext context) {
|
||||
public PDASuspendCommand(PDACommandControlDMContext context) {
|
||||
super(context, "suspend");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Retrieves variable value
|
||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* R: {variable_value}
|
||||
* </pre>
|
||||
*/
|
||||
public class PDAVarCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAVarCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public PDAVarCommand(IDMContext context, int frame, String name) {
|
||||
super(context, "var " + frame + " " + name);
|
||||
public PDAVarCommand(PDACommandControlDMContext context, int frameId, String name) {
|
||||
super(context, "var " + frameId + " " + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,13 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
|
||||
/**
|
||||
* @see PDAVarCommand
|
||||
*/
|
||||
public class PDAVarCommandResult extends PDACommandBaseResult {
|
||||
public class PDAVarCommandResult extends PDACommandResult {
|
||||
|
||||
final public int fValue;
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
|
||||
/**
|
||||
* Sets a watchpoint on a given variable
|
||||
|
@ -23,7 +24,7 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
|||
* E: suspended watch {watch_operation} {function}::{variable_name}
|
||||
* </pre>
|
||||
*/
|
||||
public class PDAWatchCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||
public class PDAWatchCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
|
||||
public enum WatchOperation { READ, WRITE, BOTH, NONE };
|
||||
|
||||
|
@ -40,12 +41,12 @@ public class PDAWatchCommand extends PDACommandBase<PDACommandBaseResult> {
|
|||
}
|
||||
}
|
||||
|
||||
public PDAWatchCommand(IDMContext context, String function, String variable, WatchOperation operation) {
|
||||
public PDAWatchCommand(PDACommandControlDMContext context, String function, String variable, WatchOperation operation) {
|
||||
super(context, "watch " + function+ "::" + variable + " " + getWatchOperationCode(operation));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PDACommandBaseResult createResult(String resultText) {
|
||||
return new PDACommandBaseResult(resultText);
|
||||
public PDACommandResult createResult(String resultText) {
|
||||
return new PDACommandResult(resultText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems 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:
|
||||
* Wind River Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.expressions;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ExpressionDMContext extends AbstractDMContext implements IExpressionDMContext {
|
||||
|
||||
private final String fExpression;
|
||||
|
||||
ExpressionDMContext(String sessionId, IFrameDMContext frameDmc, String expressin) {
|
||||
super(sessionId, new IDMContext[] { frameDmc });
|
||||
fExpression = expressin;
|
||||
}
|
||||
|
||||
public String getExpression() {
|
||||
return fExpression;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return super.baseEquals(other) && ((ExpressionDMContext)other).fExpression.equals(fExpression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.baseHashCode() + fExpression.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return baseToString() + ".expression(" + fExpression + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems 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:
|
||||
* Wind River Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.expressions;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMData;
|
||||
import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterDMContext;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ExpressionDMData implements IExpressionDMData {
|
||||
|
||||
final private String fExpression;
|
||||
|
||||
public ExpressionDMData(String expression) {
|
||||
fExpression = expression;
|
||||
}
|
||||
|
||||
public BasicType getBasicType() {
|
||||
return BasicType.basic;
|
||||
}
|
||||
|
||||
public String getEncoding() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getEnumerations() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return fExpression;
|
||||
}
|
||||
|
||||
public IRegisterDMContext getRegister() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getStringValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getTypeId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems 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:
|
||||
* Wind River Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.expressions;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMContext;
|
||||
|
||||
class InvalidExpressionDMContext extends AbstractDMContext
|
||||
implements IExpressionDMContext
|
||||
{
|
||||
private final String expression;
|
||||
|
||||
public InvalidExpressionDMContext(String sessionId, IDMContext parent, String expr) {
|
||||
super(sessionId, new IDMContext[] { parent });
|
||||
expression = expr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return super.baseEquals(other) &&
|
||||
expression == null
|
||||
? ((InvalidExpressionDMContext) other).getExpression() == null
|
||||
: expression.equals(((InvalidExpressionDMContext) other).getExpression());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return expression == null ? super.baseHashCode() : super.baseHashCode() ^ expression.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return baseToString() + ".invalid_expr[" + expression + "]"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
public String getExpression() {
|
||||
return expression;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,224 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems 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:
|
||||
* Wind River Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.expressions;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IExpressions;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IResumedDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.ISuspendedDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.StateChangeReason;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.CommandCache;
|
||||
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.examples.pda.PDAPlugin;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControl;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDASetVarCommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDAVarCommand;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class PDAExpressions extends AbstractDsfService implements IExpressions {
|
||||
|
||||
private PDACommandControl fCommandControl;
|
||||
private IStack fStack;
|
||||
|
||||
private CommandCache fCommandCache;
|
||||
|
||||
public PDAExpressions(DsfSession session) {
|
||||
super(session);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BundleContext getBundleContext() {
|
||||
return PDAPlugin.getBundleContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(final RequestMonitor rm) {
|
||||
super.initialize(
|
||||
new RequestMonitor(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
doInitialize(rm);
|
||||
}});
|
||||
}
|
||||
|
||||
private void doInitialize(final RequestMonitor rm) {
|
||||
fCommandControl = getServicesTracker().getService(PDACommandControl.class);
|
||||
fStack = getServicesTracker().getService(IStack.class);
|
||||
fCommandCache = new CommandCache(fCommandControl);
|
||||
|
||||
getSession().addServiceEventListener(this, null);
|
||||
|
||||
register(new String[]{IExpressions.class.getName(), PDAExpressions.class.getName()}, new Hashtable<String,String>());
|
||||
|
||||
rm.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown(final RequestMonitor rm) {
|
||||
getSession().removeServiceEventListener(this);
|
||||
fCommandCache.reset();
|
||||
super.shutdown(rm);
|
||||
}
|
||||
|
||||
public void canWriteExpression(IExpressionDMContext expressionContext, DataRequestMonitor<Boolean> rm) {
|
||||
rm.setData(true);
|
||||
rm.done();
|
||||
}
|
||||
|
||||
public IExpressionDMContext createExpression(IDMContext ctx, String expression) {
|
||||
IFrameDMContext frameCtx = DMContexts.getAncestorOfType(ctx, IFrameDMContext.class);
|
||||
if (frameCtx != null) {
|
||||
return new ExpressionDMContext(getSession().getId(), frameCtx, expression);
|
||||
} else {
|
||||
return new InvalidExpressionDMContext(getSession().getId(), ctx, expression);
|
||||
}
|
||||
}
|
||||
|
||||
public void getBaseExpressions(IExpressionDMContext exprContext, DataRequestMonitor<IExpressionDMContext[]> rm) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
|
||||
public void getExpressionAddressData(IExpressionDMContext dmc, DataRequestMonitor<IExpressionDMAddress> rm) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
|
||||
public void getExpressionData(final IExpressionDMContext exprCtx, final DataRequestMonitor<IExpressionDMData> rm) {
|
||||
if (exprCtx instanceof ExpressionDMContext) {
|
||||
rm.setData(new ExpressionDMData(exprCtx.getExpression()));
|
||||
rm.done();
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid expression context " + exprCtx, null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
||||
public void getSubExpressionCount(IExpressionDMContext exprCtx, DataRequestMonitor<Integer> rm) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
|
||||
public void getSubExpressions(IExpressionDMContext exprCtx, DataRequestMonitor<IExpressionDMContext[]> rm) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
|
||||
public void getSubExpressions(IExpressionDMContext exprCtx, int startIndex, int length,
|
||||
DataRequestMonitor<IExpressionDMContext[]> rm)
|
||||
{
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
|
||||
|
||||
public void writeExpression(IExpressionDMContext exprCtx, String exprValue, String formatId, RequestMonitor rm)
|
||||
{
|
||||
if (exprCtx instanceof ExpressionDMContext) {
|
||||
fCommandCache.execute(
|
||||
new PDASetVarCommand(fCommandControl.getDMContext(), exprCtx.getExpression(), exprValue),
|
||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid expression context " + exprCtx, null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
||||
public void getAvailableFormats(IFormattedDataDMContext dmc, DataRequestMonitor<String[]> rm) {
|
||||
rm.setData(new String[] { NATURAL_FORMAT });
|
||||
rm.done();
|
||||
}
|
||||
|
||||
public FormattedValueDMContext getFormattedValueContext(IFormattedDataDMContext dmc, String formatId) {
|
||||
return new FormattedValueDMContext(this, dmc, formatId);
|
||||
}
|
||||
|
||||
public void getFormattedExpressionValue(FormattedValueDMContext formattedCtx, final DataRequestMonitor<FormattedValueDMData> rm) {
|
||||
final ExpressionDMContext exprCtx = DMContexts.getAncestorOfType(formattedCtx, ExpressionDMContext.class);
|
||||
if (exprCtx != null) {
|
||||
getExpressionValue(
|
||||
exprCtx,
|
||||
new DataRequestMonitor<String>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
rm.setData(new FormattedValueDMData(getData()));
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid expression context " + formattedCtx, null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
||||
private void getExpressionValue(final ExpressionDMContext exprCtx, final DataRequestMonitor<String> rm) {
|
||||
final IFrameDMContext frameCtx = DMContexts.getAncestorOfType(exprCtx, IFrameDMContext.class);
|
||||
fStack.getStackDepth(
|
||||
frameCtx, 0,
|
||||
new DataRequestMonitor<Integer>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
int frameId = getData() - frameCtx.getLevel() - 1;
|
||||
fCommandCache.execute(
|
||||
new PDAVarCommand(fCommandControl.getDMContext(), frameId, exprCtx.getExpression()),
|
||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
rm.setData(getData().fResponseText);
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void getModelData(IDMContext dmc, DataRequestMonitor<?> rm) {
|
||||
if (dmc instanceof IExpressionDMContext) {
|
||||
getExpressionData((IExpressionDMContext) dmc, (DataRequestMonitor<IExpressionDMData>) rm);
|
||||
} else if (dmc instanceof FormattedValueDMContext) {
|
||||
getFormattedExpressionValue((FormattedValueDMContext) dmc, (DataRequestMonitor<FormattedValueDMData>) rm);
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, INVALID_HANDLE, "Unknown DMC type", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
||||
@DsfServiceEventHandler
|
||||
public void eventDispatched(IResumedDMEvent e) {
|
||||
fCommandCache.setTargetAvailable(false);
|
||||
if (!e.getReason().equals(StateChangeReason.STEP)) {
|
||||
fCommandCache.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DsfServiceEventHandler
|
||||
public void eventDispatched(ISuspendedDMEvent e) {
|
||||
fCommandCache.setTargetAvailable(true);
|
||||
fCommandCache.reset();
|
||||
}
|
||||
}
|
|
@ -27,9 +27,11 @@ import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
|
|||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.dsf.service.IDsfService;
|
||||
import org.eclipse.dd.examples.pda.PDAPlugin;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControl;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDAResumeCommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDAStepCommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDASuspendCommand;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
|
||||
|
@ -187,7 +189,7 @@ public class PDARunControl extends AbstractDsfService
|
|||
fCommandCache.setTargetAvailable(false);
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
new PDACommand(fCommandControl.getDMContext(), "resume"),
|
||||
new PDAResumeCommand(fCommandControl.getDMContext()),
|
||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
|
@ -206,7 +208,7 @@ public class PDARunControl extends AbstractDsfService
|
|||
|
||||
if (canSuspend(context)) {
|
||||
fCommandControl.queueCommand(
|
||||
new PDACommand(fCommandControl.getDMContext(), "suspend"),
|
||||
new PDASuspendCommand(fCommandControl.getDMContext()),
|
||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
||||
|
||||
} else {
|
||||
|
@ -228,7 +230,7 @@ public class PDARunControl extends AbstractDsfService
|
|||
fCommandCache.setTargetAvailable(false);
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
new PDACommand(fCommandControl.getDMContext(), "step"),
|
||||
new PDAStepCommand(fCommandControl.getDMContext()),
|
||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
||||
|
||||
} else {
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
|||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.stack.PDAStack.PDAFrame;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -22,16 +21,12 @@ import org.eclipse.dd.examples.pda.service.stack.PDAStack.PDAFrame;
|
|||
class FrameDMContext extends AbstractDMContext implements IFrameDMContext {
|
||||
|
||||
private final int fLevel;
|
||||
private final PDAFrame fFrame;
|
||||
|
||||
FrameDMContext(String sessionId, IExecutionDMContext execDmc, int level, PDAFrame frame) {
|
||||
FrameDMContext(String sessionId, IExecutionDMContext execDmc, int level) {
|
||||
super(sessionId, new IDMContext[] { execDmc });
|
||||
fLevel = level;
|
||||
fFrame = frame;
|
||||
}
|
||||
|
||||
PDAFrame getFrame() { return fFrame; }
|
||||
|
||||
public int getLevel() { return fLevel; }
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,7 @@ package org.eclipse.dd.examples.pda.service.stack;
|
|||
|
||||
import org.eclipse.cdt.core.IAddress;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMData;
|
||||
import org.eclipse.dd.examples.pda.service.stack.PDAStack.PDAFrame;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDAFrame;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -26,7 +26,7 @@ public class FrameDMData implements IFrameDMData {
|
|||
}
|
||||
|
||||
public String getFile() {
|
||||
return fFrame.fFilePath;
|
||||
return fFrame.fFilePath.lastSegment();
|
||||
}
|
||||
|
||||
public String getFunction() {
|
||||
|
@ -34,7 +34,7 @@ public class FrameDMData implements IFrameDMData {
|
|||
}
|
||||
|
||||
public int getLine() {
|
||||
return fFrame.fLine;
|
||||
return fFrame.fLine + 1;
|
||||
}
|
||||
|
||||
public int getColumn() {
|
||||
|
|
|
@ -10,10 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.stack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
@ -33,9 +30,10 @@ import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
|
|||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.dsf.service.IDsfService;
|
||||
import org.eclipse.dd.examples.pda.PDAPlugin;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControl;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDAFrame;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDAStackCommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDAStackCommandResult;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
|
@ -91,16 +89,29 @@ public class PDAStack extends AbstractDsfService implements IStack {
|
|||
rm.done();
|
||||
}
|
||||
|
||||
public void getFrameData(IFrameDMContext frameCtx, DataRequestMonitor<IFrameDMData> rm) {
|
||||
public void getFrameData(final IFrameDMContext frameCtx, final DataRequestMonitor<IFrameDMData> rm) {
|
||||
if ( !(frameCtx instanceof FrameDMContext) ) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + frameCtx, null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
PDAFrame pdaFrame = ((FrameDMContext)frameCtx).getFrame();
|
||||
rm.setData(new FrameDMData(pdaFrame));
|
||||
rm.done();
|
||||
fCommandCache.execute(
|
||||
new PDAStackCommand(fCommandControl.getDMContext()),
|
||||
new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
int frameId = getData().fFrames.length - frameCtx.getLevel() - 1;
|
||||
if (frameId < 0) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid frame level " + frameCtx, null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
rm.setData(new FrameDMData(getData().fFrames[frameId]));
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getFrames(IDMContext context, final DataRequestMonitor<IFrameDMContext[]> rm) {
|
||||
|
@ -111,15 +122,14 @@ public class PDAStack extends AbstractDsfService implements IStack {
|
|||
return;
|
||||
}
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
new PDACommand(execCtx, "stack"),
|
||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
||||
fCommandCache.execute(
|
||||
new PDAStackCommand(fCommandControl.getDMContext()),
|
||||
new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
PDAFrame[] frames = parseStackResponse(getData().fResponseText);
|
||||
IFrameDMContext[] frameCtxs = new IFrameDMContext[frames.length];
|
||||
for (int i = 0; i < frames.length; i++) {
|
||||
frameCtxs[i] = new FrameDMContext(getSession().getId(), execCtx, i, frames[i]);
|
||||
IFrameDMContext[] frameCtxs = new IFrameDMContext[getData().fFrames.length];
|
||||
for (int i = 0; i < getData().fFrames.length; i++) {
|
||||
frameCtxs[i] = new FrameDMContext(getSession().getId(), execCtx, i);
|
||||
}
|
||||
rm.setData(frameCtxs);
|
||||
rm.done();
|
||||
|
@ -127,44 +137,59 @@ public class PDAStack extends AbstractDsfService implements IStack {
|
|||
});
|
||||
}
|
||||
|
||||
public void getLocals(IFrameDMContext frameCtx, DataRequestMonitor<IVariableDMContext[]> rm) {
|
||||
public void getLocals(final IFrameDMContext frameCtx, final DataRequestMonitor<IVariableDMContext[]> rm) {
|
||||
if ( !(frameCtx instanceof FrameDMContext) ) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + frameCtx, null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
PDAFrame pdaFrame = ((FrameDMContext)frameCtx).getFrame();
|
||||
IVariableDMContext[] variableCtxs = new IVariableDMContext[pdaFrame.fVariables.length];
|
||||
for (int i = 0; i < pdaFrame.fVariables.length; i++) {
|
||||
variableCtxs[i] = new VariableDMContext(getSession().getId(), frameCtx, pdaFrame.fVariables[i]);
|
||||
}
|
||||
rm.setData(variableCtxs);
|
||||
rm.done();
|
||||
fCommandCache.execute(
|
||||
new PDAStackCommand(fCommandControl.getDMContext()),
|
||||
new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
int frameId = getData().fFrames.length - frameCtx.getLevel() - 1;
|
||||
if (frameId < 0) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid frame level " + frameCtx, null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PDAFrame pdaFrame = getData().fFrames[frameId];
|
||||
IVariableDMContext[] variableCtxs = new IVariableDMContext[pdaFrame.fVariables.length];
|
||||
for (int i = 0; i < pdaFrame.fVariables.length; i++) {
|
||||
variableCtxs[i] = new VariableDMContext(getSession().getId(), frameCtx, pdaFrame.fVariables[i]);
|
||||
}
|
||||
rm.setData(variableCtxs);
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void getStackDepth(IDMContext context, int maxDepth, final DataRequestMonitor<Integer> rm) {
|
||||
getFrames(
|
||||
context,
|
||||
new DataRequestMonitor<IFrameDMContext[]>(getExecutor(), rm) {
|
||||
fCommandCache.execute(
|
||||
new PDAStackCommand(fCommandControl.getDMContext()),
|
||||
new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
rm.setData(getData().length);
|
||||
rm.setData(getData().fFrames.length);
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getTopFrame(IDMContext context, final DataRequestMonitor<IFrameDMContext> rm) {
|
||||
getFrames(
|
||||
context,
|
||||
new DataRequestMonitor<IFrameDMContext[]>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleOK() {
|
||||
rm.setData(getData()[0]);
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
final IExecutionDMContext execCtx = DMContexts.getAncestorOfType(context, IExecutionDMContext.class);
|
||||
if (execCtx == null) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + context, null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
rm.setData(new FrameDMContext(getSession().getId(), execCtx, 0));
|
||||
rm.done();
|
||||
}
|
||||
|
||||
public void getVariableData(IVariableDMContext variableCtx, DataRequestMonitor<IVariableDMData> rm) {
|
||||
|
@ -213,36 +238,4 @@ public class PDAStack extends AbstractDsfService implements IStack {
|
|||
fCommandCache.setTargetAvailable(true);
|
||||
fCommandCache.reset();
|
||||
}
|
||||
|
||||
public static class PDAFrame {
|
||||
PDAFrame(String frameString) {
|
||||
StringTokenizer st = new StringTokenizer(frameString, "|");
|
||||
|
||||
fFilePath = st.nextToken();
|
||||
fLine = Integer.parseInt(st.nextToken());
|
||||
fFunction = st.nextToken();
|
||||
|
||||
List<String> variablesList = new ArrayList<String>();
|
||||
while (st.hasMoreTokens()) {
|
||||
variablesList.add(st.nextToken());
|
||||
}
|
||||
fVariables = variablesList.toArray(new String[variablesList.size()]);
|
||||
}
|
||||
|
||||
final public String fFilePath;
|
||||
final public int fLine;
|
||||
final public String fFunction;
|
||||
final public String[] fVariables;
|
||||
}
|
||||
|
||||
private PDAFrame[] parseStackResponse(String response) {
|
||||
StringTokenizer st = new StringTokenizer(response, "#");
|
||||
List<PDAFrame> framesList = new ArrayList<PDAFrame>();
|
||||
|
||||
while (st.hasMoreTokens()) {
|
||||
framesList.add(new PDAFrame(st.nextToken()));
|
||||
}
|
||||
return framesList.toArray(new PDAFrame[framesList.size()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.dd.dsf.concurrent.Query;
|
|||
import org.eclipse.dd.dsf.debug.service.command.ICommand;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandListener;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandResult;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -82,7 +81,7 @@ public class BasicTests extends CommandControlTestsBase {
|
|||
}
|
||||
});
|
||||
|
||||
final PDACommand testCommand = new PDACommand(fCommandControl.getDMContext(), "data");
|
||||
final PDATestCommand testCommand = new PDATestCommand(fCommandControl.getDMContext(), "data");
|
||||
|
||||
// Test sending the command and checking all listeners were called.
|
||||
Query<PDACommandResult> sendCommandQuery = new Query<PDACommandResult>() {
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.eclipse.dd.dsf.concurrent.Query;
|
|||
import org.eclipse.dd.dsf.debug.service.command.IEventListener;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControl;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommand;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
import org.eclipse.dd.tests.pda.util.Launching;
|
||||
import org.junit.After;
|
||||
|
@ -106,7 +105,7 @@ public class CommandControlTestsBase {
|
|||
|
||||
protected void sendCommand(String command, String expectedResult) throws Throwable {
|
||||
|
||||
final PDACommand testCommand = new PDACommand(fCommandControl.getDMContext(), command);
|
||||
final PDATestCommand testCommand = new PDATestCommand(fCommandControl.getDMContext(), command);
|
||||
|
||||
// Test sending the command and checking all listeners were called.
|
||||
Query<PDACommandResult> sendCommandQuery = new Query<PDACommandResult>() {
|
||||
|
|
|
@ -8,16 +8,17 @@
|
|||
* Contributors:
|
||||
* Wind River Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.examples.pda.service.command;
|
||||
package org.eclipse.dd.tests.pda.service.command;
|
||||
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.PDACommandBase;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControlDMContext;
|
||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||
import org.eclipse.dd.examples.pda.service.command.commands.AbstractPDACommand;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class PDACommand extends PDACommandBase<PDACommandResult> {
|
||||
public PDACommand(IDMContext context, String command) {
|
||||
class PDATestCommand extends AbstractPDACommand<PDACommandResult> {
|
||||
PDATestCommand(PDACommandControlDMContext context, String command) {
|
||||
super(context, command);
|
||||
}
|
||||
|
|
@ -12,21 +12,13 @@
|
|||
package org.eclipse.debug.examples.core.pda.sourcelookup;
|
||||
|
||||
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
|
||||
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
|
||||
|
||||
/**
|
||||
* PDA source lookup director. For PDA source lookup there is one source
|
||||
* lookup participant.
|
||||
* PDA source lookup director.
|
||||
*/
|
||||
public class PDASourceLookupDirector extends AbstractSourceLookupDirector {
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupDirector#initializeParticipants()
|
||||
*/
|
||||
public void initializeParticipants() {
|
||||
//#ifdef ex4
|
||||
//# // TODO: Exercise 4 - add our participant to this director
|
||||
//#else
|
||||
addParticipants(new ISourceLookupParticipant[]{new PDASourceLookupParticipant()});
|
||||
//#endif
|
||||
// No need to add participants here, the surce display adapter will
|
||||
// add the participant with the correct session ID.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2007 IBM Corporation 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:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Bjorn Freeman-Benson - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.debug.examples.core.pda.sourcelookup;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
|
||||
|
||||
|
||||
/**
|
||||
* The PDA source lookup participant knows how to translate a
|
||||
* PDA stack frame into a source file name
|
||||
*/
|
||||
public class PDASourceLookupParticipant extends AbstractSourceLookupParticipant {
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupParticipant#getSourceName(java.lang.Object)
|
||||
*/
|
||||
public String getSourceName(Object object) throws CoreException {
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue