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>() {
|
Query<Object> launchShutdownQuery = new Query<Object>() {
|
||||||
@Override
|
@Override
|
||||||
protected void execute(DataRequestMonitor<Object> rm) {
|
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 {
|
public PDALineBreakpoint(final IResource resource, final int lineNumber) throws CoreException {
|
||||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
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);
|
setMarker(marker);
|
||||||
marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
|
marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
|
||||||
marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
|
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 {
|
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() {
|
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
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);
|
setMarker(marker);
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
ensureMarker().setAttribute(IMarker.LINE_NUMBER, lineNumber);
|
ensureMarker().setAttribute(IMarker.LINE_NUMBER, lineNumber);
|
||||||
|
|
|
@ -10,18 +10,12 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.launch;
|
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.IStatus;
|
||||||
import org.eclipse.core.runtime.MultiStatus;
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
import org.eclipse.core.runtime.Platform;
|
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.ConfinedToDsfExecutor;
|
||||||
import org.eclipse.dd.dsf.concurrent.DefaultDsfExecutor;
|
import org.eclipse.dd.dsf.concurrent.DefaultDsfExecutor;
|
||||||
import org.eclipse.dd.dsf.concurrent.DsfExecutor;
|
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.ImmediateExecutor;
|
||||||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.dd.dsf.concurrent.Sequence;
|
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.DsfServiceEventHandler;
|
||||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||||
import org.eclipse.dd.dsf.service.DsfSession;
|
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.PDAPlugin;
|
||||||
import org.eclipse.dd.examples.pda.service.command.PDATerminatedEvent;
|
import org.eclipse.dd.examples.pda.service.command.PDATerminatedEvent;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
@ -52,8 +45,9 @@ public class PDALaunch extends Launch
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||||
private DsfServicesTracker fTracker;
|
private DsfServicesTracker fTracker;
|
||||||
|
|
||||||
private AtomicBoolean fInitialized = new AtomicBoolean(false);
|
private Sequence fInitializationSequence = null;
|
||||||
private AtomicBoolean fShutDown = new AtomicBoolean(false);
|
private boolean fInitialized = false;
|
||||||
|
private boolean fShutDown = false;
|
||||||
|
|
||||||
public PDALaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
|
public PDALaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
|
||||||
super(launchConfiguration, mode, locator);
|
super(launchConfiguration, mode, locator);
|
||||||
|
@ -70,42 +64,53 @@ public class PDALaunch extends Launch
|
||||||
|
|
||||||
public DsfSession getSession() { return fSession; }
|
public DsfSession getSession() { return fSession; }
|
||||||
|
|
||||||
@ConfinedToDsfExecutor("getExecutor")
|
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||||
public void initializeControl()
|
public void initializeServices(String program, int requestPort, int eventPort, final RequestMonitor rm)
|
||||||
throws CoreException
|
|
||||||
{
|
{
|
||||||
|
fTracker = new DsfServicesTracker(PDAPlugin.getBundleContext(), fSession.getId());
|
||||||
|
fSession.addServiceEventListener(PDALaunch.this, null);
|
||||||
|
|
||||||
Runnable initRunnable = new DsfRunnable() {
|
synchronized(this) {
|
||||||
public void run() {
|
fInitializationSequence = new PDAServicesInitSequence(
|
||||||
fTracker = new DsfServicesTracker(PDAPlugin.getBundleContext(), fSession.getId());
|
getSession(), this, program, requestPort, eventPort,
|
||||||
fSession.addServiceEventListener(PDALaunch.this, null);
|
new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
|
||||||
fInitialized.set(true);
|
@Override
|
||||||
fireChanged();
|
protected void handleCompleted() {
|
||||||
}
|
boolean doShutdown = false;
|
||||||
};
|
synchronized (this)
|
||||||
|
{
|
||||||
// Invoke the execution code and block waiting for the result.
|
fInitialized = true;
|
||||||
try {
|
fInitializationSequence = null;
|
||||||
fExecutor.submit(initRunnable).get();
|
if (fShutDown) {
|
||||||
} catch (InterruptedException e) {
|
doShutdown = true;
|
||||||
throw new CoreException(new Status(
|
}
|
||||||
IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INTERNAL_ERROR, "Error initializing launch", e)); //$NON-NLS-1$
|
}
|
||||||
} catch (ExecutionException e) {
|
if (doShutdown) {
|
||||||
throw new CoreException(new Status(
|
doShutdown(rm);
|
||||||
IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INTERNAL_ERROR, "Error initializing launch", e.getCause())); //$NON-NLS-1$
|
} else {
|
||||||
|
if (getStatus().getSeverity() == IStatus.ERROR) {
|
||||||
|
rm.setStatus(getStatus());
|
||||||
|
}
|
||||||
|
rm.done();
|
||||||
|
}
|
||||||
|
fireChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
getSession().getExecutor().execute(fInitializationSequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DsfServiceEventHandler public void eventDispatched(PDATerminatedEvent event) {
|
@DsfServiceEventHandler
|
||||||
shutdownSession(new RequestMonitor(ImmediateExecutor.getInstance(), null));
|
public void eventDispatched(PDATerminatedEvent event) {
|
||||||
|
shutdownServices(new RequestMonitor(ImmediateExecutor.getInstance(), null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInitialized() {
|
public synchronized boolean isInitialized() {
|
||||||
return fInitialized.get();
|
return fInitialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShutDown() {
|
public synchronized boolean isShutDown() {
|
||||||
return fShutDown.get();
|
return fShutDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -138,13 +143,27 @@ public class PDALaunch extends Launch
|
||||||
* @param rm The request monitor invoked when the shutdown is complete.
|
* @param rm The request monitor invoked when the shutdown is complete.
|
||||||
*/
|
*/
|
||||||
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
@ConfinedToDsfExecutor("getSession().getExecutor()")
|
||||||
public void shutdownSession(final RequestMonitor rm) {
|
public void shutdownServices(final RequestMonitor rm) {
|
||||||
if (fShutDown.getAndSet(true)) {
|
boolean doShutdown = false;
|
||||||
rm.done();
|
synchronized (this) {
|
||||||
return;
|
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(),
|
getDsfExecutor(), fSession.getId(),
|
||||||
new RequestMonitor(fSession.getExecutor(), rm) {
|
new RequestMonitor(fSession.getExecutor(), rm) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -166,8 +185,7 @@ public class PDALaunch extends Launch
|
||||||
rm.setStatus(getStatus());
|
rm.setStatus(getStatus());
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
});
|
}) );
|
||||||
fExecutor.execute(shutdownSeq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -28,6 +28,8 @@ import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.variables.IValueVariable;
|
import org.eclipse.core.variables.IValueVariable;
|
||||||
import org.eclipse.core.variables.VariablesPlugin;
|
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.dd.examples.pda.PDAPlugin;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
|
@ -99,12 +101,8 @@ public class PDALaunchDelegate extends LaunchConfigurationDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
launchProcess(launch, program, requestPort, eventPort);
|
launchProcess(launch, program, requestPort, eventPort);
|
||||||
|
|
||||||
PDALaunch pdaLaunch = (PDALaunch)launch;
|
PDALaunch pdaLaunch = (PDALaunch)launch;
|
||||||
|
|
||||||
initServices(pdaLaunch, program, requestPort, eventPort);
|
initServices(pdaLaunch, program, requestPort, eventPort);
|
||||||
|
|
||||||
pdaLaunch.initializeControl();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchProcess(ILaunch launch, String program, int requestPort, int eventPort) throws CoreException {
|
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);
|
DebugPlugin.newProcess(launch, process, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initServices(PDALaunch pdaLaunch, String program, int requestPort, int eventPort) throws CoreException {
|
private void initServices(final PDALaunch pdaLaunch, final String program, final int requestPort, final int eventPort)
|
||||||
final PDAServicesInitSequence initSequence =
|
throws CoreException
|
||||||
new PDAServicesInitSequence(pdaLaunch.getSession(), pdaLaunch, program, requestPort, eventPort);
|
{
|
||||||
pdaLaunch.getSession().getExecutor().execute(initSequence);
|
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 {
|
try {
|
||||||
initSequence.get();
|
initQuery.get();
|
||||||
} catch (InterruptedException e1) {
|
} 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$
|
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) {
|
} 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.PDABreakpointAttributeTranslator;
|
||||||
import org.eclipse.dd.examples.pda.service.breakpoints.PDABreakpoints;
|
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.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.runcontrol.PDARunControl;
|
||||||
import org.eclipse.dd.examples.pda.service.stack.PDAStack;
|
import org.eclipse.dd.examples.pda.service.stack.PDAStack;
|
||||||
import org.eclipse.debug.examples.core.pda.sourcelookup.PDASourceLookupDirector;
|
import org.eclipse.debug.examples.core.pda.sourcelookup.PDASourceLookupDirector;
|
||||||
|
@ -37,7 +38,8 @@ public class PDAServicesInitSequence extends Sequence {
|
||||||
new Step() {
|
new Step() {
|
||||||
@Override
|
@Override
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
public void execute(RequestMonitor requestMonitor) {
|
||||||
new PDARunControl(fSession).initialize(requestMonitor);
|
fRunControl = new PDARunControl(fSession);
|
||||||
|
fRunControl.initialize(requestMonitor);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Step() {
|
new Step() {
|
||||||
|
@ -71,38 +73,16 @@ public class PDAServicesInitSequence extends Sequence {
|
||||||
new PDAStack(fSession).initialize(requestMonitor);
|
new PDAStack(fSession).initialize(requestMonitor);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*new Step() { @Override
|
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
|
||||||
new ExpressionService(fSession).initialize(requestMonitor);
|
|
||||||
}},
|
|
||||||
new Step() { @Override
|
new Step() { @Override
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
public void execute(RequestMonitor requestMonitor) {
|
||||||
fSourceLookup = new CSourceLookup(fSession);
|
new PDAExpressions(fSession).initialize(requestMonitor);
|
||||||
fSourceLookup.initialize(requestMonitor);
|
}
|
||||||
}},
|
},
|
||||||
new Step() { @Override
|
new Step() { @Override
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
public void execute(RequestMonitor requestMonitor) {
|
||||||
fSourceLookup.setSourceLookupDirector(
|
fRunControl.resume(fCommandControl.getDMContext(), requestMonitor);
|
||||||
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);
|
|
||||||
}},*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private DsfSession fSession;
|
private DsfSession fSession;
|
||||||
|
@ -112,12 +92,13 @@ public class PDAServicesInitSequence extends Sequence {
|
||||||
private int fEventPort;
|
private int fEventPort;
|
||||||
|
|
||||||
PDACommandControl fCommandControl;
|
PDACommandControl fCommandControl;
|
||||||
|
PDARunControl fRunControl;
|
||||||
PDASourceLookupDirector fSourceLookup;
|
PDASourceLookupDirector fSourceLookup;
|
||||||
|
|
||||||
public PDAServicesInitSequence(DsfSession session, PDALaunch launch, String program, int requestPort,
|
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;
|
fSession = session;
|
||||||
fLaunch = launch;
|
fLaunch = launch;
|
||||||
fProgram = program;
|
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.PDAPlugin;
|
||||||
import org.eclipse.dd.examples.pda.service.breakpoints.PDABreakpoints;
|
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.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.runcontrol.PDARunControl;
|
||||||
import org.eclipse.dd.examples.pda.service.stack.PDAStack;
|
import org.eclipse.dd.examples.pda.service.stack.PDAStack;
|
||||||
|
|
||||||
|
@ -75,12 +76,13 @@ public class PDAServicesShutdownSequence extends Sequence {
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
public void execute(RequestMonitor requestMonitor) {
|
||||||
shutdownService(CSourceLookup.class, requestMonitor);
|
shutdownService(CSourceLookup.class, requestMonitor);
|
||||||
}
|
}
|
||||||
}, new Step() {
|
},*/
|
||||||
|
new Step() {
|
||||||
@Override
|
@Override
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
public void execute(RequestMonitor requestMonitor) {
|
||||||
shutdownService(ExpressionService.class, requestMonitor);
|
shutdownService(PDAExpressions.class, requestMonitor);
|
||||||
}
|
}
|
||||||
},*/
|
},
|
||||||
new Step() {
|
new Step() {
|
||||||
@Override
|
@Override
|
||||||
public void execute(RequestMonitor requestMonitor) {
|
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.dsf.service.IDsfService;
|
||||||
import org.eclipse.dd.examples.pda.PDAPlugin;
|
import org.eclipse.dd.examples.pda.PDAPlugin;
|
||||||
import org.eclipse.dd.examples.pda.breakpoints.PDAWatchpoint;
|
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.PDACommandControl;
|
||||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
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;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,7 +150,7 @@ public class PDABreakpoints extends AbstractDsfService implements IBreakpoints
|
||||||
|
|
||||||
fBreakpoints.add(breakpointCtx);
|
fBreakpoints.add(breakpointCtx);
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
new PDACommand(fCommandControl.getDMContext(), "set " + line),
|
new PDASetBreakpointCommand(fCommandControl.getDMContext(), line),
|
||||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleOK() {
|
protected void handleOK() {
|
||||||
|
@ -191,20 +193,18 @@ public class PDABreakpoints extends AbstractDsfService implements IBreakpoints
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int watchOperation = 0;
|
PDAWatchCommand.WatchOperation watchOperation = PDAWatchCommand.WatchOperation.NONE;
|
||||||
if (isAccess && isModification) {
|
if (isAccess && isModification) {
|
||||||
watchOperation = 3;
|
watchOperation = PDAWatchCommand.WatchOperation.BOTH;
|
||||||
} else if (isAccess) {
|
} else if (isAccess) {
|
||||||
watchOperation = 1;
|
watchOperation = PDAWatchCommand.WatchOperation.READ;
|
||||||
} else if (isModification) {
|
} else if (isModification) {
|
||||||
watchOperation = 2;
|
watchOperation = PDAWatchCommand.WatchOperation.WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
String watchCommand = "watch " + function + "::" + variable + " " + watchOperation;
|
|
||||||
|
|
||||||
fBreakpoints.add(watchpointCtx);
|
fBreakpoints.add(watchpointCtx);
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
new PDACommand(fCommandControl.getDMContext(), watchCommand),
|
new PDAWatchCommand(fCommandControl.getDMContext(), function, variable, watchOperation),
|
||||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleOK() {
|
protected void handleOK() {
|
||||||
|
@ -244,7 +244,7 @@ public class PDABreakpoints extends AbstractDsfService implements IBreakpoints
|
||||||
fBreakpoints.remove(bpCtx);
|
fBreakpoints.remove(bpCtx);
|
||||||
|
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
new PDACommand(fCommandControl.getDMContext(), "clear " + bpCtx.fLine),
|
new PDAClearBreakpointCommand(fCommandControl.getDMContext(), bpCtx.fLine),
|
||||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,9 +252,9 @@ public class PDABreakpoints extends AbstractDsfService implements IBreakpoints
|
||||||
fBreakpoints.remove(bpCtx);
|
fBreakpoints.remove(bpCtx);
|
||||||
|
|
||||||
// Watchpoints are cleared using the same command, but with a "no watch" operation
|
// Watchpoints are cleared using the same command, but with a "no watch" operation
|
||||||
String command = "watch " + bpCtx.fFunction + "::" + bpCtx.fVariable + " 0";
|
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
new PDACommand(fCommandControl.getDMContext(), command),
|
new PDAWatchCommand(fCommandControl.getDMContext(), bpCtx.fFunction, bpCtx.fVariable,
|
||||||
|
PDAWatchCommand.WatchOperation.NONE),
|
||||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
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.DsfSession;
|
||||||
import org.eclipse.dd.dsf.service.IDsfService;
|
import org.eclipse.dd.dsf.service.IDsfService;
|
||||||
import org.eclipse.dd.examples.pda.PDAPlugin;
|
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.AbstractPDACommand;
|
||||||
import org.eclipse.dd.examples.pda.service.command.commands.PDACommandBaseResult;
|
|
||||||
import org.eclipse.dd.examples.pda.service.command.commands.PDAExitCommand;
|
import org.eclipse.dd.examples.pda.service.command.commands.PDAExitCommand;
|
||||||
import org.osgi.framework.BundleContext;
|
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.
|
// Structure used to store command information in services internal queues.
|
||||||
private static class CommandHandle {
|
private static class CommandHandle {
|
||||||
final private PDACommandBase<PDACommandBaseResult> fCommand;
|
final private AbstractPDACommand<PDACommandResult> fCommand;
|
||||||
final private DataRequestMonitor<PDACommandBaseResult> fRequestMonitor;
|
final private DataRequestMonitor<PDACommandResult> fRequestMonitor;
|
||||||
|
|
||||||
CommandHandle(PDACommandBase<PDACommandBaseResult> c, DataRequestMonitor<PDACommandBaseResult> rm) {
|
CommandHandle(AbstractPDACommand<PDACommandResult> c, DataRequestMonitor<PDACommandResult> rm) {
|
||||||
fCommand = c;
|
fCommand = c;
|
||||||
fRequestMonitor = rm;
|
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) {
|
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
|
// Cast from command with "<V extends ICommandResult>" to a more concrete
|
||||||
// type to use internally in the command control.
|
// type to use internally in the command control.
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
PDACommandBase<PDACommandBaseResult> pdaCommand = (PDACommandBase<PDACommandBaseResult>)command;
|
AbstractPDACommand<PDACommandResult> pdaCommand = (AbstractPDACommand<PDACommandResult>)command;
|
||||||
|
|
||||||
// Similarly, cast the request monitor to a more concrete type.
|
// Similarly, cast the request monitor to a more concrete type.
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
DataRequestMonitor<PDACommandBaseResult> pdaRM = (DataRequestMonitor<PDACommandBaseResult>)rm;
|
DataRequestMonitor<PDACommandResult> pdaRM = (DataRequestMonitor<PDACommandResult>)rm;
|
||||||
|
|
||||||
fCommandQueue.add( new CommandHandle(pdaCommand, pdaRM) );
|
fCommandQueue.add( new CommandHandle(pdaCommand, pdaRM) );
|
||||||
for (ICommandListener listener : fCommandListeners) {
|
for (ICommandListener listener : fCommandListeners) {
|
||||||
listener.commandQueued(command);
|
listener.commandQueued(command);
|
||||||
|
@ -362,9 +361,9 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processCommandDone(CommandHandle handle, String response) {
|
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.setData(result);
|
||||||
handle.fRequestMonitor.done();
|
handle.fRequestMonitor.done();
|
||||||
|
|
||||||
|
@ -385,7 +384,7 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processEventReceived(String event) {
|
private void processEventReceived(String event) {
|
||||||
PDAPlugin.debug(event);
|
PDAPlugin.debug("E: " + event);
|
||||||
for (IEventListener listener : fEventListeners) {
|
for (IEventListener listener : fEventListeners) {
|
||||||
listener.eventReceived(event);
|
listener.eventReceived(event);
|
||||||
}
|
}
|
||||||
|
@ -408,7 +407,7 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon
|
||||||
// - and there are commands waiting to be sent.
|
// - and there are commands waiting to be sent.
|
||||||
CommandHandle handle = fCommandQueue.remove(0);
|
CommandHandle handle = fCommandQueue.remove(0);
|
||||||
fTxCommands.add(handle);
|
fTxCommands.add(handle);
|
||||||
PDAPlugin.debug(handle.fCommand.getRequest());
|
PDAPlugin.debug("C: " + handle.fCommand.getRequest());
|
||||||
for (ICommandListener listener : fCommandListeners) {
|
for (ICommandListener listener : fCommandListeners) {
|
||||||
listener.commandSent(handle.fCommand);
|
listener.commandSent(handle.fCommand);
|
||||||
}
|
}
|
||||||
|
@ -468,7 +467,7 @@ public class PDACommandControl extends AbstractDsfService implements ICommandCon
|
||||||
if (!isTerminated()) {
|
if (!isTerminated()) {
|
||||||
queueCommand(
|
queueCommand(
|
||||||
new PDAExitCommand(fDMContext),
|
new PDAExitCommand(fDMContext),
|
||||||
new DataRequestMonitor<PDACommandBaseResult>(getExecutor(), rm));
|
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
||||||
} else {
|
} else {
|
||||||
// If already terminated, indicate success.
|
// If already terminated, indicate success.
|
||||||
rm.done();
|
rm.done();
|
||||||
|
|
|
@ -10,14 +10,36 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command;
|
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 {
|
public class PDACommandResult implements ICommandResult {
|
||||||
PDACommandResult(String response) {
|
|
||||||
super(response);
|
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.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.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 IDMContext fContext;
|
||||||
final private String fRequest;
|
final private String fRequest;
|
||||||
|
|
||||||
public PDACommandBase(IDMContext context, String request) {
|
public AbstractPDACommand(PDACommandControlDMContext context, String request) {
|
||||||
fContext = context;
|
fContext = context;
|
||||||
fRequest = request;
|
fRequest = request;
|
||||||
}
|
}
|
||||||
|
@ -43,8 +45,8 @@ abstract public class PDACommandBase<V extends PDACommandBaseResult> implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof PDACommandBase) {
|
if (obj instanceof AbstractPDACommand) {
|
||||||
PDACommandBase<?> cmd = (PDACommandBase<?>)obj;
|
AbstractPDACommand<?> cmd = (AbstractPDACommand<?>)obj;
|
||||||
return fContext.equals(cmd.fContext) && fRequest.equals(cmd.fRequest);
|
return fContext.equals(cmd.fContext) && fRequest.equals(cmd.fRequest);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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
|
* Clears any breakpoint set on given line
|
||||||
|
@ -21,14 +22,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* </pre>
|
* </pre>
|
||||||
|
|
||||||
*/
|
*/
|
||||||
public class PDAClearBreakpointCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDAClearBreakpointCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public PDAClearBreakpointCommand(IDMContext context, int line) {
|
public PDAClearBreakpointCommand(PDACommandControlDMContext context, int line) {
|
||||||
super(context, "clear " + line);
|
super(context, "clear " + (line - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(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;
|
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
|
* Retrieves data stack information
|
||||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* R: {value 1}|{value 2}|{value 3}|...|
|
* R: {value 1}|{value 2}|{value 3}|...|
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class PDADataCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDADataCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public PDADataCommand(IDMContext context) {
|
public PDADataCommand(PDACommandControlDMContext context) {
|
||||||
super(context, "data");
|
super(context, "data");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,12 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see PDADataCommand
|
* @see PDADataCommand
|
||||||
*/
|
*/
|
||||||
public class PDADataCommandResult extends PDACommandBaseResult {
|
public class PDADataCommandResult extends PDACommandResult {
|
||||||
|
|
||||||
final public int[] fValues;
|
final public int[] fValues;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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.
|
* Returns from the current frame without executing the rest of instructions.
|
||||||
|
@ -23,14 +24,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* </pre>
|
* </pre>
|
||||||
|
|
||||||
*/
|
*/
|
||||||
public class PDADropFrameCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDADropFrameCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public PDADropFrameCommand(IDMContext context) {
|
public PDADropFrameCommand(PDACommandControlDMContext context) {
|
||||||
super(context, "drop");
|
super(context, "drop");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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.
|
* 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>.
|
* 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);
|
super(context, "eval " + operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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.
|
* 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>.
|
* 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 enum Event { UNIMPINSTR, NOSUCHLABEL };
|
||||||
|
|
||||||
public PDAEventStopCommand(IDMContext context, Event event, boolean enable) {
|
public PDAEventStopCommand(PDACommandControlDMContext context, Event event, boolean enable) {
|
||||||
super(context,
|
super(context,
|
||||||
"eventstop " +
|
"eventstop " +
|
||||||
(event == Event.UNIMPINSTR ? "unimpinstr " : "nosuchlabel ") +
|
(event == Event.UNIMPINSTR ? "unimpinstr " : "nosuchlabel ") +
|
||||||
|
@ -36,7 +37,7 @@ public class PDAEventStopCommand extends PDACommandBase<PDACommandBaseResult> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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.
|
* Instructs the debugger to exit.
|
||||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* R: ok
|
* R: ok
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class PDAExitCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDAExitCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public PDAExitCommand(IDMContext context) {
|
public PDAExitCommand(PDACommandControlDMContext context) {
|
||||||
super(context, "exit");
|
super(context, "exit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(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;
|
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
|
* Pops the top value from the data stack
|
||||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* R: ok
|
* R: ok
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class PDAPopDataCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDAPopDataCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public PDAPopDataCommand(IDMContext context) {
|
public PDAPopDataCommand(PDACommandControlDMContext context) {
|
||||||
super(context, "popdata");
|
super(context, "popdata");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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.
|
* Pushes the given value on top of the data stack.
|
||||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* R: ok
|
* R: ok
|
||||||
* </pre>
|
* </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);
|
super(context, "pushdata " + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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
|
* Resumes the execution
|
||||||
|
@ -21,14 +22,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* E: resumed client
|
* E: resumed client
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class PDAResumeCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDAResumeCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public PDAResumeCommand(IDMContext context) {
|
public PDAResumeCommand(PDACommandControlDMContext context) {
|
||||||
super(context, "resume");
|
super(context, "resume");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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
|
* Sets a breakpoint at given line
|
||||||
|
@ -23,14 +24,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* E: suspended breakpoint line_number
|
* E: suspended breakpoint line_number
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class PDASetBreakpointCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDASetBreakpointCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public PDASetBreakpointCommand(IDMContext context, int line) {
|
public PDASetBreakpointCommand(PDACommandControlDMContext context, int line) {
|
||||||
super(context, "set " + line);
|
super(context, "set " + (line - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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
|
* 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
|
* R: ok
|
||||||
* </pre>
|
* </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);
|
super(context, "setdata " + index + " " + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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
|
* Sets a variable value
|
||||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* R: ok
|
* R: ok
|
||||||
* </pre>
|
* </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);
|
super(context, "setvar " + variable + " " + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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
|
* 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}|...#...
|
* R: {file}|{line}|{function}|{var_1}|{var_2}|...#{file}|{line}|{function}|{var_1}|{var_2}|...#...
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class PDAStackCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDAStackCommand extends AbstractPDACommand<PDAStackCommandResult> {
|
||||||
|
|
||||||
public PDAStackCommand(IDMContext context) {
|
public PDAStackCommand(PDACommandControlDMContext context) {
|
||||||
super(context, "stack");
|
super(context, "stack");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDAStackCommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDAStackCommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,44 +14,23 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see PDAStackCommand
|
* @see PDAStackCommand
|
||||||
*/
|
*/
|
||||||
public class PDAStackCommandResult extends PDACommandBaseResult {
|
public class PDAStackCommandResult extends PDACommandResult {
|
||||||
|
|
||||||
public static class Frame {
|
final public PDAFrame[] fFrames;
|
||||||
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;
|
|
||||||
|
|
||||||
PDAStackCommandResult(String response) {
|
PDAStackCommandResult(String response) {
|
||||||
super(response);
|
super(response);
|
||||||
StringTokenizer st = new StringTokenizer(response, "#");
|
StringTokenizer st = new StringTokenizer(response, "#");
|
||||||
List<Frame> framesList = new ArrayList<Frame>();
|
List<PDAFrame> framesList = new ArrayList<PDAFrame>();
|
||||||
|
|
||||||
while (st.hasMoreTokens()) {
|
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;
|
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
|
* Executes next instruciton
|
||||||
|
@ -22,14 +23,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* E: suspended step
|
* E: suspended step
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class PDAStepCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDAStepCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public PDAStepCommand(IDMContext context) {
|
public PDAStepCommand(PDACommandControlDMContext context) {
|
||||||
super(context, "step");
|
super(context, "step");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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
|
* Executes instructions until the current subroutine is finished
|
||||||
|
@ -22,14 +23,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* E: suspended step
|
* E: suspended step
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class PDAStepReturnCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDAStepReturnCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public PDAStepReturnCommand(IDMContext context) {
|
public PDAStepReturnCommand(PDACommandControlDMContext context) {
|
||||||
super(context, "stepreturn");
|
super(context, "stepreturn");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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
|
* Suspends execution
|
||||||
|
@ -21,14 +22,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* E: suspended client
|
* E: suspended client
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class PDASuspendCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDASuspendCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public PDASuspendCommand(IDMContext context) {
|
public PDASuspendCommand(PDACommandControlDMContext context) {
|
||||||
super(context, "suspend");
|
super(context, "suspend");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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
|
* Retrieves variable value
|
||||||
|
@ -20,14 +21,14 @@ import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
* R: {variable_value}
|
* R: {variable_value}
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class PDAVarCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDAVarCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public PDAVarCommand(IDMContext context, int frame, String name) {
|
public PDAVarCommand(PDACommandControlDMContext context, int frameId, String name) {
|
||||||
super(context, "var " + frame + " " + name);
|
super(context, "var " + frameId + " " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(resultText);
|
return new PDACommandResult(resultText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
package org.eclipse.dd.examples.pda.service.command.commands;
|
||||||
|
|
||||||
|
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see PDAVarCommand
|
* @see PDAVarCommand
|
||||||
*/
|
*/
|
||||||
public class PDAVarCommandResult extends PDACommandBaseResult {
|
public class PDAVarCommandResult extends PDACommandResult {
|
||||||
|
|
||||||
final public int fValue;
|
final public int fValue;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.command.commands;
|
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
|
* 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}
|
* E: suspended watch {watch_operation} {function}::{variable_name}
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class PDAWatchCommand extends PDACommandBase<PDACommandBaseResult> {
|
public class PDAWatchCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
|
|
||||||
public enum WatchOperation { READ, WRITE, BOTH, NONE };
|
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));
|
super(context, "watch " + function+ "::" + variable + " " + getWatchOperationCode(operation));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PDACommandBaseResult createResult(String resultText) {
|
public PDACommandResult createResult(String resultText) {
|
||||||
return new PDACommandBaseResult(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.DsfSession;
|
||||||
import org.eclipse.dd.dsf.service.IDsfService;
|
import org.eclipse.dd.dsf.service.IDsfService;
|
||||||
import org.eclipse.dd.examples.pda.PDAPlugin;
|
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.PDACommandControl;
|
||||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
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;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,7 +189,7 @@ public class PDARunControl extends AbstractDsfService
|
||||||
fCommandCache.setTargetAvailable(false);
|
fCommandCache.setTargetAvailable(false);
|
||||||
|
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
new PDACommand(fCommandControl.getDMContext(), "resume"),
|
new PDAResumeCommand(fCommandControl.getDMContext()),
|
||||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleOK() {
|
protected void handleOK() {
|
||||||
|
@ -206,7 +208,7 @@ public class PDARunControl extends AbstractDsfService
|
||||||
|
|
||||||
if (canSuspend(context)) {
|
if (canSuspend(context)) {
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
new PDACommand(fCommandControl.getDMContext(), "suspend"),
|
new PDASuspendCommand(fCommandControl.getDMContext()),
|
||||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -228,7 +230,7 @@ public class PDARunControl extends AbstractDsfService
|
||||||
fCommandCache.setTargetAvailable(false);
|
fCommandCache.setTargetAvailable(false);
|
||||||
|
|
||||||
fCommandControl.queueCommand(
|
fCommandControl.queueCommand(
|
||||||
new PDACommand(fCommandControl.getDMContext(), "step"),
|
new PDAStepCommand(fCommandControl.getDMContext()),
|
||||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
||||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||||
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
|
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 {
|
class FrameDMContext extends AbstractDMContext implements IFrameDMContext {
|
||||||
|
|
||||||
private final int fLevel;
|
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 });
|
super(sessionId, new IDMContext[] { execDmc });
|
||||||
fLevel = level;
|
fLevel = level;
|
||||||
fFrame = frame;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PDAFrame getFrame() { return fFrame; }
|
|
||||||
|
|
||||||
public int getLevel() { return fLevel; }
|
public int getLevel() { return fLevel; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,7 +12,7 @@ package org.eclipse.dd.examples.pda.service.stack;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMData;
|
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() {
|
public String getFile() {
|
||||||
return fFrame.fFilePath;
|
return fFrame.fFilePath.lastSegment();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFunction() {
|
public String getFunction() {
|
||||||
|
@ -34,7 +34,7 @@ public class FrameDMData implements IFrameDMData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLine() {
|
public int getLine() {
|
||||||
return fFrame.fLine;
|
return fFrame.fLine + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColumn() {
|
public int getColumn() {
|
||||||
|
|
|
@ -10,10 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.dd.examples.pda.service.stack;
|
package org.eclipse.dd.examples.pda.service.stack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
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.DsfSession;
|
||||||
import org.eclipse.dd.dsf.service.IDsfService;
|
import org.eclipse.dd.dsf.service.IDsfService;
|
||||||
import org.eclipse.dd.examples.pda.PDAPlugin;
|
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.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;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,16 +89,29 @@ public class PDAStack extends AbstractDsfService implements IStack {
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getFrameData(IFrameDMContext frameCtx, DataRequestMonitor<IFrameDMData> rm) {
|
public void getFrameData(final IFrameDMContext frameCtx, final DataRequestMonitor<IFrameDMData> rm) {
|
||||||
if ( !(frameCtx instanceof FrameDMContext) ) {
|
if ( !(frameCtx instanceof FrameDMContext) ) {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + frameCtx, null)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + frameCtx, null)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PDAFrame pdaFrame = ((FrameDMContext)frameCtx).getFrame();
|
fCommandCache.execute(
|
||||||
rm.setData(new FrameDMData(pdaFrame));
|
new PDAStackCommand(fCommandControl.getDMContext()),
|
||||||
rm.done();
|
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) {
|
public void getFrames(IDMContext context, final DataRequestMonitor<IFrameDMContext[]> rm) {
|
||||||
|
@ -111,15 +122,14 @@ public class PDAStack extends AbstractDsfService implements IStack {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fCommandControl.queueCommand(
|
fCommandCache.execute(
|
||||||
new PDACommand(execCtx, "stack"),
|
new PDAStackCommand(fCommandControl.getDMContext()),
|
||||||
new DataRequestMonitor<PDACommandResult>(getExecutor(), rm) {
|
new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleOK() {
|
protected void handleOK() {
|
||||||
PDAFrame[] frames = parseStackResponse(getData().fResponseText);
|
IFrameDMContext[] frameCtxs = new IFrameDMContext[getData().fFrames.length];
|
||||||
IFrameDMContext[] frameCtxs = new IFrameDMContext[frames.length];
|
for (int i = 0; i < getData().fFrames.length; i++) {
|
||||||
for (int i = 0; i < frames.length; i++) {
|
frameCtxs[i] = new FrameDMContext(getSession().getId(), execCtx, i);
|
||||||
frameCtxs[i] = new FrameDMContext(getSession().getId(), execCtx, i, frames[i]);
|
|
||||||
}
|
}
|
||||||
rm.setData(frameCtxs);
|
rm.setData(frameCtxs);
|
||||||
rm.done();
|
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) ) {
|
if ( !(frameCtx instanceof FrameDMContext) ) {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + frameCtx, null)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + frameCtx, null)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PDAFrame pdaFrame = ((FrameDMContext)frameCtx).getFrame();
|
fCommandCache.execute(
|
||||||
IVariableDMContext[] variableCtxs = new IVariableDMContext[pdaFrame.fVariables.length];
|
new PDAStackCommand(fCommandControl.getDMContext()),
|
||||||
for (int i = 0; i < pdaFrame.fVariables.length; i++) {
|
new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) {
|
||||||
variableCtxs[i] = new VariableDMContext(getSession().getId(), frameCtx, pdaFrame.fVariables[i]);
|
@Override
|
||||||
}
|
protected void handleOK() {
|
||||||
rm.setData(variableCtxs);
|
int frameId = getData().fFrames.length - frameCtx.getLevel() - 1;
|
||||||
rm.done();
|
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) {
|
public void getStackDepth(IDMContext context, int maxDepth, final DataRequestMonitor<Integer> rm) {
|
||||||
getFrames(
|
fCommandCache.execute(
|
||||||
context,
|
new PDAStackCommand(fCommandControl.getDMContext()),
|
||||||
new DataRequestMonitor<IFrameDMContext[]>(getExecutor(), rm) {
|
new DataRequestMonitor<PDAStackCommandResult>(getExecutor(), rm) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleOK() {
|
protected void handleOK() {
|
||||||
rm.setData(getData().length);
|
rm.setData(getData().fFrames.length);
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getTopFrame(IDMContext context, final DataRequestMonitor<IFrameDMContext> rm) {
|
public void getTopFrame(IDMContext context, final DataRequestMonitor<IFrameDMContext> rm) {
|
||||||
getFrames(
|
final IExecutionDMContext execCtx = DMContexts.getAncestorOfType(context, IExecutionDMContext.class);
|
||||||
context,
|
if (execCtx == null) {
|
||||||
new DataRequestMonitor<IFrameDMContext[]>(getExecutor(), rm) {
|
rm.setStatus(new Status(IStatus.ERROR, PDAPlugin.PLUGIN_ID, IDsfService.INVALID_HANDLE, "Invalid context " + context, null)); //$NON-NLS-1$
|
||||||
@Override
|
rm.done();
|
||||||
protected void handleOK() {
|
return;
|
||||||
rm.setData(getData()[0]);
|
}
|
||||||
rm.done();
|
rm.setData(new FrameDMContext(getSession().getId(), execCtx, 0));
|
||||||
}
|
rm.done();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getVariableData(IVariableDMContext variableCtx, DataRequestMonitor<IVariableDMData> rm) {
|
public void getVariableData(IVariableDMContext variableCtx, DataRequestMonitor<IVariableDMData> rm) {
|
||||||
|
@ -213,36 +238,4 @@ public class PDAStack extends AbstractDsfService implements IStack {
|
||||||
fCommandCache.setTargetAvailable(true);
|
fCommandCache.setTargetAvailable(true);
|
||||||
fCommandCache.reset();
|
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.ICommand;
|
||||||
import org.eclipse.dd.dsf.debug.service.command.ICommandListener;
|
import org.eclipse.dd.dsf.debug.service.command.ICommandListener;
|
||||||
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.command.PDACommand;
|
|
||||||
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
import org.eclipse.dd.examples.pda.service.command.PDACommandResult;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
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.
|
// Test sending the command and checking all listeners were called.
|
||||||
Query<PDACommandResult> sendCommandQuery = new Query<PDACommandResult>() {
|
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.debug.service.command.IEventListener;
|
||||||
import org.eclipse.dd.dsf.service.DsfSession;
|
import org.eclipse.dd.dsf.service.DsfSession;
|
||||||
import org.eclipse.dd.examples.pda.service.command.PDACommandControl;
|
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.examples.pda.service.command.PDACommandResult;
|
||||||
import org.eclipse.dd.tests.pda.util.Launching;
|
import org.eclipse.dd.tests.pda.util.Launching;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -106,7 +105,7 @@ public class CommandControlTestsBase {
|
||||||
|
|
||||||
protected void sendCommand(String command, String expectedResult) throws Throwable {
|
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.
|
// Test sending the command and checking all listeners were called.
|
||||||
Query<PDACommandResult> sendCommandQuery = new Query<PDACommandResult>() {
|
Query<PDACommandResult> sendCommandQuery = new Query<PDACommandResult>() {
|
||||||
|
|
|
@ -8,16 +8,17 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* 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.PDACommandControlDMContext;
|
||||||
import org.eclipse.dd.examples.pda.service.command.commands.PDACommandBase;
|
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> {
|
class PDATestCommand extends AbstractPDACommand<PDACommandResult> {
|
||||||
public PDACommand(IDMContext context, String command) {
|
PDATestCommand(PDACommandControlDMContext context, String command) {
|
||||||
super(context, command);
|
super(context, command);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,21 +12,13 @@
|
||||||
package org.eclipse.debug.examples.core.pda.sourcelookup;
|
package org.eclipse.debug.examples.core.pda.sourcelookup;
|
||||||
|
|
||||||
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
|
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
|
* PDA source lookup director.
|
||||||
* lookup participant.
|
|
||||||
*/
|
*/
|
||||||
public class PDASourceLookupDirector extends AbstractSourceLookupDirector {
|
public class PDASourceLookupDirector extends AbstractSourceLookupDirector {
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupDirector#initializeParticipants()
|
|
||||||
*/
|
|
||||||
public void initializeParticipants() {
|
public void initializeParticipants() {
|
||||||
//#ifdef ex4
|
// No need to add participants here, the surce display adapter will
|
||||||
//# // TODO: Exercise 4 - add our participant to this director
|
// add the participant with the correct session ID.
|
||||||
//#else
|
|
||||||
addParticipants(new ISourceLookupParticipant[]{new PDASourceLookupParticipant()});
|
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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