1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-17 05:55:22 +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:
Marc Khouzam 2008-09-09 18:58:09 +00:00
parent 168df99385
commit 56adb58e42
21 changed files with 159 additions and 77 deletions

View file

@ -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.DsfServicesTracker;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext; 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.dd.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.debug.core.commands.IDebugCommandRequest; import org.eclipse.debug.core.commands.IDebugCommandRequest;
import org.eclipse.debug.core.commands.IEnabledStateRequest; import org.eclipse.debug.core.commands.IEnabledStateRequest;
@ -62,7 +62,7 @@ public class DsfTerminateCommand implements ITerminateHandler {
new DsfRunnable() { new DsfRunnable() {
public void run() { public void run() {
// Get the processes service and the exec context. // 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) { if (gdbControl == null || dmc == null) {
// Context or service already invalid. // Context or service already invalid.
request.setEnabled(false); request.setEnabled(false);
@ -84,7 +84,7 @@ public class DsfTerminateCommand implements ITerminateHandler {
fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) { fExecutor.submit(new DsfCommandRunnable(fTracker, request.getElements()[0], request) {
@Override public void doExecute() { @Override public void doExecute() {
GDBControl gdbControl = fTracker.getService(GDBControl.class); IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
if (gdbControl != null) { if (gdbControl != null) {
gdbControl.terminate(new RequestMonitor(fExecutor, null)); gdbControl.terminate(new RequestMonitor(fExecutor, null));
} }

View file

@ -23,7 +23,7 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
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.gdb.internal.provisional.launching.GdbLaunch; 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.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IProcess; import org.eclipse.debug.core.model.IProcess;
@ -48,7 +48,7 @@ public class GdbRestartCommand implements IRestart {
Query<Boolean> canRestart = new Query<Boolean>() { Query<Boolean> canRestart = new Query<Boolean>() {
@Override @Override
protected void execute(DataRequestMonitor<Boolean> rm) { protected void execute(DataRequestMonitor<Boolean> rm) {
GDBControl gdbControl = fTracker.getService(GDBControl.class); IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
if (gdbControl != null) { if (gdbControl != null) {
rm.setData(gdbControl.canRestart()); rm.setData(gdbControl.canRestart());
} else { } else {
@ -75,7 +75,7 @@ public class GdbRestartCommand implements IRestart {
Query<Object> restartQuery = new Query<Object>() { Query<Object> restartQuery = new Query<Object>() {
@Override @Override
protected void execute(final DataRequestMonitor<Object> rm) { protected void execute(final DataRequestMonitor<Object> rm) {
final GDBControl gdbControl = fTracker.getService(GDBControl.class); final IGDBControl gdbControl = fTracker.getService(IGDBControl.class);
if (gdbControl != null) { if (gdbControl != null) {
execPathRef.set(gdbControl.getExecutablePath()); execPathRef.set(gdbControl.getExecutablePath());
gdbControl.initInferiorInputOutput(new RequestMonitor(fExecutor, rm) { gdbControl.initInferiorInputOutput(new RequestMonitor(fExecutor, rm) {

View file

@ -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.IProcesses.IThreadDMData;
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext; 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.IRunControl.IExecutionDMContext;
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.gdb.internal.provisional.breakpoints.CBreakpointGdbThreadsFilterExtension; 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.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.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.dd.mi.service.IMIExecutionDMContext; import org.eclipse.dd.mi.service.IMIExecutionDMContext;
import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.DebugPlugin;
@ -374,12 +375,12 @@ public class GdbThreadFilterEditor {
return; return;
} }
ServiceTracker tracker = new ServiceTracker(GdbUIPlugin.getBundleContext(), GDBControl.class ServiceTracker tracker = new ServiceTracker(GdbUIPlugin.getBundleContext(), ICommandControlService.class
.getName(), null); .getName(), null);
tracker.open(); tracker.open();
GDBControl gdbControl = (GDBControl) tracker.getService(); ICommandControlService commandControl = (ICommandControlService) tracker.getService();
if (gdbControl != null) { if (commandControl != null) {
rm.setData(gdbControl.getGDBDMContext()); rm.setData((IContainerDMContext)commandControl.getContext());
} else { } else {
rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "GDB Control not accessible.")); //$NON-NLS-1$ rm.setStatus(getFailStatus(IDsfStatusConstants.INVALID_STATE, "GDB Control not accessible.")); //$NON-NLS-1$
} }
@ -454,10 +455,10 @@ public class GdbThreadFilterEditor {
return; return;
} }
ServiceTracker tracker = new ServiceTracker(GdbUIPlugin.getBundleContext(), GDBControl.class ServiceTracker tracker = new ServiceTracker(GdbUIPlugin.getBundleContext(), IGDBControl.class
.getName(), null); .getName(), null);
tracker.open(); tracker.open();
GDBControl gdbControl = (GDBControl) tracker.getService(); IGDBControl gdbControl = (IGDBControl) tracker.getService();
if (gdbControl != null) { if (gdbControl != null) {
rm.setData(gdbControl.getExecutablePath().toOSString()); rm.setData(gdbControl.getExecutablePath().toOSString());
} else { } else {

View file

@ -41,7 +41,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants; import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
import org.eclipse.dd.gdb.internal.provisional.launching.LaunchMessages; 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.dd.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;

View file

@ -11,7 +11,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dd.gdb.internal.ui.launching; 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.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab; import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog; import org.eclipse.debug.ui.ILaunchConfigurationDialog;

View file

@ -10,7 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dd.gdb.internal.ui.launching; 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.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab; import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog; import org.eclipse.debug.ui.ILaunchConfigurationDialog;

View file

@ -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.IProcessDMContext;
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMData; 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.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.ICommandControlInitializedDMEvent;
import org.eclipse.dd.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.dsf.ui.concurrent.ViewerDataRequestMonitor; import org.eclipse.dd.dsf.ui.concurrent.ViewerDataRequestMonitor;
import org.eclipse.dd.dsf.ui.viewmodel.VMDelta; 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.AbstractDMVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext; 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.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
@ -60,14 +60,14 @@ public class ContainerVMNode extends AbstractContainerVMNode
@Override @Override
protected void updateElementsInSessionThread(final IChildrenUpdate update) { protected void updateElementsInSessionThread(final IChildrenUpdate update) {
IProcesses processService = getServicesTracker().getService(IProcesses.class); IProcesses processService = getServicesTracker().getService(IProcesses.class);
GDBControl controlService = getServicesTracker().getService(GDBControl.class); ICommandControlService controlService = getServicesTracker().getService(ICommandControlService.class);
if (processService == null || controlService == null) { if (processService == null || controlService == null) {
handleFailedUpdate(update); handleFailedUpdate(update);
return; return;
} }
processService.getProcessesBeingDebugged( processService.getProcessesBeingDebugged(
controlService.getGDBDMContext(), controlService.getContext(),
new ViewerDataRequestMonitor<IDMContext[]>(getExecutor(), update) { new ViewerDataRequestMonitor<IDMContext[]>(getExecutor(), update) {
@Override @Override
public void handleCompleted() { public void handleCompleted() {

View file

@ -33,12 +33,14 @@ import org.eclipse.dd.dsf.concurrent.DsfExecutor;
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;
import org.eclipse.dd.dsf.datamodel.IDMContext; 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.dsf.service.DsfServicesTracker;
import org.eclipse.dd.gdb.internal.GdbPlugin; import org.eclipse.dd.gdb.internal.GdbPlugin;
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants; import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
import org.eclipse.dd.gdb.internal.provisional.actions.IConnect; 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.SessionType;
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.CSourceLookup; import org.eclipse.dd.mi.service.CSourceLookup;
import org.eclipse.dd.mi.service.IMIProcesses; import org.eclipse.dd.mi.service.IMIProcesses;
import org.eclipse.dd.mi.service.MIBreakpointsManager; import org.eclipse.dd.mi.service.MIBreakpointsManager;
@ -73,7 +75,7 @@ public class FinalLaunchSequence extends Sequence {
}}, }},
new Step() { @Override new Step() { @Override
public void execute(RequestMonitor requestMonitor) { public void execute(RequestMonitor requestMonitor) {
fCommandControl = fTracker.getService(GDBControl.class); fCommandControl = fTracker.getService(IGDBControl.class);
fProcService = fTracker.getService(IMIProcesses.class); fProcService = fTracker.getService(IMIProcesses.class);
if (fCommandControl == null || fProcService == null) { if (fCommandControl == null || fProcService == null) {
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot obtain service", null)); //$NON-NLS-1$ 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 ); IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT );
if (gdbinitFile != null && gdbinitFile.length() > 0) { if (gdbinitFile != null && gdbinitFile.length() > 0) {
fCommandControl.queueCommand( fCommandControl.queueCommand(
new CLISource(fCommandControl.getControlDMContext(), gdbinitFile), new CLISource(fCommandControl.getContext(), gdbinitFile),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) { new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override @Override
protected void handleCompleted() { protected void handleCompleted() {
@ -131,7 +133,7 @@ public class FinalLaunchSequence extends Sequence {
final IPath execPath = fCommandControl.getExecutablePath(); final IPath execPath = fCommandControl.getExecutablePath();
if (!noFileCommand && execPath != null && !execPath.isEmpty()) { if (!noFileCommand && execPath != null && !execPath.isEmpty()) {
fCommandControl.queueCommand( fCommandControl.queueCommand(
new MIFileExecAndSymbols(fCommandControl.getControlDMContext(), new MIFileExecAndSymbols(fCommandControl.getContext(),
execPath.toOSString()), execPath.toOSString()),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor)); new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} else { } else {
@ -150,7 +152,7 @@ public class FinalLaunchSequence extends Sequence {
args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(args); args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(args);
fCommandControl.queueCommand( fCommandControl.queueCommand(
new MIGDBSetArgs(fCommandControl.getControlDMContext(), args), new MIGDBSetArgs(fCommandControl.getContext(), args),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor)); new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} else { } else {
requestMonitor.done(); requestMonitor.done();
@ -216,7 +218,7 @@ public class FinalLaunchSequence extends Sequence {
File dir = getWorkingDirectory(requestMonitor); File dir = getWorkingDirectory(requestMonitor);
if (dir != null) { if (dir != null) {
fCommandControl.queueCommand( fCommandControl.queueCommand(
new MIEnvironmentCD(fCommandControl.getControlDMContext(), dir.getAbsolutePath()), new MIEnvironmentCD(fCommandControl.getContext(), dir.getAbsolutePath()),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor)); new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} else { } else {
requestMonitor.done(); requestMonitor.done();
@ -230,7 +232,7 @@ public class FinalLaunchSequence extends Sequence {
public void execute(final RequestMonitor requestMonitor) { public void execute(final RequestMonitor requestMonitor) {
fCommandControl.queueCommand( fCommandControl.queueCommand(
// This command will fail for GDBs without multi-process support, and that is ok // 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) { new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override @Override
protected void handleCompleted() { protected void handleCompleted() {
@ -256,7 +258,7 @@ public class FinalLaunchSequence extends Sequence {
if (isNonStop) { if (isNonStop) {
// The raw commands should not be necessary in the official GDB release // The raw commands should not be necessary in the official GDB release
fCommandControl.queueCommand( 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) { new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
@ -268,17 +270,17 @@ public class FinalLaunchSequence extends Sequence {
} }
fCommandControl.queueCommand( fCommandControl.queueCommand(
new RawCommand(fCommandControl.getControlDMContext(), asyncCommandStr), new RawCommand(fCommandControl.getContext(), asyncCommandStr),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) { new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
fCommandControl.queueCommand( 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) { new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
fCommandControl.queueCommand( fCommandControl.queueCommand(
new MIGDBSetNonStop(fCommandControl.getControlDMContext(), true), new MIGDBSetNonStop(fCommandControl.getContext(), true),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor)); new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} }
}); });
@ -299,7 +301,7 @@ public class FinalLaunchSequence extends Sequence {
boolean autolib = fLaunch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, boolean autolib = fLaunch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB,
IGDBLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT); IGDBLaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT);
fCommandControl.queueCommand( fCommandControl.queueCommand(
new MIGDBSetAutoSolib(fCommandControl.getControlDMContext(), autolib), new MIGDBSetAutoSolib(fCommandControl.getContext(), autolib),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor)); new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} catch (CoreException e) { } catch (CoreException e) {
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot set shared library option", e)); //$NON-NLS-1$ 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) { if (p.size() > 0) {
String[] paths = p.toArray(new String[p.size()]); String[] paths = p.toArray(new String[p.size()]);
fCommandControl.queueCommand( fCommandControl.queueCommand(
new MIGDBSetSolibSearchPath(fCommandControl.getControlDMContext(), paths), new MIGDBSetSolibSearchPath(fCommandControl.getContext(), paths),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) { new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override @Override
protected void handleSuccess() { protected void handleSuccess() {
@ -330,7 +332,7 @@ public class FinalLaunchSequence extends Sequence {
// // in the GDB documentation. This is to avoid the sysroot // // in the GDB documentation. This is to avoid the sysroot
// // variable finding libraries that were not meant to be found. // // variable finding libraries that were not meant to be found.
// fCommandControl.queueCommand( // fCommandControl.queueCommand(
// new MIGDBSetSysroot(fCommandControl.getControlDMContext()), // new MIGDBSetSysroot(fCommandControl.getContext()),
// new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor)); // new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
}; };
}); });
@ -350,7 +352,7 @@ public class FinalLaunchSequence extends Sequence {
CSourceLookup sourceLookup = fTracker.getService(CSourceLookup.class); CSourceLookup sourceLookup = fTracker.getService(CSourceLookup.class);
CSourceLookupDirector locator = (CSourceLookupDirector)fLaunch.getSourceLocator(); CSourceLookupDirector locator = (CSourceLookupDirector)fLaunch.getSourceLocator();
sourceLookup.setSourceLookupPath(fCommandControl.getGDBDMContext(), sourceLookup.setSourceLookupPath((ISourceLookupDMContext)fCommandControl.getContext(),
locator.getSourceContainers(), requestMonitor); locator.getSourceContainers(), requestMonitor);
}}, }},
/* /*
@ -421,14 +423,14 @@ public class FinalLaunchSequence extends Sequence {
if (!getTcpPort(requestMonitor)) return; if (!getTcpPort(requestMonitor)) return;
fCommandControl.queueCommand( fCommandControl.queueCommand(
new MITargetSelect(fCommandControl.getControlDMContext(), new MITargetSelect(fCommandControl.getContext(),
fRemoteTcpHost, fRemoteTcpPort), fRemoteTcpHost, fRemoteTcpPort),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor)); new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} else { } else {
if (!getSerialDevice(requestMonitor)) return; if (!getSerialDevice(requestMonitor)) return;
fCommandControl.queueCommand( fCommandControl.queueCommand(
new MITargetSelect(fCommandControl.getControlDMContext(), new MITargetSelect(fCommandControl.getContext(),
fSerialDevice), fSerialDevice),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor)); new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} }
@ -455,7 +457,7 @@ public class FinalLaunchSequence extends Sequence {
if (pid != -1) { if (pid != -1) {
fProcService.attachDebuggerToProcess( fProcService.attachDebuggerToProcess(
fProcService.createProcessContext(fCommandControl.getGDBDMContext(), Integer.toString(pid)), fProcService.createProcessContext(fCommandControl.getContext(), Integer.toString(pid)),
new DataRequestMonitor<IDMContext>(getExecutor(), requestMonitor)); new DataRequestMonitor<IDMContext>(getExecutor(), requestMonitor));
} else { } else {
IConnect connectCommand = (IConnect)fLaunch.getSession().getModelAdapter(IConnect.class); IConnect connectCommand = (IConnect)fLaunch.getSession().getModelAdapter(IConnect.class);
@ -476,7 +478,7 @@ public class FinalLaunchSequence extends Sequence {
new Step() { @Override new Step() { @Override
public void execute(final RequestMonitor requestMonitor) { public void execute(final RequestMonitor requestMonitor) {
MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class); MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class);
bpmService.startTrackingBreakpoints(fCommandControl.getGDBDMContext(), requestMonitor); bpmService.startTrackingBreakpoints((IBreakpointsTargetDMContext)fCommandControl.getContext(), requestMonitor);
}}, }},
/* /*
* Start the program. * Start the program.
@ -504,7 +506,7 @@ public class FinalLaunchSequence extends Sequence {
SessionType fSessionType; SessionType fSessionType;
boolean fAttach; boolean fAttach;
GDBControl fCommandControl; IGDBControl fCommandControl;
IMIProcesses fProcService; IMIProcesses fProcService;
DsfServicesTracker fTracker; DsfServicesTracker fTracker;

View file

@ -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.model.DsfMemoryBlockRetrieval;
import org.eclipse.dd.dsf.debug.service.IDsfDebugServicesFactory; import org.eclipse.dd.dsf.debug.service.IDsfDebugServicesFactory;
import org.eclipse.dd.dsf.debug.service.IMemory.IMemoryDMContext; 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.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
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.gdb.internal.GdbPlugin; 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.AbstractCLIProcess;
import org.eclipse.dd.mi.service.command.MIInferiorProcess; import org.eclipse.dd.mi.service.command.MIInferiorProcess;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
@ -108,12 +109,12 @@ public class GdbLaunch extends Launch
try { try {
fExecutor.submit( new Callable<Object>() { fExecutor.submit( new Callable<Object>() {
public Object call() throws CoreException { public Object call() throws CoreException {
GDBControl gdbControl = fTracker.getService(GDBControl.class); ICommandControlService gdbControl = fTracker.getService(ICommandControlService.class);
if (gdbControl != null) { if (gdbControl != null) {
fMemRetrieval = new DsfMemoryBlockRetrieval( fMemRetrieval = new DsfMemoryBlockRetrieval(
GdbLaunchDelegate.GDB_DEBUG_MODEL_ID, getLaunchConfiguration(), fSession); GdbLaunchDelegate.GDB_DEBUG_MODEL_ID, getLaunchConfiguration(), fSession);
fSession.registerModelAdapter(IMemoryBlockRetrieval.class, fMemRetrieval); fSession.registerModelAdapter(IMemoryBlockRetrieval.class, fMemRetrieval);
fMemRetrieval.initialize((IMemoryDMContext) gdbControl.getControlDMContext()); fMemRetrieval.initialize((IMemoryDMContext) gdbControl.getContext());
} }
return null; return null;
} }
@ -136,7 +137,7 @@ public class GdbLaunch extends Launch
MIInferiorProcess inferiorProc = MIInferiorProcess inferiorProc =
getDsfExecutor().submit( new Callable<MIInferiorProcess>() { getDsfExecutor().submit( new Callable<MIInferiorProcess>() {
public MIInferiorProcess call() throws CoreException { public MIInferiorProcess call() throws CoreException {
GDBControl gdb = fTracker.getService(GDBControl.class); IGDBControl gdb = fTracker.getService(IGDBControl.class);
if (gdb != null) { if (gdb != null) {
return gdb.getInferiorProcess(); return gdb.getInferiorProcess();
} }
@ -161,7 +162,7 @@ public class GdbLaunch extends Launch
AbstractCLIProcess cliProc = AbstractCLIProcess cliProc =
getDsfExecutor().submit( new Callable<AbstractCLIProcess>() { getDsfExecutor().submit( new Callable<AbstractCLIProcess>() {
public AbstractCLIProcess call() throws CoreException { public AbstractCLIProcess call() throws CoreException {
GDBControl gdb = fTracker.getService(GDBControl.class); IGDBControl gdb = fTracker.getService(IGDBControl.class);
if (gdb != null) { if (gdb != null) {
return gdb.getCLIProcess(); return gdb.getCLIProcess();
} }

View file

@ -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.IGDBLaunchConfigurationConstants;
import org.eclipse.dd.gdb.internal.provisional.service.GdbDebugServicesFactory; 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.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.DebugException;
import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;

View file

@ -37,7 +37,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.dd.gdb.internal.GdbPlugin; import org.eclipse.dd.gdb.internal.GdbPlugin;
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants; 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.DebugException;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;

View file

@ -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.IRunControl;
import org.eclipse.dd.dsf.debug.service.ISourceLookup; import org.eclipse.dd.dsf.debug.service.ISourceLookup;
import org.eclipse.dd.dsf.debug.service.IStack; 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.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.CSourceLookup;
import org.eclipse.dd.mi.service.MIBreakpointsManager; import org.eclipse.dd.mi.service.MIBreakpointsManager;
@ -38,7 +39,7 @@ public class ServicesLaunchSequence extends Sequence {
// //
// Create the connection. // Create the connection.
// //
fCommandControl = fLaunch.getServiceFactory().createService(GDBControl.class, fSession, fLaunch.getLaunchConfiguration()); fCommandControl = fLaunch.getServiceFactory().createService(ICommandControlService.class, fSession, fLaunch.getLaunchConfiguration());
fCommandControl.initialize(requestMonitor); fCommandControl.initialize(requestMonitor);
} }
}, },
@ -73,7 +74,7 @@ public class ServicesLaunchSequence extends Sequence {
}}, }},
new Step() { @Override new Step() { @Override
public void execute(RequestMonitor requestMonitor) { public void execute(RequestMonitor requestMonitor) {
fSourceLookup.setSourceLookupDirector(fCommandControl.getGDBDMContext(), (CSourceLookupDirector)fLaunch.getSourceLocator()); fSourceLookup.setSourceLookupDirector((ISourceLookupDMContext)fCommandControl.getContext(), (CSourceLookupDirector)fLaunch.getSourceLocator());
requestMonitor.done(); requestMonitor.done();
}}, }},
new Step() { @Override new Step() { @Override
@ -100,7 +101,7 @@ public class ServicesLaunchSequence extends Sequence {
DsfSession fSession; DsfSession fSession;
GdbLaunch fLaunch; GdbLaunch fLaunch;
GDBControl fCommandControl; ICommandControlService fCommandControl;
CSourceLookup fSourceLookup; CSourceLookup fSourceLookup;
public ServicesLaunchSequence(DsfSession session, GdbLaunch launch) { public ServicesLaunchSequence(DsfSession session, GdbLaunch launch) {

View file

@ -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.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.gdb.internal.GdbPlugin; 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.gdb.internal.provisional.service.command.GDBControl.SessionType;
import org.eclipse.dd.mi.service.IMIExecutionGroupDMContext; import org.eclipse.dd.mi.service.IMIExecutionGroupDMContext;
import org.eclipse.dd.mi.service.IMIProcessDMContext; import org.eclipse.dd.mi.service.IMIProcessDMContext;
import org.eclipse.dd.mi.service.IMIProcesses; import org.eclipse.dd.mi.service.IMIProcesses;
@ -43,7 +42,7 @@ import org.osgi.framework.BundleContext;
public class GDBProcesses extends MIProcesses { 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 // A map of pid to names. It is filled when we get all the
// processes that are running // processes that are running
@ -73,7 +72,7 @@ public class GDBProcesses extends MIProcesses {
*/ */
private void doInitialize(RequestMonitor requestMonitor) { private void doInitialize(RequestMonitor requestMonitor) {
fGdb = getServicesTracker().getService(GDBControl.class); fGdb = getServicesTracker().getService(IGDBControl.class);
// Register this service. // Register this service.
register(new String[] { IProcesses.class.getName(), register(new String[] { IProcesses.class.getName(),

View file

@ -39,7 +39,7 @@ import org.eclipse.dd.dsf.service.AbstractDsfService;
import org.eclipse.dd.dsf.service.DsfServiceEventHandler; 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.gdb.internal.GdbPlugin; 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.internal.MIPlugin;
import org.eclipse.dd.mi.service.IMIExecutionDMContext; import org.eclipse.dd.mi.service.IMIExecutionDMContext;
import org.eclipse.dd.mi.service.IMIExecutionGroupDMContext; 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 // A cache for commands about the threadGroups
private CommandCache fContainerCommandCache; private CommandCache fContainerCommandCache;
@ -362,11 +362,11 @@ public class GDBProcesses_7_0 extends AbstractDsfService implements IMIProcesses
*/ */
private void doInitialize(RequestMonitor requestMonitor) { private void doInitialize(RequestMonitor requestMonitor) {
fCommandControl = getServicesTracker().getService(GDBControl.class); fCommandControl = getServicesTracker().getService(IGDBControl.class);
fContainerCommandCache = new CommandCache(getSession(), fCommandControl); fContainerCommandCache = new CommandCache(getSession(), fCommandControl);
fContainerCommandCache.setContextAvailable(fCommandControl.getControlDMContext(), true); fContainerCommandCache.setContextAvailable(fCommandControl.getContext(), true);
fThreadCommandCache = new CommandCache(getSession(), fCommandControl); fThreadCommandCache = new CommandCache(getSession(), fCommandControl);
fThreadCommandCache.setContextAvailable(fCommandControl.getControlDMContext(), true); fThreadCommandCache.setContextAvailable(fCommandControl.getContext(), true);
getSession().addServiceEventListener(this, null); getSession().addServiceEventListener(this, null);

View file

@ -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.debug.service.IProcesses.IThreadDMContext;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.gdb.internal.GdbPlugin; 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.internal.MIPlugin;
import org.eclipse.dd.mi.service.IMIExecutionDMContext; import org.eclipse.dd.mi.service.IMIExecutionDMContext;
import org.eclipse.dd.mi.service.IMIProcesses; 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; import org.eclipse.dd.mi.service.command.events.MIThreadExitEvent;
public class GDBRunControl extends MIRunControl { public class GDBRunControl extends MIRunControl {
private GDBControl fGdb; private IGDBControl fGdb;
private IMIProcesses fProcService; private IMIProcesses fProcService;
// Record list of execution contexts // Record list of execution contexts
@ -61,7 +61,7 @@ public class GDBRunControl extends MIRunControl {
private void doInitialize(final RequestMonitor requestMonitor) { private void doInitialize(final RequestMonitor requestMonitor) {
fGdb = getServicesTracker().getService(GDBControl.class); fGdb = getServicesTracker().getService(IGDBControl.class);
fProcService = getServicesTracker().getService(IMIProcesses.class); fProcService = getServicesTracker().getService(IMIProcesses.class);
register(new String[]{IRunControl.class.getName(), register(new String[]{IRunControl.class.getName(),

View file

@ -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 }

View file

@ -16,6 +16,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RejectedExecutionException;
import org.eclipse.dd.dsf.concurrent.DsfRunnable; 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.dsf.service.DsfSession;
import org.eclipse.dd.mi.service.command.AbstractCLIProcess; import org.eclipse.dd.mi.service.command.AbstractCLIProcess;
@ -24,7 +25,7 @@ import org.eclipse.dd.mi.service.command.AbstractCLIProcess;
*/ */
class GDBCLIProcess extends AbstractCLIProcess { class GDBCLIProcess extends AbstractCLIProcess {
public GDBCLIProcess(GDBControl commandControl) throws IOException { public GDBCLIProcess(ICommandControlService commandControl) throws IOException {
super(commandControl); super(commandControl);
} }
@ -41,7 +42,7 @@ class GDBCLIProcess extends AbstractCLIProcess {
process = getSession().getExecutor().submit(new Callable<Process>() { process = getSession().getExecutor().submit(new Callable<Process>() {
public Process call() throws Exception { public Process call() throws Exception {
if (isDisposed()) return null; if (isDisposed()) return null;
return ((GDBControl)getCommandControl()).getGDBProcess(); return ((IGDBControl)getCommandControlService()).getGDBProcess();
}}).get(); }}).get();
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {
} catch (ExecutionException e) { } catch (ExecutionException e) {
@ -64,7 +65,7 @@ class GDBCLIProcess extends AbstractCLIProcess {
return new Integer(-1); return new Integer(-1);
} else { } else {
if (isDisposed()) return new Integer(-1); if (isDisposed()) return new Integer(-1);
GDBControl gdb = (GDBControl)getCommandControl(); IGDBControl gdb = (IGDBControl)getCommandControlService();
if (!gdb.isGDBExited()) { if (!gdb.isGDBExited()) {
throw new IllegalThreadStateException("GDB Process has not exited"); //$NON-NLS-1$ 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() { getSession().getExecutor().execute(new DsfRunnable() { public void run() {
if (!DsfSession.isSessionActive(getSession().getId())) return; if (!DsfSession.isSessionActive(getSession().getId())) return;
if (isDisposed()) return; if (isDisposed()) return;
GDBControl gdb = (GDBControl)getCommandControl(); IGDBControl gdb = (IGDBControl)getCommandControlService();
gdb.destroy(); gdb.destroy();
}}); }});
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {

View file

@ -46,6 +46,7 @@ import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.gdb.internal.GdbPlugin; import org.eclipse.dd.gdb.internal.GdbPlugin;
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch; 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.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.AbstractCLIProcess;
import org.eclipse.dd.mi.service.command.AbstractMIControl; import org.eclipse.dd.mi.service.command.AbstractMIControl;
import org.eclipse.dd.mi.service.command.CLIEventProcessor; import org.eclipse.dd.mi.service.command.CLIEventProcessor;
@ -72,7 +73,7 @@ import org.osgi.framework.BundleContext;
* - CLI console support,<br> * - CLI console support,<br>
* - inferior process status tracking.<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. * Event indicating that the back end process has started.
@ -99,7 +100,6 @@ public class GDBControl extends AbstractMIControl {
private static int fgInstanceCounter = 0; private static int fgInstanceCounter = 0;
private final GDBControlDMContext fControlDmc; private final GDBControlDMContext fControlDmc;
public enum SessionType { LOCAL, REMOTE, CORE }
private SessionType fSessionType; private SessionType fSessionType;
private boolean fAttach; private boolean fAttach;
@ -743,7 +743,8 @@ public class GDBControl extends AbstractMIControl {
register( register(
new String[]{ ICommandControl.class.getName(), new String[]{ ICommandControl.class.getName(),
ICommandControlService.class.getName(), ICommandControlService.class.getName(),
AbstractMIControl.class.getName() }, AbstractMIControl.class.getName(),
IGDBControl.class.getName() },
new Hashtable<String,String>()); new Hashtable<String,String>());
getSession().dispatchEvent(new GDBControlInitializedDMEvent(getGDBDMContext()), getProperties()); getSession().dispatchEvent(new GDBControlInitializedDMEvent(getGDBDMContext()), getProperties());
requestMonitor.done(); requestMonitor.done();

View file

@ -17,6 +17,8 @@ import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.utils.pty.PTY; import org.eclipse.cdt.utils.pty.PTY;
import org.eclipse.dd.dsf.concurrent.DsfRunnable; import org.eclipse.dd.dsf.concurrent.DsfRunnable;
import org.eclipse.dd.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor; 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; import org.eclipse.dd.mi.service.command.MIInferiorProcess;
/** /**
@ -25,12 +27,12 @@ import org.eclipse.dd.mi.service.command.MIInferiorProcess;
class GDBInferiorProcess extends MIInferiorProcess { class GDBInferiorProcess extends MIInferiorProcess {
public GDBInferiorProcess(GDBControl commandControl, PTY p) { public GDBInferiorProcess(ICommandControlService commandControl, PTY p) {
super(commandControl, commandControl.getGDBDMContext(), p); super(commandControl, (IExecutionDMContext)commandControl.getContext(), p);
} }
public GDBInferiorProcess(GDBControl commandControl, OutputStream gdbOutputStream) { public GDBInferiorProcess(ICommandControlService commandControl, OutputStream gdbOutputStream) {
super(commandControl, commandControl.getGDBDMContext(), gdbOutputStream); super(commandControl, (IExecutionDMContext)commandControl.getContext(), gdbOutputStream);
} }
@Override @Override
@ -40,7 +42,7 @@ class GDBInferiorProcess extends MIInferiorProcess {
getSession().getExecutor().submit(new DsfRunnable() { getSession().getExecutor().submit(new DsfRunnable() {
public void run() { public void run() {
if (isDisposed() || !getSession().isActive()) return; if (isDisposed() || !getSession().isActive()) return;
GDBControl gdb = (GDBControl)getCommandControl(); IGDBControl gdb = (IGDBControl)getCommandControlService();
if (gdb == null) return; if (gdb == null) return;
// An inferior will be destroy():interrupt and kill if // An inferior will be destroy():interrupt and kill if

View file

@ -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);
}

View file

@ -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.LaunchUtils;
import org.eclipse.dd.gdb.internal.provisional.launching.ServicesLaunchSequence; 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.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.DebugException;
import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;