mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-02 06:35:28 +02:00
Bug 242234 To be able to version the GDBControl service, we cannot make direct reference to the class GDBControl. That class contains a bunch of public methods however. What I did was to brute-force include all these methods in a new interface IGDBControl. I have then replaced every reference to GDBControl with IGDBControl.
Also, I have moved SessionType out of GDBControl and into its own class.
This commit is contained in:
parent
168df99385
commit
56adb58e42
21 changed files with 159 additions and 77 deletions
|
@ -19,7 +19,7 @@ import org.eclipse.dd.dsf.debug.ui.actions.DsfCommandRunnable;
|
|||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
||||
import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.debug.core.commands.IDebugCommandRequest;
|
||||
import org.eclipse.debug.core.commands.IEnabledStateRequest;
|
||||
|
@ -62,7 +62,7 @@ public class DsfTerminateCommand implements ITerminateHandler {
|
|||
new DsfRunnable() {
|
||||
public void run() {
|
||||
// Get the processes service and the exec context.
|
||||
GDBControl gdbControl = fTracker.getService(GDBControl.class);
|
||||
IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
|
||||
if (gdbControl == null || dmc == null) {
|
||||
// Context or service already invalid.
|
||||
request.setEnabled(false);
|
||||
|
@ -84,7 +84,7 @@ public class DsfTerminateCommand implements ITerminateHandler {
|
|||
|
||||
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
|
||||
@Override public void doExecute() {
|
||||
GDBControl gdbControl = fTracker.getService(GDBControl.class);
|
||||
IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
|
||||
if (gdbControl != null) {
|
||||
gdbControl.terminate(new RequestMonitor(fExecutor, null));
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
|||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
||||
import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.model.IProcess;
|
||||
|
@ -48,7 +48,7 @@ public class GdbRestartCommand implements IRestart {
|
|||
Query<Boolean> canRestart = new Query<Boolean>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<Boolean> rm) {
|
||||
GDBControl gdbControl = fTracker.getService(GDBControl.class);
|
||||
IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
|
||||
if (gdbControl != null) {
|
||||
rm.setData(gdbControl.canRestart());
|
||||
} else {
|
||||
|
@ -75,7 +75,7 @@ public class GdbRestartCommand implements IRestart {
|
|||
Query<Object> restartQuery = new Query<Object>() {
|
||||
@Override
|
||||
protected void execute(final DataRequestMonitor<Object> rm) {
|
||||
final GDBControl gdbControl = fTracker.getService(GDBControl.class);
|
||||
final IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
|
||||
if (gdbControl != null) {
|
||||
execPathRef.set(gdbControl.getExecutablePath());
|
||||
gdbControl.initInferiorInputOutput(new RequestMonitor(fExecutor, rm) {
|
||||
|
|
|
@ -30,10 +30,11 @@ import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
|||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMData;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.gdb.internal.provisional.breakpoints.CBreakpointGdbThreadsFilterExtension;
|
||||
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
||||
import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
|
@ -374,12 +375,12 @@ public class GdbThreadFilterEditor {
|
|||
return;
|
||||
}
|
||||
|
||||
ServiceTracker tracker = new ServiceTracker(GdbUIPlugin.getBundleContext(), GDBControl.class
|
||||
ServiceTracker tracker = new ServiceTracker(GdbUIPlugin.getBundleContext(), ICommandControlService.class
|
||||
.getName(), null);
|
||||
tracker.open();
|
||||
GDBControl gdbControl = (GDBControl) tracker.getService();
|
||||
if (gdbControl != null) {
|
||||
rm.setData(gdbControl.getGDBDMContext());
|
||||
ICommandControlService commandControl = (ICommandControlService) tracker.getService();
|
||||
if (commandControl != null) {
|
||||
rm.setData((IContainerDMContext)commandControl.getContext());
|
||||
} else {
|
||||
rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "GDB Control not accessible.")); //$NON-NLS-1$
|
||||
}
|
||||
|
@ -454,10 +455,10 @@ public class GdbThreadFilterEditor {
|
|||
return;
|
||||
}
|
||||
|
||||
ServiceTracker tracker = new ServiceTracker(GdbUIPlugin.getBundleContext(), GDBControl.class
|
||||
ServiceTracker tracker = new ServiceTracker(GdbUIPlugin.getBundleContext(), IGDBControl.class
|
||||
.getName(), null);
|
||||
tracker.open();
|
||||
GDBControl gdbControl = (GDBControl) tracker.getService();
|
||||
IGDBControl gdbControl = (IGDBControl) tracker.getService();
|
||||
if (gdbControl != null) {
|
||||
rm.setData(gdbControl.getExecutablePath().toOSString());
|
||||
} else {
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.eclipse.core.runtime.IPath;
|
|||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.dd.gdb.internal.provisional.launching.LaunchMessages;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
||||
import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.gdb.internal.ui.launching;
|
||||
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
|
||||
import org.eclipse.debug.ui.CommonTab;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.dd.gdb.internal.ui.launching;
|
||||
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
|
||||
import org.eclipse.debug.ui.CommonTab;
|
||||
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
|
||||
|
|
|
@ -25,14 +25,14 @@ import org.eclipse.dd.dsf.debug.service.IRunControl;
|
|||
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMData;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlInitializedDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.dsf.ui.concurrent.ViewerDataRequestMonitor;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.VMDelta;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
|
||||
|
@ -60,14 +60,14 @@ public class ContainerVMNode extends AbstractContainerVMNode
|
|||
@Override
|
||||
protected void updateElementsInSessionThread(final IChildrenUpdate update) {
|
||||
IProcesses processService = getServicesTracker().getService(IProcesses.class);
|
||||
GDBControl controlService = getServicesTracker().getService(GDBControl.class);
|
||||
ICommandControlService controlService = getServicesTracker().getService(ICommandControlService.class);
|
||||
if (processService == null || controlService == null) {
|
||||
handleFailedUpdate(update);
|
||||
return;
|
||||
}
|
||||
|
||||
processService.getProcessesBeingDebugged(
|
||||
controlService.getGDBDMContext(),
|
||||
controlService.getContext(),
|
||||
new ViewerDataRequestMonitor<IDMContext[]>(getExecutor(), update) {
|
||||
@Override
|
||||
public void handleCompleted() {
|
||||
|
|
|
@ -33,12 +33,14 @@ import org.eclipse.dd.dsf.concurrent.DsfExecutor;
|
|||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.dd.dsf.concurrent.Sequence;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.ISourceLookup.ISourceLookupDMContext;
|
||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.dd.gdb.internal.provisional.actions.IConnect;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
||||
import org.eclipse.dd.mi.service.CSourceLookup;
|
||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||
import org.eclipse.dd.mi.service.MIBreakpointsManager;
|
||||
|
@ -73,7 +75,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
}},
|
||||
new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
fCommandControl = fTracker.getService(GDBControl.class);
|
||||
fCommandControl = fTracker.getService(IGDBControl.class);
|
||||
fProcService = fTracker.getService(IMIProcesses.class);
|
||||
if (fCommandControl == null || fProcService == null) {
|
||||
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot obtain service", null)); //$NON-NLS-1$
|
||||
|
@ -91,7 +93,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT );
|
||||
if (gdbinitFile != null && gdbinitFile.length() > 0) {
|
||||
fCommandControl.queueCommand(
|
||||
new CLISource(fCommandControl.getControlDMContext(), gdbinitFile),
|
||||
new CLISource(fCommandControl.getContext(), gdbinitFile),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
|
@ -131,7 +133,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
final IPath execPath = fCommandControl.getExecutablePath();
|
||||
if (!noFileCommand && execPath != null && !execPath.isEmpty()) {
|
||||
fCommandControl.queueCommand(
|
||||
new MIFileExecAndSymbols(fCommandControl.getControlDMContext(),
|
||||
new MIFileExecAndSymbols(fCommandControl.getContext(),
|
||||
execPath.toOSString()),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
||||
} else {
|
||||
|
@ -150,7 +152,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(args);
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
new MIGDBSetArgs(fCommandControl.getControlDMContext(), args),
|
||||
new MIGDBSetArgs(fCommandControl.getContext(), args),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
||||
} else {
|
||||
requestMonitor.done();
|
||||
|
@ -216,7 +218,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
File dir = getWorkingDirectory(requestMonitor);
|
||||
if (dir != null) {
|
||||
fCommandControl.queueCommand(
|
||||
new MIEnvironmentCD(fCommandControl.getControlDMContext(), dir.getAbsolutePath()),
|
||||
new MIEnvironmentCD(fCommandControl.getContext(), dir.getAbsolutePath()),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
||||
} else {
|
||||
requestMonitor.done();
|
||||
|
@ -230,7 +232,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
public void execute(final RequestMonitor requestMonitor) {
|
||||
fCommandControl.queueCommand(
|
||||
// This command will fail for GDBs without multi-process support, and that is ok
|
||||
new MIGDBSetBreakpointApply(fCommandControl.getControlDMContext(), true),
|
||||
new MIGDBSetBreakpointApply(fCommandControl.getContext(), true),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
|
@ -256,7 +258,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
if (isNonStop) {
|
||||
// The raw commands should not be necessary in the official GDB release
|
||||
fCommandControl.queueCommand(
|
||||
new RawCommand(fCommandControl.getControlDMContext(), "set breakpoint always-inserted"), //$NON-NLS-1$
|
||||
new RawCommand(fCommandControl.getContext(), "set breakpoint always-inserted"), //$NON-NLS-1$
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
|
@ -268,17 +270,17 @@ public class FinalLaunchSequence extends Sequence {
|
|||
}
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
new RawCommand(fCommandControl.getControlDMContext(), asyncCommandStr),
|
||||
new RawCommand(fCommandControl.getContext(), asyncCommandStr),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
fCommandControl.queueCommand(
|
||||
new RawCommand(fCommandControl.getControlDMContext(), "set pagination off"), //$NON-NLS-1$
|
||||
new RawCommand(fCommandControl.getContext(), "set pagination off"), //$NON-NLS-1$
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
fCommandControl.queueCommand(
|
||||
new MIGDBSetNonStop(fCommandControl.getControlDMContext(), true),
|
||||
new MIGDBSetNonStop(fCommandControl.getContext(), true),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
||||
}
|
||||
});
|
||||
|
@ -299,7 +301,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
boolean autolib = fLaunch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB,
|
||||
IGDBLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT);
|
||||
fCommandControl.queueCommand(
|
||||
new MIGDBSetAutoSolib(fCommandControl.getControlDMContext(), autolib),
|
||||
new MIGDBSetAutoSolib(fCommandControl.getContext(), autolib),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
||||
} catch (CoreException e) {
|
||||
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot set shared library option", e)); //$NON-NLS-1$
|
||||
|
@ -318,7 +320,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
if (p.size() > 0) {
|
||||
String[] paths = p.toArray(new String[p.size()]);
|
||||
fCommandControl.queueCommand(
|
||||
new MIGDBSetSolibSearchPath(fCommandControl.getControlDMContext(), paths),
|
||||
new MIGDBSetSolibSearchPath(fCommandControl.getContext(), paths),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
|
@ -330,7 +332,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
// // in the GDB documentation. This is to avoid the sysroot
|
||||
// // variable finding libraries that were not meant to be found.
|
||||
// fCommandControl.queueCommand(
|
||||
// new MIGDBSetSysroot(fCommandControl.getControlDMContext()),
|
||||
// new MIGDBSetSysroot(fCommandControl.getContext()),
|
||||
// new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
||||
};
|
||||
});
|
||||
|
@ -350,7 +352,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
CSourceLookup sourceLookup = fTracker.getService(CSourceLookup.class);
|
||||
|
||||
CSourceLookupDirector locator = (CSourceLookupDirector)fLaunch.getSourceLocator();
|
||||
sourceLookup.setSourceLookupPath(fCommandControl.getGDBDMContext(),
|
||||
sourceLookup.setSourceLookupPath((ISourceLookupDMContext)fCommandControl.getContext(),
|
||||
locator.getSourceContainers(), requestMonitor);
|
||||
}},
|
||||
/*
|
||||
|
@ -421,14 +423,14 @@ public class FinalLaunchSequence extends Sequence {
|
|||
if (!getTcpPort(requestMonitor)) return;
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
new MITargetSelect(fCommandControl.getControlDMContext(),
|
||||
new MITargetSelect(fCommandControl.getContext(),
|
||||
fRemoteTcpHost, fRemoteTcpPort),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
||||
} else {
|
||||
if (!getSerialDevice(requestMonitor)) return;
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
new MITargetSelect(fCommandControl.getControlDMContext(),
|
||||
new MITargetSelect(fCommandControl.getContext(),
|
||||
fSerialDevice),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
||||
}
|
||||
|
@ -455,7 +457,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
|
||||
if (pid != -1) {
|
||||
fProcService.attachDebuggerToProcess(
|
||||
fProcService.createProcessContext(fCommandControl.getGDBDMContext(), Integer.toString(pid)),
|
||||
fProcService.createProcessContext(fCommandControl.getContext(), Integer.toString(pid)),
|
||||
new DataRequestMonitor<IDMContext>(getExecutor(), requestMonitor));
|
||||
} else {
|
||||
IConnect connectCommand = (IConnect)fLaunch.getSession().getModelAdapter(IConnect.class);
|
||||
|
@ -476,7 +478,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
new Step() { @Override
|
||||
public void execute(final RequestMonitor requestMonitor) {
|
||||
MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class);
|
||||
bpmService.startTrackingBreakpoints(fCommandControl.getGDBDMContext(), requestMonitor);
|
||||
bpmService.startTrackingBreakpoints((IBreakpointsTargetDMContext)fCommandControl.getContext(), requestMonitor);
|
||||
}},
|
||||
/*
|
||||
* Start the program.
|
||||
|
@ -504,7 +506,7 @@ public class FinalLaunchSequence extends Sequence {
|
|||
SessionType fSessionType;
|
||||
boolean fAttach;
|
||||
|
||||
GDBControl fCommandControl;
|
||||
IGDBControl fCommandControl;
|
||||
IMIProcesses fProcService;
|
||||
DsfServicesTracker fTracker;
|
||||
|
||||
|
|
|
@ -32,12 +32,13 @@ import org.eclipse.dd.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor;
|
|||
import org.eclipse.dd.dsf.debug.model.DsfMemoryBlockRetrieval;
|
||||
import org.eclipse.dd.dsf.debug.service.IDsfDebugServicesFactory;
|
||||
import org.eclipse.dd.dsf.debug.service.IMemory.IMemoryDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
|
||||
import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
|
||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
||||
import org.eclipse.dd.mi.service.command.AbstractCLIProcess;
|
||||
import org.eclipse.dd.mi.service.command.MIInferiorProcess;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
|
@ -108,12 +109,12 @@ public class GdbLaunch extends Launch
|
|||
try {
|
||||
fExecutor.submit( new Callable<Object>() {
|
||||
public Object call() throws CoreException {
|
||||
GDBControl gdbControl = fTracker.getService(GDBControl.class);
|
||||
ICommandControlService gdbControl = fTracker.getService(ICommandControlService.class);
|
||||
if (gdbControl != null) {
|
||||
fMemRetrieval = new DsfMemoryBlockRetrieval(
|
||||
GdbLaunchDelegate.GDB_DEBUG_MODEL_ID, getLaunchConfiguration(), fSession);
|
||||
fSession.registerModelAdapter(IMemoryBlockRetrieval.class, fMemRetrieval);
|
||||
fMemRetrieval.initialize((IMemoryDMContext) gdbControl.getControlDMContext());
|
||||
fMemRetrieval.initialize((IMemoryDMContext) gdbControl.getContext());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -136,7 +137,7 @@ public class GdbLaunch extends Launch
|
|||
MIInferiorProcess inferiorProc =
|
||||
getDsfExecutor().submit( new Callable<MIInferiorProcess>() {
|
||||
public MIInferiorProcess call() throws CoreException {
|
||||
GDBControl gdb = fTracker.getService(GDBControl.class);
|
||||
IGDBControl gdb = fTracker.getService(IGDBControl.class);
|
||||
if (gdb != null) {
|
||||
return gdb.getInferiorProcess();
|
||||
}
|
||||
|
@ -161,7 +162,7 @@ public class GdbLaunch extends Launch
|
|||
AbstractCLIProcess cliProc =
|
||||
getDsfExecutor().submit( new Callable<AbstractCLIProcess>() {
|
||||
public AbstractCLIProcess call() throws CoreException {
|
||||
GDBControl gdb = fTracker.getService(GDBControl.class);
|
||||
IGDBControl gdb = fTracker.getService(IGDBControl.class);
|
||||
if (gdb != null) {
|
||||
return gdb.getCLIProcess();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.eclipse.dd.gdb.internal.GdbPlugin;
|
|||
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.GdbDebugServicesFactory;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.GdbDebugServicesFactoryNS;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.eclipse.core.runtime.Path;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@ import org.eclipse.dd.dsf.debug.service.IRegisters;
|
|||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.ISourceLookup;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack;
|
||||
import org.eclipse.dd.dsf.debug.service.ISourceLookup.ISourceLookupDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.mi.service.CSourceLookup;
|
||||
import org.eclipse.dd.mi.service.MIBreakpointsManager;
|
||||
|
||||
|
@ -38,7 +39,7 @@ public class ServicesLaunchSequence extends Sequence {
|
|||
//
|
||||
// Create the connection.
|
||||
//
|
||||
fCommandControl = fLaunch.getServiceFactory().createService(GDBControl.class, fSession, fLaunch.getLaunchConfiguration());
|
||||
fCommandControl = fLaunch.getServiceFactory().createService(ICommandControlService.class, fSession, fLaunch.getLaunchConfiguration());
|
||||
fCommandControl.initialize(requestMonitor);
|
||||
}
|
||||
},
|
||||
|
@ -73,7 +74,7 @@ public class ServicesLaunchSequence extends Sequence {
|
|||
}},
|
||||
new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
fSourceLookup.setSourceLookupDirector(fCommandControl.getGDBDMContext(), (CSourceLookupDirector)fLaunch.getSourceLocator());
|
||||
fSourceLookup.setSourceLookupDirector((ISourceLookupDMContext)fCommandControl.getContext(), (CSourceLookupDirector)fLaunch.getSourceLocator());
|
||||
requestMonitor.done();
|
||||
}},
|
||||
new Step() { @Override
|
||||
|
@ -100,7 +101,7 @@ public class ServicesLaunchSequence extends Sequence {
|
|||
DsfSession fSession;
|
||||
GdbLaunch fLaunch;
|
||||
|
||||
GDBControl fCommandControl;
|
||||
ICommandControlService fCommandControl;
|
||||
CSourceLookup fSourceLookup;
|
||||
|
||||
public ServicesLaunchSequence(DsfSession session, GdbLaunch launch) {
|
||||
|
|
|
@ -29,8 +29,7 @@ import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
|||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
||||
import org.eclipse.dd.mi.service.IMIExecutionGroupDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIProcessDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||
|
@ -43,7 +42,7 @@ import org.osgi.framework.BundleContext;
|
|||
|
||||
public class GDBProcesses extends MIProcesses {
|
||||
|
||||
private GDBControl fGdb;
|
||||
private IGDBControl fGdb;
|
||||
|
||||
// A map of pid to names. It is filled when we get all the
|
||||
// processes that are running
|
||||
|
@ -73,7 +72,7 @@ public class GDBProcesses extends MIProcesses {
|
|||
*/
|
||||
private void doInitialize(RequestMonitor requestMonitor) {
|
||||
|
||||
fGdb = getServicesTracker().getService(GDBControl.class);
|
||||
fGdb = getServicesTracker().getService(IGDBControl.class);
|
||||
|
||||
// Register this service.
|
||||
register(new String[] { IProcesses.class.getName(),
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.eclipse.dd.dsf.service.AbstractDsfService;
|
|||
import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIExecutionGroupDMContext;
|
||||
|
@ -317,7 +317,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IMIProcesses
|
|||
}
|
||||
}
|
||||
|
||||
private GDBControl fCommandControl;
|
||||
private IGDBControl fCommandControl;
|
||||
|
||||
// A cache for commands about the threadGroups
|
||||
private CommandCache fContainerCommandCache;
|
||||
|
@ -362,11 +362,11 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IMIProcesses
|
|||
*/
|
||||
private void doInitialize(RequestMonitor requestMonitor) {
|
||||
|
||||
fCommandControl = getServicesTracker().getService(GDBControl.class);
|
||||
fCommandControl = getServicesTracker().getService(IGDBControl.class);
|
||||
fContainerCommandCache = new CommandCache(getSession(), fCommandControl);
|
||||
fContainerCommandCache.setContextAvailable(fCommandControl.getControlDMContext(), true);
|
||||
fContainerCommandCache.setContextAvailable(fCommandControl.getContext(), true);
|
||||
fThreadCommandCache = new CommandCache(getSession(), fCommandControl);
|
||||
fThreadCommandCache.setContextAvailable(fCommandControl.getControlDMContext(), true);
|
||||
fThreadCommandCache.setContextAvailable(fCommandControl.getContext(), true);
|
||||
|
||||
getSession().addServiceEventListener(this, null);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
|||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
|
||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||
|
@ -38,7 +38,7 @@ import org.eclipse.dd.mi.service.command.events.MIEvent;
|
|||
import org.eclipse.dd.mi.service.command.events.MIThreadExitEvent;
|
||||
|
||||
public class GDBRunControl extends MIRunControl {
|
||||
private GDBControl fGdb;
|
||||
private IGDBControl fGdb;
|
||||
private IMIProcesses fProcService;
|
||||
|
||||
// Record list of execution contexts
|
||||
|
@ -61,7 +61,7 @@ public class GDBRunControl extends MIRunControl {
|
|||
|
||||
private void doInitialize(final RequestMonitor requestMonitor) {
|
||||
|
||||
fGdb = getServicesTracker().getService(GDBControl.class);
|
||||
fGdb = getServicesTracker().getService(IGDBControl.class);
|
||||
fProcService = getServicesTracker().getService(IMIProcesses.class);
|
||||
|
||||
register(new String[]{IRunControl.class.getName(),
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Ericsson 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:
|
||||
* Ericsson - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.gdb.internal.provisional.service;
|
||||
|
||||
public enum SessionType { LOCAL, REMOTE, CORE }
|
|
@ -16,6 +16,7 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import org.eclipse.dd.dsf.concurrent.DsfRunnable;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.mi.service.command.AbstractCLIProcess;
|
||||
|
||||
|
@ -24,7 +25,7 @@ import org.eclipse.dd.mi.service.command.AbstractCLIProcess;
|
|||
*/
|
||||
class GDBCLIProcess extends AbstractCLIProcess {
|
||||
|
||||
public GDBCLIProcess(GDBControl commandControl) throws IOException {
|
||||
public GDBCLIProcess(ICommandControlService commandControl) throws IOException {
|
||||
super(commandControl);
|
||||
}
|
||||
|
||||
|
@ -41,7 +42,7 @@ class GDBCLIProcess extends AbstractCLIProcess {
|
|||
process = getSession().getExecutor().submit(new Callable<Process>() {
|
||||
public Process call() throws Exception {
|
||||
if (isDisposed()) return null;
|
||||
return ((GDBControl)getCommandControl()).getGDBProcess();
|
||||
return ((IGDBControl)getCommandControlService()).getGDBProcess();
|
||||
}}).get();
|
||||
} catch (RejectedExecutionException e) {
|
||||
} catch (ExecutionException e) {
|
||||
|
@ -64,7 +65,7 @@ class GDBCLIProcess extends AbstractCLIProcess {
|
|||
return new Integer(-1);
|
||||
} else {
|
||||
if (isDisposed()) return new Integer(-1);
|
||||
GDBControl gdb = (GDBControl)getCommandControl();
|
||||
IGDBControl gdb = (IGDBControl)getCommandControlService();
|
||||
if (!gdb.isGDBExited()) {
|
||||
throw new IllegalThreadStateException("GDB Process has not exited"); //$NON-NLS-1$
|
||||
}
|
||||
|
@ -89,7 +90,7 @@ class GDBCLIProcess extends AbstractCLIProcess {
|
|||
getSession().getExecutor().execute(new DsfRunnable() { public void run() {
|
||||
if (!DsfSession.isSessionActive(getSession().getId())) return;
|
||||
if (isDisposed()) return;
|
||||
GDBControl gdb = (GDBControl)getCommandControl();
|
||||
IGDBControl gdb = (IGDBControl)getCommandControlService();
|
||||
gdb.destroy();
|
||||
}});
|
||||
} catch (RejectedExecutionException e) {
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.eclipse.dd.dsf.service.DsfSession;
|
|||
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
||||
import org.eclipse.dd.gdb.internal.provisional.launching.LaunchUtils;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
||||
import org.eclipse.dd.mi.service.command.AbstractCLIProcess;
|
||||
import org.eclipse.dd.mi.service.command.AbstractMIControl;
|
||||
import org.eclipse.dd.mi.service.command.CLIEventProcessor;
|
||||
|
@ -72,7 +73,7 @@ import org.osgi.framework.BundleContext;
|
|||
* - CLI console support,<br>
|
||||
* - inferior process status tracking.<br>
|
||||
*/
|
||||
public class GDBControl extends AbstractMIControl {
|
||||
public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||
|
||||
/**
|
||||
* Event indicating that the back end process has started.
|
||||
|
@ -99,7 +100,6 @@ public class GDBControl extends AbstractMIControl {
|
|||
private static int fgInstanceCounter = 0;
|
||||
private final GDBControlDMContext fControlDmc;
|
||||
|
||||
public enum SessionType { LOCAL, REMOTE, CORE }
|
||||
private SessionType fSessionType;
|
||||
|
||||
private boolean fAttach;
|
||||
|
@ -743,7 +743,8 @@ public class GDBControl extends AbstractMIControl {
|
|||
register(
|
||||
new String[]{ ICommandControl.class.getName(),
|
||||
ICommandControlService.class.getName(),
|
||||
AbstractMIControl.class.getName() },
|
||||
AbstractMIControl.class.getName(),
|
||||
IGDBControl.class.getName() },
|
||||
new Hashtable<String,String>());
|
||||
getSession().dispatchEvent(new GDBControlInitializedDMEvent(getGDBDMContext()), getProperties());
|
||||
requestMonitor.done();
|
||||
|
|
|
@ -17,6 +17,8 @@ import java.util.concurrent.RejectedExecutionException;
|
|||
import org.eclipse.cdt.utils.pty.PTY;
|
||||
import org.eclipse.dd.dsf.concurrent.DsfRunnable;
|
||||
import org.eclipse.dd.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.dd.mi.service.command.MIInferiorProcess;
|
||||
|
||||
/**
|
||||
|
@ -25,12 +27,12 @@ import org.eclipse.dd.mi.service.command.MIInferiorProcess;
|
|||
class GDBInferiorProcess extends MIInferiorProcess {
|
||||
|
||||
|
||||
public GDBInferiorProcess(GDBControl commandControl, PTY p) {
|
||||
super(commandControl, commandControl.getGDBDMContext(), p);
|
||||
public GDBInferiorProcess(ICommandControlService commandControl, PTY p) {
|
||||
super(commandControl, (IExecutionDMContext)commandControl.getContext(), p);
|
||||
}
|
||||
|
||||
public GDBInferiorProcess(GDBControl commandControl, OutputStream gdbOutputStream) {
|
||||
super(commandControl, commandControl.getGDBDMContext(), gdbOutputStream);
|
||||
public GDBInferiorProcess(ICommandControlService commandControl, OutputStream gdbOutputStream) {
|
||||
super(commandControl, (IExecutionDMContext)commandControl.getContext(), gdbOutputStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,7 +42,7 @@ class GDBInferiorProcess extends MIInferiorProcess {
|
|||
getSession().getExecutor().submit(new DsfRunnable() {
|
||||
public void run() {
|
||||
if (isDisposed() || !getSession().isActive()) return;
|
||||
GDBControl gdb = (GDBControl)getCommandControl();
|
||||
IGDBControl gdb = (IGDBControl)getCommandControlService();
|
||||
if (gdb == null) return;
|
||||
|
||||
// An inferior will be destroy():interrupt and kill if
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Ericsson - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.gdb.internal.provisional.service.command;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
|
||||
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
||||
import org.eclipse.dd.mi.service.command.AbstractCLIProcess;
|
||||
import org.eclipse.dd.mi.service.command.CLIEventProcessor;
|
||||
import org.eclipse.dd.mi.service.command.MIInferiorProcess;
|
||||
|
||||
public interface IGDBControl extends ICommandControlService {
|
||||
|
||||
SessionType getSessionType();
|
||||
|
||||
boolean getIsAttachSession();
|
||||
boolean canInterrupt();
|
||||
|
||||
void interrupt();
|
||||
|
||||
void destroy();
|
||||
|
||||
void terminate(final RequestMonitor rm);
|
||||
void initInferiorInputOutput(final RequestMonitor requestMonitor);
|
||||
|
||||
boolean canRestart();
|
||||
void start(GdbLaunch launch, final RequestMonitor requestMonitor);
|
||||
void restart(final GdbLaunch launch, final RequestMonitor requestMonitor);
|
||||
void createInferiorProcess();
|
||||
|
||||
boolean isConnected();
|
||||
|
||||
void setConnected(boolean connected);
|
||||
|
||||
Process getGDBProcess();
|
||||
|
||||
AbstractCLIProcess getCLIProcess();
|
||||
|
||||
MIInferiorProcess getInferiorProcess();
|
||||
|
||||
CLIEventProcessor getCLICommandProcessor();
|
||||
|
||||
boolean isGDBExited();
|
||||
|
||||
int getGDBExitCode();
|
||||
|
||||
IPath getExecutablePath();
|
||||
|
||||
void getInferiorProcessId(DataRequestMonitor<String> rm);
|
||||
}
|
|
@ -28,7 +28,7 @@ import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
|||
import org.eclipse.dd.gdb.internal.provisional.launching.LaunchUtils;
|
||||
import org.eclipse.dd.gdb.internal.provisional.launching.ServicesLaunchSequence;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.GdbDebugServicesFactory;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.SessionType;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
|
Loading…
Add table
Reference in a new issue