diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java index b02cfa0ceb2..a06e867254d 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/FinalLaunchSequence.java @@ -34,17 +34,7 @@ import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl; import org.eclipse.cdt.dsf.mi.service.CSourceLookup; import org.eclipse.cdt.dsf.mi.service.IMIProcesses; import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLISource; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIEnvironmentCD; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIFileExecAndSymbols; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetArgs; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetAutoSolib; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetNonStop; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPagination; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSolibSearchPath; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetTargetAsync; -import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelect; -import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelectCore; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.core.runtime.CoreException; @@ -93,6 +83,8 @@ public class FinalLaunchSequence extends Sequence { requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot obtain control service", null)); //$NON-NLS-1$ } + fCommandFactory = fCommandControl.getCommandFactory(); + requestMonitor.done(); }}, /* @@ -117,7 +109,7 @@ public class FinalLaunchSequence extends Sequence { if (gdbinitFile != null && gdbinitFile.length() > 0) { fCommandControl.queueCommand( - new CLISource(fCommandControl.getContext(), gdbinitFile), + fCommandFactory.createCLISource(fCommandControl.getContext(), gdbinitFile), new DataRequestMonitor(getExecutor(), requestMonitor) { @Override protected void handleCompleted() { @@ -157,7 +149,7 @@ public class FinalLaunchSequence extends Sequence { final IPath execPath = fGDBBackend.getProgramPath(); if (!noFileCommand && execPath != null && !execPath.isEmpty()) { fCommandControl.queueCommand( - new MIFileExecAndSymbols(fCommandControl.getContext(), + fCommandFactory.createMIFileExecAndSymbols(fCommandControl.getContext(), execPath.toPortableString()), new DataRequestMonitor(getExecutor(), requestMonitor)); } else { @@ -174,7 +166,7 @@ public class FinalLaunchSequence extends Sequence { if (args != null) { fCommandControl.queueCommand( - new MIGDBSetArgs(fCommandControl.getContext(), args), + fCommandFactory.createMIGDBSetArgs(fCommandControl.getContext(), args), new DataRequestMonitor(getExecutor(), requestMonitor)); } else { requestMonitor.done(); @@ -200,7 +192,7 @@ public class FinalLaunchSequence extends Sequence { if (dir != null) { fCommandControl.queueCommand( - new MIEnvironmentCD(fCommandControl.getContext(), dir.toPortableString()), + fCommandFactory.createMIEnvironmentCD(fCommandControl.getContext(), dir.toPortableString()), new DataRequestMonitor(getExecutor(), requestMonitor)); } else { requestMonitor.done(); @@ -246,17 +238,17 @@ public class FinalLaunchSequence extends Sequence { if (isNonStop) { // The raw commands should not be necessary in the official GDB release fCommandControl.queueCommand( - new MIGDBSetTargetAsync(fCommandControl.getContext(), true), + fCommandFactory.createMIGDBSetTargetAsync(fCommandControl.getContext(), true), new DataRequestMonitor(getExecutor(), requestMonitor) { @Override protected void handleSuccess() { fCommandControl.queueCommand( - new MIGDBSetPagination(fCommandControl.getContext(), false), + fCommandFactory.createMIGDBSetPagination(fCommandControl.getContext(), false), new DataRequestMonitor(getExecutor(), requestMonitor) { @Override protected void handleSuccess() { fCommandControl.queueCommand( - new MIGDBSetNonStop(fCommandControl.getContext(), true), + fCommandFactory.createMIGDBSetNonStop(fCommandControl.getContext(), true), new DataRequestMonitor(getExecutor(), requestMonitor)); } }); @@ -275,7 +267,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.getContext(), autolib), + fCommandFactory.createMIGDBSetAutoSolib(fCommandControl.getContext(), autolib), new DataRequestMonitor(getExecutor(), requestMonitor)); } catch (CoreException e) { requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot set shared library option", e)); //$NON-NLS-1$ @@ -293,7 +285,7 @@ public class FinalLaunchSequence extends Sequence { if (p.size() > 0) { String[] paths = p.toArray(new String[p.size()]); fCommandControl.queueCommand( - new MIGDBSetSolibSearchPath(fCommandControl.getContext(), paths), + fCommandFactory.createMIGDBSetSolibSearchPath(fCommandControl.getContext(), paths), new DataRequestMonitor(getExecutor(), requestMonitor) { @Override protected void handleSuccess() { @@ -391,14 +383,14 @@ public class FinalLaunchSequence extends Sequence { requestMonitor.done(); } else { fCommandControl.queueCommand( - new MITargetSelectCore(fCommandControl.getContext(), newCoreFile), + fCommandFactory.createMITargetSelectCore(fCommandControl.getContext(), newCoreFile), new DataRequestMonitor(getExecutor(), requestMonitor)); } } }).schedule(); } else { fCommandControl.queueCommand( - new MITargetSelectCore(fCommandControl.getContext(), coreFile), + fCommandFactory.createMITargetSelectCore(fCommandControl.getContext(), coreFile), new DataRequestMonitor(getExecutor(), requestMonitor)); } } catch (CoreException e) { @@ -478,14 +470,14 @@ public class FinalLaunchSequence extends Sequence { if (!getTcpPort(requestMonitor)) return; fCommandControl.queueCommand( - new MITargetSelect(fCommandControl.getContext(), + fCommandFactory.createMITargetSelect(fCommandControl.getContext(), fRemoteTcpHost, fRemoteTcpPort, fAttach), new DataRequestMonitor(getExecutor(), requestMonitor)); } else { if (!getSerialDevice(requestMonitor)) return; fCommandControl.queueCommand( - new MITargetSelect(fCommandControl.getContext(), + fCommandFactory.createMITargetSelect(fCommandControl.getContext(), fSerialDevice, fAttach), new DataRequestMonitor(getExecutor(), requestMonitor)); } @@ -594,6 +586,7 @@ public class FinalLaunchSequence extends Sequence { private IGDBControl fCommandControl; private IGDBBackend fGDBBackend; private IMIProcesses fProcService; + private CommandFactory fCommandFactory; DsfServicesTracker fTracker; diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java index 8072f56bae1..f821fcaf993 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java @@ -23,13 +23,11 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext; import org.eclipse.cdt.dsf.debug.service.IBreakpoints; import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMIRunControl; import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData; import org.eclipse.cdt.dsf.mi.service.MIBreakpoints; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLIPasscount; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLITrace; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakList; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.CLITraceInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakListInfo; @@ -49,6 +47,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints { private ICommandControl fConnection; private IMIRunControl fRunControl; + private CommandFactory fCommandFactory; public GDBBreakpoints_7_0(DsfSession session) { super(session); @@ -71,6 +70,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints // Get the services references fConnection = getServicesTracker().getService(ICommandControl.class); fRunControl = getServicesTracker().getService(IMIRunControl.class); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); // Register this service register(new String[] { IBreakpoints.class.getName(), @@ -130,7 +130,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints public void execute(final RequestMonitor rm) { // Execute the command fConnection.queueCommand( - new MIBreakInsert(context, isTemporary, isHardware, condition, ignoreCount, location, tid, !enabled, false), + fCommandFactory.createMIBreakInsert(context, isTemporary, isHardware, condition, ignoreCount, location, tid, !enabled, false), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -203,7 +203,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints final String condition = (String) getProperty(attributes, MIBreakpoints.CONDITION, NULL_STRING); fConnection.queueCommand( - new CLITrace(context, location, condition), + fCommandFactory.createCLITrace(context, location, condition), new DataRequestMonitor(getExecutor(), drm) { @Override protected void handleSuccess() { @@ -217,7 +217,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints // The simplest way to convert from the CLITraceInfo to a MIBreakInsertInfo // is to list the breakpoints and take the proper output fConnection.queueCommand( - new MIBreakList(context), + fCommandFactory.createMIBreakList(context), new DataRequestMonitor(getExecutor(), drm) { @Override protected void handleSuccess() { @@ -420,7 +420,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints // Queue the command fConnection.queueCommand( - new CLIPasscount(context, reference, ignoreCount), + fCommandFactory.createCLIPasscount(context, reference, ignoreCount), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java index 42876bd5213..e6a25c432ca 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java @@ -42,15 +42,13 @@ import org.eclipse.cdt.dsf.debug.service.command.IEventListener; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext; import org.eclipse.cdt.dsf.mi.service.IMIProcesses; import org.eclipse.cdt.dsf.mi.service.MIProcesses; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIListThreadGroups; -import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetAttach; -import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetDetach; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIThreadInfo; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.events.MIThreadGroupCreatedEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIThreadGroupExitedEvent; import org.eclipse.cdt.dsf.mi.service.command.output.MIConst; @@ -374,7 +372,8 @@ public class GDBProcesses_7_0 extends AbstractDsfService private IGDBControl fCommandControl; private IGDBBackend fBackend; - + private CommandFactory fCommandFactory; + // A cache for commands about the threadGroups private CommandCache fContainerCommandCache; @@ -434,6 +433,8 @@ public class GDBProcesses_7_0 extends AbstractDsfService fBackend = getServicesTracker().getService(IGDBBackend.class); BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(fCommandControl, getExecutor(), 2); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + // These caches store the result of a command when received; also, these caches // are manipulated when receiving events. Currently, events are received after // three scheduling of the executor, while command results after only one. This @@ -581,7 +582,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService final MIThreadDMC threadDmc = (MIThreadDMC)dmc; ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class); - fThreadCommandCache.execute(new MIThreadInfo(controlDmc, threadDmc.getId()), + fThreadCommandCache.execute(fCommandFactory.createMIThreadInfo(controlDmc, threadDmc.getId()), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -646,7 +647,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(procCtx, ICommandControlDMContext.class); fCommandControl.queueCommand( - new MITargetAttach(controlDmc, ((IMIProcessDMContext)procCtx).getProcId()), + fCommandFactory.createMITargetAttach(controlDmc, ((IMIProcessDMContext)procCtx).getProcId()), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -689,7 +690,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService } fCommandControl.queueCommand( - new MITargetDetach(controlDmc, procDmc.getProcId()), + fCommandFactory.createMITargetDetach(controlDmc, procDmc.getProcId()), new DataRequestMonitor(getExecutor(), rm)); } else { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid context.", null)); //$NON-NLS-1$ @@ -719,7 +720,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService final IMIContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class); if (containerDmc != null) { fThreadCommandCache.execute( - new MIListThreadGroups(controlDmc, containerDmc.getGroupId()), + fCommandFactory.createMIListThreadGroups(controlDmc, containerDmc.getGroupId()), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -767,7 +768,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService if (controlDmc != null) { fListThreadGroupsAvailableCache.execute( - new MIListThreadGroups(controlDmc, true), + fCommandFactory.createMIListThreadGroups(controlDmc, true), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleCompleted() { @@ -937,7 +938,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService // GDB is debugging a new process. Let's fetch its name and remember it. final String finalGroupId = groupId; fListThreadGroupsAvailableCache.execute( - new MIListThreadGroups(fCommandControl.getContext(), true), + fCommandFactory.createMIListThreadGroups(fCommandControl.getContext(), true), new DataRequestMonitor(getExecutor(), null) { @Override protected void handleCompleted() { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java index 8112796b74f..93b8687e5da 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl.java @@ -29,14 +29,13 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext; import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; import org.eclipse.cdt.dsf.mi.service.IMIProcesses; import org.eclipse.cdt.dsf.mi.service.IMIRunControl; import org.eclipse.cdt.dsf.mi.service.MIRunControl; import org.eclipse.cdt.dsf.mi.service.MIStack; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakDelete; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecContinue; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.events.MIBreakpointHitEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIInferiorExitEvent; @@ -76,7 +75,8 @@ public class GDBRunControl extends MIRunControl { private IGDBBackend fGdb; private IMIProcesses fProcService; - + private CommandFactory fCommandFactory; + // Record list of execution contexts private IExecutionDMContext[] fOldExecutionCtxts; @@ -101,6 +101,7 @@ public class GDBRunControl extends MIRunControl { fGdb = getServicesTracker().getService(IGDBBackend.class); fProcService = getServicesTracker().getService(IMIProcesses.class); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); register(new String[]{IRunControl.class.getName(), IRunControl2.class.getName(), @@ -274,7 +275,7 @@ public class GDBRunControl extends MIRunControl { if (doCanResume(dmc)) { IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context, IBreakpointsTargetDMContext.class); getConnection().queueCommand( - new MIBreakInsert(bpDmc, true, false, null, 0, + fCommandFactory.createMIBreakInsert(bpDmc, true, false, null, 0, location, dmc.getThreadId()), new DataRequestMonitor(getExecutor(), rm) { @Override @@ -292,7 +293,7 @@ public class GDBRunControl extends MIRunControl { IBreakpointsTargetDMContext.class); int bpId = fRunToLineActiveOperation.getBreakointId(); - getConnection().queueCommand(new MIBreakDelete(bpDmc, new int[] {bpId}), + getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {bpId}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; @@ -321,7 +322,7 @@ public class GDBRunControl extends MIRunControl { IBreakpointsTargetDMContext.class); int bpId = fRunToLineActiveOperation.getBreakointId(); - getConnection().queueCommand(new MIBreakDelete(bpDmc, new int[] {bpId}), + getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {bpId}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; } @@ -358,7 +359,7 @@ public class GDBRunControl extends MIRunControl { // Didn't stop at the right place yet if (fRunToLineActiveOperation.shouldSkipBreakpoints() && e instanceof MIBreakpointHitEvent) { getConnection().queueCommand( - new MIExecContinue(fRunToLineActiveOperation.getThreadContext()), + fCommandFactory.createMIExecContinue(fRunToLineActiveOperation.getThreadContext()), new DataRequestMonitor(getExecutor(), null)); // Don't send the stop event since we are resuming again. @@ -375,7 +376,7 @@ public class GDBRunControl extends MIRunControl { IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class); - getConnection().queueCommand(new MIBreakDelete(bpDmc, new int[] {fRunToLineActiveOperation.getBreakointId()}), + getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {fRunToLineActiveOperation.getBreakointId()}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java index d80cb8de1d0..59adbe7edd8 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0.java @@ -27,25 +27,16 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext; import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext; import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; +import org.eclipse.cdt.dsf.debug.service.command.ICommand; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; import org.eclipse.cdt.dsf.mi.service.IMIProcesses; import org.eclipse.cdt.dsf.mi.service.IMIRunControl; import org.eclipse.cdt.dsf.mi.service.MIRunControl; import org.eclipse.cdt.dsf.mi.service.MIStack; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLIRecord; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakDelete; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; -import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecContinue; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecJump; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseContinue; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseNext; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseNextInstruction; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseStep; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseStepInstruction; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecUncall; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.events.MIBreakpointHitEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIInferiorExitEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent; @@ -83,6 +74,8 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro private IGDBBackend fGdb; private IMIProcesses fProcService; + private CommandFactory fCommandFactory; + private boolean fReverseSupported = true; private boolean fReverseStepping = false; private boolean fReverseModeEnabled = false; @@ -107,6 +100,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro fGdb = getServicesTracker().getService(IGDBBackend.class); fProcService = getServicesTracker().getService(IMIProcesses.class); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); if (fGdb.getSessionType() == SessionType.CORE) { // No execution for core files, so no support for reverse @@ -299,9 +293,9 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro /** @since 2.0 */ public void reverseResume(final IExecutionDMContext context, final RequestMonitor rm) { if (fReverseModeEnabled && doCanResume(context)) { - MIExecReverseContinue cmd = null; + ICommand cmd = null; if (context instanceof IContainerDMContext) { - cmd = new MIExecReverseContinue(context); + cmd = fCommandFactory.createMIExecReverseContinue(context); } else { IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class); if (dmc == null){ @@ -309,7 +303,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro rm.done(); return; } - cmd = new MIExecReverseContinue(dmc); + cmd = fCommandFactory.createMIExecReverseContinue(dmc); } setResumePending(true); @@ -349,13 +343,13 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro return; } - MICommand cmd = null; + ICommand cmd = null; switch(stepType) { case STEP_INTO: - cmd = new MIExecReverseStep(dmc, 1); + cmd = fCommandFactory.createMIExecReverseStep(dmc, 1); break; case STEP_OVER: - cmd = new MIExecReverseNext(dmc, 1); + cmd = fCommandFactory.createMIExecReverseNext(dmc, 1); break; case STEP_RETURN: // The -exec-finish command operates on the selected stack frame, but here we always @@ -367,7 +361,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro MIStack stackService = getServicesTracker().getService(MIStack.class); if (stackService != null) { IFrameDMContext topFrameDmc = stackService.createFrameDMContext(dmc, 0); - cmd = new MIExecUncall(topFrameDmc); + cmd = fCommandFactory.createMIExecUncall(topFrameDmc); } else { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Cannot create context for command, stack service not available.", null)); //$NON-NLS-1$ rm.done(); @@ -375,10 +369,10 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro } break; case INSTRUCTION_STEP_INTO: - cmd = new MIExecReverseStepInstruction(dmc, 1); + cmd = fCommandFactory.createMIExecReverseStepInstruction(dmc, 1); break; case INSTRUCTION_STEP_OVER: - cmd = new MIExecReverseNextInstruction(dmc, 1); + cmd = fCommandFactory.createMIExecReverseNextInstruction(dmc, 1); break; default: rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given step type not supported", null)); //$NON-NLS-1$ @@ -426,7 +420,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro } getConnection().queueCommand( - new CLIRecord(context, enable), + fCommandFactory.createCLIRecord(context, enable), new DataRequestMonitor(getExecutor(), rm) { @Override public void handleSuccess() { @@ -452,7 +446,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro if (doCanResume(dmc)) { IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context, IBreakpointsTargetDMContext.class); getConnection().queueCommand( - new MIBreakInsert(bpDmc, true, false, null, 0, + fCommandFactory.createMIBreakInsert(bpDmc, true, false, null, 0, location, dmc.getThreadId()), new DataRequestMonitor(getExecutor(), rm) { @Override @@ -470,7 +464,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro IBreakpointsTargetDMContext.class); int bpId = fRunToLineActiveOperation.getBreakointId(); - getConnection().queueCommand(new MIBreakDelete(bpDmc, new int[] {bpId}), + getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {bpId}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; @@ -502,7 +496,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro setResumePending(true); getCache().setContextAvailable(dmc, false); getConnection().queueCommand( - new MIExecJump(dmc, location), + fCommandFactory.createMIExecJump(dmc, location), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleFailure() { @@ -532,7 +526,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro IBreakpointsTargetDMContext.class); int bpId = fRunToLineActiveOperation.getBreakointId(); - getConnection().queueCommand(new MIBreakDelete(bpDmc, new int[] {bpId}), + getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {bpId}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; } @@ -569,7 +563,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro // Didn't stop at the right place yet if (fRunToLineActiveOperation.shouldSkipBreakpoints() && e instanceof MIBreakpointHitEvent) { getConnection().queueCommand( - new MIExecContinue(fRunToLineActiveOperation.getThreadContext()), + fCommandFactory.createMIExecContinue(fRunToLineActiveOperation.getThreadContext()), new DataRequestMonitor(getExecutor(), null)); // Don't send the stop event since we are resuming again. @@ -586,7 +580,7 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class); - getConnection().queueCommand(new MIBreakDelete(bpDmc, new int[] {fRunToLineActiveOperation.getBreakointId()}), + getConnection().queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {fRunToLineActiveOperation.getBreakointId()}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java index 3d5d949b49c..7e1a1412de0 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java @@ -37,9 +37,11 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext; import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext; import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; +import org.eclipse.cdt.dsf.debug.service.command.ICommand; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; import org.eclipse.cdt.dsf.mi.service.IMIProcesses; @@ -48,17 +50,7 @@ import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData; import org.eclipse.cdt.dsf.mi.service.MIBreakpoints; import org.eclipse.cdt.dsf.mi.service.MIRunControl; import org.eclipse.cdt.dsf.mi.service.MIStack; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakDelete; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; -import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecContinue; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecFinish; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecInterrupt; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecJump; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecNext; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecNextInstruction; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecStep; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecStepInstruction; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.events.IMIDMEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIBreakpointHitEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIErrorEvent; @@ -239,7 +231,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo /////////////////////////////////////////////////////////////////////////// private ICommandControlService fConnection; - + private CommandFactory fCommandFactory; + private boolean fTerminated = false; // ThreadStates indexed by the execution context @@ -277,6 +270,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo private void doInitialize(final RequestMonitor rm) { register(new String[]{IRunControl.class.getName(), IMIRunControl.class.getName()}, new Hashtable()); fConnection = getServicesTracker().getService(ICommandControlService.class); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); getSession().addServiceEventListener(this, null); rm.done(); } @@ -391,14 +385,12 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo return; } - MIExecInterrupt cmd = new MIExecInterrupt(context); - fConnection.queueCommand(cmd, new DataRequestMonitor(getExecutor(), rm)); + fConnection.queueCommand(fCommandFactory.createMIExecInterrupt(context), new DataRequestMonitor(getExecutor(), rm)); } private void doSuspendContainer(IMIContainerDMContext context, final RequestMonitor rm) { String groupId = context.getGroupId(); - MIExecInterrupt cmd = new MIExecInterrupt(context, groupId); - fConnection.queueCommand(cmd, new DataRequestMonitor(getExecutor(), rm)); + fConnection.queueCommand(fCommandFactory.createMIExecInterrupt(context, groupId), new DataRequestMonitor(getExecutor(), rm)); } // ------------------------------------------------------------------------ @@ -478,8 +470,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo } threadState.fResumePending = true; - MIExecContinue cmd = new MIExecContinue(context); - fConnection.queueCommand(cmd, new DataRequestMonitor(getExecutor(), rm) { + fConnection.queueCommand(fCommandFactory.createMIExecContinue(context), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleFailure() { threadState.fResumePending = false; @@ -490,8 +481,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo private void doResumeContainer(IMIContainerDMContext context, final RequestMonitor rm) { String groupId = context.getGroupId(); - MIExecContinue cmd = new MIExecContinue(context, groupId); - fConnection.queueCommand(cmd, new DataRequestMonitor(getExecutor(), rm)); + fConnection.queueCommand(fCommandFactory.createMIExecContinue(context, groupId), new DataRequestMonitor(getExecutor(), rm)); } // ------------------------------------------------------------------------ @@ -572,13 +562,13 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo return; } - MICommand cmd = null; + ICommand cmd = null; switch (stepType) { case STEP_INTO: - cmd = new MIExecStep(dmc); + cmd = fCommandFactory.createMIExecStep(dmc); break; case STEP_OVER: - cmd = new MIExecNext(dmc); + cmd = fCommandFactory.createMIExecNext(dmc); break; case STEP_RETURN: // The -exec-finish command operates on the selected stack frame, but here we always @@ -590,7 +580,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo MIStack stackService = getServicesTracker().getService(MIStack.class); if (stackService != null) { IFrameDMContext topFrameDmc = stackService.createFrameDMContext(dmc, 0); - cmd = new MIExecFinish(topFrameDmc); + cmd = fCommandFactory.createMIExecFinish(topFrameDmc); } else { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Cannot create context for command, stack service not available.", null)); //$NON-NLS-1$ @@ -599,10 +589,10 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo } break; case INSTRUCTION_STEP_INTO: - cmd = new MIExecStepInstruction(dmc); + cmd = fCommandFactory.createMIExecStepInstruction(dmc); break; case INSTRUCTION_STEP_OVER: - cmd = new MIExecNextInstruction(dmc); + cmd = fCommandFactory.createMIExecNextInstruction(dmc); break; default: rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, @@ -658,7 +648,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context, IBreakpointsTargetDMContext.class); fConnection.queueCommand( - new MIBreakInsert(bpDmc, true, false, null, 0, + fCommandFactory.createMIBreakInsert(bpDmc, true, false, null, 0, location, dmc.getThreadId()), new DataRequestMonitor(getExecutor(), rm) { @Override @@ -676,7 +666,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo IBreakpointsTargetDMContext.class); int bpId = fRunToLineActiveOperation.getBreakointId(); - fConnection.queueCommand(new MIBreakDelete(bpDmc, new int[] {bpId}), + fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {bpId}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; @@ -721,7 +711,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo threadState.fResumePending = true; fConnection.queueCommand( - new MIExecJump(dmc, location), + fCommandFactory.createMIExecJump(dmc, location), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleFailure() { @@ -938,7 +928,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo // Can't use the resume() call because we 'silently' stopped // so resume() will not know we are actually stopped fConnection.queueCommand( - new MIExecContinue(fExecutionDmcToSuspend), + fCommandFactory.createMIExecContinue(fExecutionDmcToSuspend), new DataRequestMonitor(getExecutor(), rm)); } else { // We didn't suspend the thread, so we don't need to resume it @@ -1004,7 +994,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo // The right thread stopped but not at the right place yet if (fRunToLineActiveOperation.shouldSkipBreakpoints() && e instanceof MIBreakpointHitEvent) { fConnection.queueCommand( - new MIExecContinue(fRunToLineActiveOperation.getThreadContext()), + fCommandFactory.createMIExecContinue(fRunToLineActiveOperation.getThreadContext()), new DataRequestMonitor(getExecutor(), null)); // Don't send the stop event since we are resuming again. @@ -1019,7 +1009,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(), IBreakpointsTargetDMContext.class); - fConnection.queueCommand(new MIBreakDelete(bpDmc, new int[] {fRunToLineActiveOperation.getBreakointId()}), + fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {fRunToLineActiveOperation.getBreakointId()}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; } @@ -1136,7 +1126,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo IBreakpointsTargetDMContext.class); int bpId = fRunToLineActiveOperation.getBreakointId(); - fConnection.queueCommand(new MIBreakDelete(bpDmc, new int[] {bpId}), + fConnection.queueCommand(fCommandFactory.createMIBreakDelete(bpDmc, new int[] {bpId}), new DataRequestMonitor(getExecutor(), null)); fRunToLineActiveOperation = null; } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_1.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_1.java index f49c5b4f7de..5803f344310 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_1.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_1.java @@ -20,13 +20,8 @@ import org.eclipse.cdt.dsf.debug.service.ICachingService; import org.eclipse.cdt.dsf.debug.service.command.CommandCache; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; -import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelectTFile; -import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceDefineVariable; -import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceListVariables; -import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceSave; -import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceStart; -import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceStatus; -import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceStop; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MITraceListVariablesInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MITraceStatusInfo; @@ -318,6 +313,8 @@ public class GDBTraceControl_7_1 extends AbstractDsfService implements IGDBTrace private CommandCache fTraceCache; private ICommandControlService fConnection; + private CommandFactory fCommandFactory; + // private ITraceRecordDMContext fCurrentRecordDmc = null; private boolean fIsTracingActive = false; @@ -367,6 +364,8 @@ public class GDBTraceControl_7_1 extends AbstractDsfService implements IGDBTrace fTraceCache = new CommandCache(getSession(), fConnection); fTraceCache.setContextAvailable(fConnection.getContext(), true); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + requestMonitor.done(); } @@ -420,7 +419,7 @@ public class GDBTraceControl_7_1 extends AbstractDsfService implements IGDBTrace } fConnection.queueCommand( - new MITraceStart(context), + fCommandFactory.createMITraceStart(context), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -460,7 +459,7 @@ public class GDBTraceControl_7_1 extends AbstractDsfService implements IGDBTrace } fConnection.queueCommand( - new MITraceStop(context), + fCommandFactory.createMITraceStop(context), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -517,7 +516,7 @@ public class GDBTraceControl_7_1 extends AbstractDsfService implements IGDBTrace } fConnection.queueCommand( - new MITraceSave(context, file, remoteSave), + fCommandFactory.createMITraceSave(context, file, remoteSave), new DataRequestMonitor(getExecutor(), rm)); } @@ -540,7 +539,7 @@ public class GDBTraceControl_7_1 extends AbstractDsfService implements IGDBTrace } fConnection.queueCommand( - new MITargetSelectTFile(context, file), + fCommandFactory.createMITargetSelectTFile(context, file), new DataRequestMonitor(getExecutor(), rm)); } @@ -552,7 +551,7 @@ public class GDBTraceControl_7_1 extends AbstractDsfService implements IGDBTrace } fConnection.queueCommand( - new MITraceStatus(context), + fCommandFactory.createMITraceStatus(context), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -612,11 +611,11 @@ public class GDBTraceControl_7_1 extends AbstractDsfService implements IGDBTrace if (varValue == null) { fConnection.queueCommand( - new MITraceDefineVariable(context, varName), + fCommandFactory.createMITraceDefineVariable(context, varName), new DataRequestMonitor(getExecutor(), rm)); } else { fConnection.queueCommand( - new MITraceDefineVariable(context, varName, varValue), + fCommandFactory.createMITraceDefineVariable(context, varName, varValue), new DataRequestMonitor(getExecutor(), rm)); } } @@ -632,7 +631,7 @@ public class GDBTraceControl_7_1 extends AbstractDsfService implements IGDBTrace // It may be possible to cache this call, if we can figure out that all the cases // where to data can change, to clear the cache in those cases fConnection.queueCommand( - new MITraceListVariables(context), + fCommandFactory.createMITraceListVariables(context), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java index 4dffc283244..6e968381582 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java @@ -36,6 +36,7 @@ import org.eclipse.cdt.dsf.mi.service.MIMemory; import org.eclipse.cdt.dsf.mi.service.MIModules; import org.eclipse.cdt.dsf.mi.service.MIRegisters; import org.eclipse.cdt.dsf.mi.service.MIStack; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.debug.core.ILaunchConfiguration; @@ -96,9 +97,9 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory { protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) { if (GDB_7_0_VERSION.compareTo(fVersion) <= 0) { - return new GDBControl_7_0(session, config); + return new GDBControl_7_0(session, config, new CommandFactory()); } - return new GDBControl(session, config); + return new GDBControl(session, config, new CommandFactory()); } protected IMIBackend createBackendGDBService(DsfSession session, ILaunchConfiguration lc) { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java index fc51f34e535..7bf9bb7b584 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java @@ -31,6 +31,7 @@ import org.eclipse.cdt.dsf.concurrent.Sequence; import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent; import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; +import org.eclipse.cdt.dsf.debug.service.command.ICommand; import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants; @@ -39,6 +40,7 @@ import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch; import org.eclipse.cdt.dsf.gdb.service.IGDBBackend; import org.eclipse.cdt.dsf.gdb.service.SessionType; import org.eclipse.cdt.dsf.mi.service.IMIBackend; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMIProcesses; import org.eclipse.cdt.dsf.mi.service.MIProcesses; import org.eclipse.cdt.dsf.mi.service.IMIBackend.BackendStateChangedEvent; @@ -47,18 +49,11 @@ import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerStartedDMEvent; import org.eclipse.cdt.dsf.mi.service.command.AbstractCLIProcess; import org.eclipse.cdt.dsf.mi.service.command.AbstractMIControl; import org.eclipse.cdt.dsf.mi.service.command.CLIEventProcessor; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.MIControlDMContext; import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess; import org.eclipse.cdt.dsf.mi.service.command.MIRunControlEventProcessor; import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess.State; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLIUnsetEnv; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; -import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecContinue; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecRun; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBExit; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetEnv; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIInferiorTTYSet; import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.service.DsfServiceEventHandler; @@ -117,8 +112,11 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { private PTY fPty; - public GDBControl(DsfSession session, ILaunchConfiguration config) { - super(session, false); + /** + * @since 3.0 + */ + public GDBControl(DsfSession session, ILaunchConfiguration config, CommandFactory factory) { + super(session, false, factory); } @Override @@ -219,7 +217,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { 2, TimeUnit.SECONDS); queueCommand( - new MIGDBExit(fControlDmc), + getCommandFactory().createMIGDBExit(fControlDmc), new DataRequestMonitor(getExecutor(), rm) { @Override public void handleCompleted() { @@ -254,7 +252,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { // Tell GDB to use this PTY queueCommand( - new MIInferiorTTYSet(fControlDmc, fPty.getSlaveName()), + getCommandFactory().createMIInferiorTTYSet(fControlDmc, fPty.getSlaveName()), new DataRequestMonitor(getExecutor(), requestMonitor) { @Override protected void handleFailure() { @@ -320,12 +318,12 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, MIProcesses.UNIQUE_GROUP_ID); final IContainerDMContext containerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID); - final MICommand execCommand; + final ICommand execCommand; if (fMIBackend.getSessionType() == SessionType.REMOTE) { // When doing remote debugging, we use -exec-continue instead of -exec-run - execCommand = new MIExecContinue(containerDmc); + execCommand = getCommandFactory().createMIExecContinue(containerDmc); } else { - execCommand = new MIExecRun(containerDmc, new String[0]); + execCommand = getCommandFactory().createMIExecRun(containerDmc, new String[0]); } boolean stopInMain = false; @@ -365,7 +363,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { // Insert a breakpoint at the requested stop symbol. queueCommand( - new MIBreakInsert(fControlDmc, true, false, null, 0, stopSymbol, 0), + getCommandFactory().createMIBreakInsert(fControlDmc, true, false, null, 0, stopSymbol, 0), new DataRequestMonitor(getExecutor(), requestMonitor) { @Override protected void handleSuccess() { @@ -420,7 +418,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { if (clear) { count++; queueCommand( - new CLIUnsetEnv(getContext()), + getCommandFactory().createCLIUnsetEnv(getContext()), new DataRequestMonitor(getExecutor(), countingRm)); } @@ -430,7 +428,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { String name = (String)property.getKey(); String value = (String)property.getValue(); queueCommand( - new MIGDBSetEnv(getContext(), name, value), + getCommandFactory().createMIGDBSetEnv(getContext(), name, value), new DataRequestMonitor(getExecutor(), countingRm)); } countingRm.setDoneCount(count); @@ -564,6 +562,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { register( new String[]{ ICommandControl.class.getName(), ICommandControlService.class.getName(), + IMICommandControl.class.getName(), AbstractMIControl.class.getName(), IGDBControl.class.getName() }, new Hashtable()); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java index b4bddc2b3f9..a5aada80d7e 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java @@ -31,6 +31,7 @@ import org.eclipse.cdt.dsf.concurrent.Sequence; import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent; import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; +import org.eclipse.cdt.dsf.debug.service.command.ICommand; import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; @@ -44,24 +45,18 @@ import org.eclipse.cdt.dsf.gdb.service.SessionType; import org.eclipse.cdt.dsf.gdb.service.GDBProcesses_7_0.ContainerExitedDMEvent; import org.eclipse.cdt.dsf.gdb.service.GDBProcesses_7_0.ContainerStartedDMEvent; import org.eclipse.cdt.dsf.mi.service.IMIBackend; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMIProcesses; import org.eclipse.cdt.dsf.mi.service.MIProcesses; import org.eclipse.cdt.dsf.mi.service.IMIBackend.BackendStateChangedEvent; import org.eclipse.cdt.dsf.mi.service.command.AbstractCLIProcess; import org.eclipse.cdt.dsf.mi.service.command.AbstractMIControl; import org.eclipse.cdt.dsf.mi.service.command.CLIEventProcessor_7_0; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.MIControlDMContext; import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess; import org.eclipse.cdt.dsf.mi.service.command.MIRunControlEventProcessor_7_0; import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess.State; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLIUnsetEnv; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; -import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecContinue; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecRun; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBExit; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetEnv; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIInferiorTTYSet; import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakpoint; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; @@ -120,8 +115,11 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { private PTY fPty; - public GDBControl_7_0(DsfSession session, ILaunchConfiguration config) { - super(session, true); + /** + * @since 3.0 + */ + public GDBControl_7_0(DsfSession session, ILaunchConfiguration config, CommandFactory factory) { + super(session, true, factory); } @Override @@ -221,7 +219,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { 2, TimeUnit.SECONDS); queueCommand( - new MIGDBExit(fControlDmc), + getCommandFactory().createMIGDBExit(fControlDmc), new DataRequestMonitor(getExecutor(), rm) { @Override public void handleCompleted() { @@ -256,7 +254,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { // Tell GDB to use this PTY queueCommand( - new MIInferiorTTYSet(fControlDmc, fPty.getSlaveName()), + getCommandFactory().createMIInferiorTTYSet(fControlDmc, fPty.getSlaveName()), new DataRequestMonitor(getExecutor(), requestMonitor) { @Override protected void handleFailure() { @@ -343,7 +341,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { // so let's use a sequence. getExecutor().execute(new Sequence(getExecutor(), requestMonitor) { IContainerDMContext fContainerDmc; - MICommand fExecCommand; + ICommand fExecCommand; String fUserStopSymbol = null; MIBreakpoint fUserBreakpoint = null; @@ -364,9 +362,9 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { // Restart does not apply to remote sessions // // When doing remote debugging, we use -exec-continue instead of -exec-run - fExecCommand = new MIExecContinue(fContainerDmc); + fExecCommand = getCommandFactory().createMIExecContinue(fContainerDmc); } else { - fExecCommand = new MIExecRun(fContainerDmc, new String[0]); + fExecCommand = getCommandFactory().createMIExecRun(fContainerDmc, new String[0]); } rm.done(); }}, @@ -399,7 +397,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { return; } - queueCommand(new MIBreakInsert(fControlDmc, true, false, null, 0, fUserStopSymbol, 0), + queueCommand(getCommandFactory().createMIBreakInsert(fControlDmc, true, false, null, 0, fUserStopSymbol, 0), new DataRequestMonitor(getExecutor(), rm) { @Override public void handleSuccess() { @@ -426,7 +424,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { @Override public void execute(final RequestMonitor rm) { if (reverseEnabled) { - queueCommand(new MIBreakInsert(fControlDmc, true, false, null, 0, + queueCommand(getCommandFactory().createMIBreakInsert(fControlDmc, true, false, null, 0, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT, 0), new DataRequestMonitor(getExecutor(), rm) { @Override @@ -491,7 +489,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { @Override public void execute(RequestMonitor rm) { if (reverseEnabled && !fUserBreakpointIsOnMain) { - queueCommand(new MIExecContinue(fContainerDmc), + queueCommand(getCommandFactory().createMIExecContinue(fContainerDmc), new DataRequestMonitor(getExecutor(), rm)); } else { rm.done(); @@ -554,7 +552,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { if (clear) { count++; queueCommand( - new CLIUnsetEnv(getContext()), + getCommandFactory().createCLIUnsetEnv(getContext()), new DataRequestMonitor(getExecutor(), countingRm)); } @@ -564,7 +562,7 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { String name = (String)property.getKey(); String value = (String)property.getValue(); queueCommand( - new MIGDBSetEnv(getContext(), name, value), + getCommandFactory().createMIGDBSetEnv(getContext(), name, value), new DataRequestMonitor(getExecutor(), countingRm)); } countingRm.setDoneCount(count); @@ -711,7 +709,8 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { getSession().addServiceEventListener(GDBControl_7_0.this, null); register( new String[]{ ICommandControl.class.getName(), - ICommandControlService.class.getName(), + ICommandControlService.class.getName(), + IMICommandControl.class.getName(), AbstractMIControl.class.getName(), IGDBControl.class.getName() }, new Hashtable()); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBControl.java index 6eb18aad1e4..58f525af9fb 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/IGDBControl.java @@ -14,12 +14,12 @@ import java.io.OutputStream; import java.util.Properties; import org.eclipse.cdt.dsf.concurrent.RequestMonitor; -import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.command.AbstractCLIProcess; import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess; -public interface IGDBControl extends ICommandControlService { +public interface IGDBControl extends IMICommandControl { void terminate(final RequestMonitor rm); void initInferiorInputOutput(final RequestMonitor requestMonitor); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSCommandFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSCommandFactory.java new file mode 100644 index 00000000000..05de8a9a45e --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSCommandFactory.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2010 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.cdt.dsf.gdb.service.macos; + +import org.eclipse.cdt.dsf.debug.service.command.ICommand; +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; +import org.eclipse.cdt.dsf.mi.service.command.commands.macos.MacOSMIEnvironmentCD; +import org.eclipse.cdt.dsf.mi.service.command.commands.macos.MacOSMIVarUpdate; +import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarUpdateInfo; + +/** @since 3.0 */ +public class MacOSCommandFactory extends CommandFactory { + + @Override + public ICommand createMIEnvironmentCD(ICommandControlDMContext ctx, String path) { + return new MacOSMIEnvironmentCD(ctx, path); + } + + @Override + public ICommand createMIVarUpdate(ICommandControlDMContext dmc, String name) { + return new MacOSMIVarUpdate(dmc, name); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGDBExpressions.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGDBExpressions.java deleted file mode 100644 index 1161feb8a95..00000000000 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGDBExpressions.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Wind River Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.gdb.service.macos; - -import org.eclipse.cdt.dsf.mi.service.MIExpressions; -import org.eclipse.cdt.dsf.mi.service.MIVariableManager; -import org.eclipse.cdt.dsf.service.DsfSession; - -/** - * Specific ExpressionService for MacOS - * - * @since 3.0 - */ -public class MacOSGDBExpressions extends MIExpressions { - - public MacOSGDBExpressions(DsfSession session) { - super(session); - } - - @Override - protected MIVariableManager createMIVariableManager() { - return new MacOSGDBVariableManager(getSession(), getServicesTracker()); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGDBRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGDBRunControl.java index 296247358b2..d3948a90ba5 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGDBRunControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGDBRunControl.java @@ -11,13 +11,20 @@ package org.eclipse.cdt.dsf.gdb.service.macos; +import java.util.Hashtable; + import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.datamodel.DMContexts; +import org.eclipse.cdt.dsf.debug.service.IRunControl; +import org.eclipse.cdt.dsf.debug.service.command.ICommand; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.service.GDBRunControl; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecInterrupt; +import org.eclipse.cdt.dsf.mi.service.IMIRunControl; +import org.eclipse.cdt.dsf.mi.service.MIRunControl; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.core.runtime.IStatus; @@ -26,9 +33,40 @@ import org.eclipse.core.runtime.Status; /** @since 3.0 */ public class MacOSGDBRunControl extends GDBRunControl { + private CommandFactory fCommandFactory; + public MacOSGDBRunControl(DsfSession session) { super(session); } + + @Override + public void initialize(final RequestMonitor requestMonitor) { + super.initialize(new RequestMonitor(getExecutor(), requestMonitor) { + @Override + protected void handleSuccess() { + doInitialize(requestMonitor); + } + }); + } + + private void doInitialize(RequestMonitor requestMonitor) { + // Register this service. + register(new String[]{ IRunControl.class.getName(), + IMIRunControl.class.getName(), + MIRunControl.class.getName(), + GDBRunControl.class.getName(), + MacOSGDBRunControl.class.getName() }, + new Hashtable()); + + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + + requestMonitor.done(); + } + + @Override + public void shutdown(RequestMonitor requestMonitor) { + super.shutdown(requestMonitor); + } // We use the MIControl code since -exec-interrupt works with Apple gdb // but SIGINT does not; it seems it runs in async mode by default @@ -42,9 +80,9 @@ public class MacOSGDBRunControl extends GDBRunControl { @Override protected void handleSuccess() { if (getData()) { - MIExecInterrupt cmd = null; + ICommand cmd = null; if (context instanceof IContainerDMContext) { - cmd = new MIExecInterrupt(context); + cmd = fCommandFactory.createMIExecInterrupt(context); } else { IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class); if (dmc == null) { @@ -52,7 +90,7 @@ public class MacOSGDBRunControl extends GDBRunControl { rm.done(); return; } - cmd = new MIExecInterrupt(dmc); + cmd = fCommandFactory.createMIExecInterrupt(dmc); } getConnection().queueCommand(cmd, new DataRequestMonitor(getExecutor(), rm)); } else { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGDBVariableManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGDBVariableManager.java deleted file mode 100644 index 36d347df01d..00000000000 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGDBVariableManager.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Wind River Systems and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.gdb.service.macos; - -import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; -import org.eclipse.cdt.dsf.mi.service.MIVariableManager; -import org.eclipse.cdt.dsf.mi.service.command.commands.macos.MacOSMIVarUpdate; -import org.eclipse.cdt.dsf.mi.service.command.output.MIVarChange; -import org.eclipse.cdt.dsf.mi.service.command.output.macos.MacOSMIVarUpdateInfo; -import org.eclipse.cdt.dsf.service.DsfServicesTracker; -import org.eclipse.cdt.dsf.service.DsfSession; - -/** - * Specific VariableManager for MacOS - * - * @since 3.0 - */ -public class MacOSGDBVariableManager extends MIVariableManager { - - public MacOSGDBVariableManager(DsfSession session, DsfServicesTracker tracker) { - super(session, tracker); - } - - @Override - protected MIRootVariableObject createRootVariableObject(VariableObjectId id) { - return new MacOSGDBRootVariableObject(id); - } - - private class MacOSGDBRootVariableObject extends MIRootVariableObject { - - public MacOSGDBRootVariableObject(VariableObjectId id) { - super(id); - } - - @Override - public void update(final DataRequestMonitor rm) { - - if (isOutOfScope()) { - rm.setData(false); - rm.done(); - } else if (currentState != STATE_READY) { - // Object is not fully created or is being updated - // so add RequestMonitor to pending queue - updatesPending.add(rm); - } else if (getOutOfDate() == false) { - rm.setData(false); - rm.done(); - } else { - // Object needs to be updated in the back-end - currentState = STATE_UPDATING; - - // In GDB, var-update will only report a change if -var-evaluate-expression has - // changed -- in the current format--. This means that situations like - // double z = 1.2; - // z = 1.4; - // Will not report a change if the format is anything else than natural. - // This is because 1.2 and 1.4 are both printed as 1, 0x1, etc - // Since we cache the values of every format, we must know if -any- format has - // changed, not just the current one. - // To solve this, we always do an update in the natural format; I am not aware - // of any case where the natural format would stay the same, but another format - // would change. However, since a var-update update all children as well, - // we must make sure these children are also in the natural format - // The simplest way to do this is that whenever we change the format - // of a variable object, we immediately set it back to natural with a second - // var-set-format command. This is done in the getValue() method - getCommandControl().queueCommand( - new MacOSMIVarUpdate(getRootToUpdate().getControlDMContext(), getGdbName()), - new DataRequestMonitor(getSession().getExecutor(), rm) { - @Override - protected void handleCompleted() { - currentState = STATE_READY; - - if (isSuccess()) { - setOutOfDate(false); - - MIVarChange[] changes = getData().getMIVarChanges(); - if (changes.length > 0 && changes[0].isInScope() == false) { - // Object is out-of-scope - outOfScope = true; - - // We can delete this root in GDB right away. This is safe, even - // if the root has children, because they are also out-of-scope. - // We -must- also remove this entry from our LRU. If we don't - // we can end-up with a race condition that create this object - // twice, or have an infinite loop while never re-creating the object. - // The can happen if we update a child first then we request - // the root later, - getLRUCache().remove(getInternalId()); - - rm.setData(true); - rm.done(); - } else { - // The root object is now up-to-date, we must parse the changes, if any. - processChanges(changes); - - // We only mark this root as updated in our list if it is in-scope. - // For out-of-scope object, we don't ever need to re-update them so - // we don't need to add them to this list. - rootVariableUpdated(MacOSGDBRootVariableObject.this); - - rm.setData(false); - rm.done(); - } - - while (updatesPending.size() > 0) { - DataRequestMonitor pendingRm = updatesPending.poll(); - pendingRm.setData(false); - pendingRm.done(); - } - } else { - // We were not able to update for some reason - rm.setData(false); - rm.done(); - - while (updatesPending.size() > 0) { - DataRequestMonitor pendingRm = updatesPending.poll(); - pendingRm.setStatus(getStatus()); - pendingRm.done(); - } - } - } - }); - } - } - } -} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGdbDebugServicesFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGdbDebugServicesFactory.java index 37a876d482c..55a097d6828 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGdbDebugServicesFactory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/macos/MacOSGdbDebugServicesFactory.java @@ -12,11 +12,13 @@ *******************************************************************************/ package org.eclipse.cdt.dsf.gdb.service.macos; -import org.eclipse.cdt.dsf.debug.service.IExpressions; import org.eclipse.cdt.dsf.debug.service.IProcesses; import org.eclipse.cdt.dsf.debug.service.IRunControl; +import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; import org.eclipse.cdt.dsf.gdb.service.GdbDebugServicesFactory; +import org.eclipse.cdt.dsf.gdb.service.command.GDBControl; import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.debug.core.ILaunchConfiguration; /** @since 3.0 */ public class MacOSGdbDebugServicesFactory extends GdbDebugServicesFactory { @@ -25,6 +27,7 @@ public class MacOSGdbDebugServicesFactory extends GdbDebugServicesFactory { // We have to be careful not to compare that specific version number scheme with the // FSF GDB version scheme. // Use this variable when needing to differentiate between different Mac OS GDBs + @SuppressWarnings("unused") private final String fAppleVersion; public MacOSGdbDebugServicesFactory(String gdbVersion, String appleVersion) { @@ -33,8 +36,8 @@ public class MacOSGdbDebugServicesFactory extends GdbDebugServicesFactory { } @Override - protected IExpressions createExpressionService(DsfSession session) { - return new MacOSGDBExpressions(session); + protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) { + return new GDBControl(session, config, new MacOSCommandFactory()); } @Override diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/CSourceLookup.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/CSourceLookup.java index 66f6298071b..65e1170f0cc 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/CSourceLookup.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/CSourceLookup.java @@ -24,7 +24,7 @@ import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.debug.service.ISourceLookup; import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIEnvironmentDirectory; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.service.AbstractDsfService; import org.eclipse.cdt.dsf.service.DsfSession; @@ -51,6 +51,7 @@ public class CSourceLookup extends AbstractDsfService implements ISourceLookup { private Map fDirectors = new HashMap(); ICommandControl fConnection; + private CommandFactory fCommandFactory; public CSourceLookup(DsfSession session) { super(session); @@ -71,7 +72,7 @@ public class CSourceLookup extends AbstractDsfService implements ISourceLookup { String[] paths = pathList.toArray(new String[pathList.size()]); fConnection.queueCommand( - new MIEnvironmentDirectory(ctx, paths, false), + fCommandFactory.createMIEnvironmentDirectory(ctx, paths, false), new DataRequestMonitor(getExecutor(), rm)); } @@ -121,6 +122,8 @@ public class CSourceLookup extends AbstractDsfService implements ISourceLookup { private void doInitialize(final RequestMonitor requestMonitor) { fConnection = getServicesTracker().getService(ICommandControl.class); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + // Register this service register(new String[] { CSourceLookup.class.getName(), ISourceLookup.class.getName() }, new Hashtable()); diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMICommandControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMICommandControl.java new file mode 100644 index 00000000000..852c2d3aa92 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/IMICommandControl.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2010 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.cdt.dsf.mi.service; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; + +/** + * This interface provides a method for accessing the command factory. + * @since 3.0 + */ +public interface IMICommandControl extends ICommandControlService +{ + /** + * Returns a command factory that creates differentICommand + * to be sent to the backend. This factory can easily be overridden + * to specialize certain commands. + */ + public CommandFactory getCommandFactory(); +} + diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java index 6df9b7e4f76..9617904ef1e 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java @@ -33,14 +33,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakAfter; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakCondition; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakDelete; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakDisable; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakEnable; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakList; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakWatch; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointScopeEvent; import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakListInfo; @@ -96,6 +89,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints // Services private ICommandControl fConnection; private IMIRunControl fRunControl; + private CommandFactory fCommandFactory; // Service breakpoints tracking // The breakpoints are stored per context and keyed on the back-end breakpoint reference @@ -269,6 +263,8 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints fConnection = getServicesTracker().getService(ICommandControl.class); fRunControl = getServicesTracker().getService(IMIRunControl.class); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + // Register for the useful events getSession().addServiceEventListener(this, null); @@ -360,7 +356,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints } // Execute the command - fConnection.queueCommand(new MIBreakList(context), + fConnection.queueCommand(fCommandFactory.createMIBreakList(context), new DataRequestMonitor(getExecutor(), drm) { @Override protected void handleSuccess() { @@ -563,7 +559,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints @Override public void execute(final RequestMonitor rm) { fConnection.queueCommand( - new MIBreakInsert(context, isTemporary, isHardware, condition, ignoreCount, location, tid), + fCommandFactory.createMIBreakInsert(context, isTemporary, isHardware, condition, ignoreCount, location, tid), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -697,7 +693,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints }; // Execute the command - fConnection.queueCommand(new MIBreakWatch(context, isRead, isWrite, expression), addWatchpointDRM); + fConnection.queueCommand(fCommandFactory.createMIBreakWatch(context, isRead, isWrite, expression), addWatchpointDRM); } //------------------------------------------------------------------------- @@ -757,7 +753,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints public void execute(final RequestMonitor rm) { // Queue the command fConnection.queueCommand( - new MIBreakDelete(context, new int[] { reference }), + fCommandFactory.createMIBreakDelete(context, new int[] { reference }), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleCompleted() { @@ -933,7 +929,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints public void execute(final RequestMonitor rm) { // Queue the command fConnection.queueCommand( - new MIBreakCondition(context, reference, condition), + fCommandFactory.createMIBreakCondition(context, reference, condition), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -963,7 +959,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints // Remove invalid condition from the back-end breakpoint breakpoint.setCondition(NULL_STRING); fConnection.queueCommand( - new MIBreakCondition(context, reference, NULL_STRING), + fCommandFactory.createMIBreakCondition(context, reference, NULL_STRING), new DataRequestMonitor(getExecutor(), rm) { @Override // The report the initial problem @@ -1007,7 +1003,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints public void execute(final RequestMonitor rm) { // Queue the command fConnection.queueCommand( - new MIBreakAfter(context, reference, ignoreCount), + fCommandFactory.createMIBreakAfter(context, reference, ignoreCount), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -1052,7 +1048,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints public void execute(final RequestMonitor rm) { // Queue the command fConnection.queueCommand( - new MIBreakEnable(context, new int[] { reference }), + fCommandFactory.createMIBreakEnable(context, new int[] { reference }), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -1097,7 +1093,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints public void execute(final RequestMonitor rm) { // Queue the command fConnection.queueCommand( - new MIBreakDisable(context, new int[] { reference }), + fCommandFactory.createMIBreakDisable(context, new int[] { reference }), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIDisassembly.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIDisassembly.java index 2e56e200eb3..8f7c45f64bb 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIDisassembly.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIDisassembly.java @@ -21,7 +21,7 @@ import org.eclipse.cdt.dsf.debug.service.IInstruction; import org.eclipse.cdt.dsf.debug.service.IMixedInstruction; import org.eclipse.cdt.dsf.debug.service.command.ICommandControl; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataDisassemble; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.MIDataDisassembleInfo; import org.eclipse.cdt.dsf.service.AbstractDsfService; import org.eclipse.cdt.dsf.service.DsfSession; @@ -33,6 +33,7 @@ public class MIDisassembly extends AbstractDsfService implements IDisassembly { // Services ICommandControl fConnection; + private CommandFactory fCommandFactory; /////////////////////////////////////////////////////////////////////////// // AbstractDsfService @@ -62,6 +63,8 @@ public class MIDisassembly extends AbstractDsfService implements IDisassembly { private void doInitialize(final RequestMonitor rm) { fConnection = getServicesTracker().getService(ICommandControl.class); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + // getSession().addServiceEventListener(this, null); register(new String[] { IDisassembly.class.getName(), MIDisassembly.class.getName() }, new Hashtable()); @@ -107,7 +110,7 @@ public class MIDisassembly extends AbstractDsfService implements IDisassembly { // Go for it String start = (startAddress != null) ? startAddress.toString() : "$pc"; //$NON-NLS-1$ String end = (endAddress != null) ? endAddress.toString() : "$pc + 100"; //$NON-NLS-1$ - fConnection.queueCommand(new MIDataDisassemble(context, start, end, false), + fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, start, end, false), new DataRequestMonitor(getExecutor(), drm) { @Override protected void handleSuccess() { @@ -132,7 +135,7 @@ public class MIDisassembly extends AbstractDsfService implements IDisassembly { } // Go for it - fConnection.queueCommand(new MIDataDisassemble(context, filename, linenum, lines, false), + fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, filename, linenum, lines, false), new DataRequestMonitor(getExecutor(), drm) { @Override protected void handleSuccess() { @@ -160,7 +163,7 @@ public class MIDisassembly extends AbstractDsfService implements IDisassembly { // Go for it String start = (startAddress != null) ? startAddress.toString() : "$pc"; //$NON-NLS-1$ String end = (endAddress != null) ? endAddress.toString() : "$pc + 100"; //$NON-NLS-1$ - fConnection.queueCommand(new MIDataDisassemble(context, start, end, true), + fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, start, end, true), new DataRequestMonitor(getExecutor(), drm) { @Override protected void handleSuccess() { @@ -186,7 +189,7 @@ public class MIDisassembly extends AbstractDsfService implements IDisassembly { } // Go for it - fConnection.queueCommand(new MIDataDisassemble(context, filename, linenum, lines, true), + fConnection.queueCommand(fCommandFactory.createMIDataDisassemble(context, filename, linenum, lines, true), new DataRequestMonitor(getExecutor(), drm) { @Override protected void handleSuccess() { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java index 36a56ce0e15..cbe5486ae7a 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIExpressions.java @@ -34,12 +34,12 @@ import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.cdt.dsf.debug.service.command.CommandCache; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.commands.ExprMetaGetAttributes; import org.eclipse.cdt.dsf.mi.service.command.commands.ExprMetaGetChildCount; import org.eclipse.cdt.dsf.mi.service.command.commands.ExprMetaGetChildren; import org.eclipse.cdt.dsf.mi.service.command.commands.ExprMetaGetValue; import org.eclipse.cdt.dsf.mi.service.command.commands.ExprMetaGetVar; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataEvaluateExpression; import org.eclipse.cdt.dsf.mi.service.command.output.ExprMetaGetAttributesInfo; import org.eclipse.cdt.dsf.mi.service.command.output.ExprMetaGetChildCountInfo; import org.eclipse.cdt.dsf.mi.service.command.output.ExprMetaGetChildrenInfo; @@ -423,7 +423,7 @@ public class MIExpressions extends AbstractDsfService implements IExpressions, I private CommandCache fExpressionCache; private MIVariableManager varManager; - + private CommandFactory fCommandFactory; public MIExpressions(DsfSession session) { super(session); @@ -477,6 +477,8 @@ public class MIExpressions extends AbstractDsfService implements IExpressions, I ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class); fExpressionCache.setContextAvailable(commandControl.getContext(), true); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + requestMonitor.done(); } @@ -644,7 +646,7 @@ public class MIExpressions extends AbstractDsfService implements IExpressions, I rm.done(); } else { fExpressionCache.execute( - new MIDataEvaluateExpression(addressDmc), + fCommandFactory.createMIDataEvaluateExpression(addressDmc), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -657,7 +659,7 @@ public class MIExpressions extends AbstractDsfService implements IExpressions, I final String addrStr = tmpAddrStr; fExpressionCache.execute( - new MIDataEvaluateExpression(sizeDmc), + fCommandFactory.createMIDataEvaluateExpression(sizeDmc), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -706,7 +708,7 @@ public class MIExpressions extends AbstractDsfService implements IExpressions, I // Starting with GDB 7.0, this format automatically supports pretty-printing, as long as // GDB has been configured to support it. fExpressionCache.execute( - new MIDataEvaluateExpression(exprDmc), + fCommandFactory.createMIDataEvaluateExpression(exprDmc), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIMemory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIMemory.java index 39f698d239f..f7eb6705d20 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIMemory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIMemory.java @@ -42,8 +42,7 @@ import org.eclipse.cdt.dsf.debug.service.command.CommandCache; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.mi.service.MIExpressions.ExpressionChangedEvent; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataReadMemory; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataWriteMemory; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.MIDataReadMemoryInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIDataWriteMemoryInfo; import org.eclipse.cdt.dsf.service.AbstractDsfService; @@ -78,6 +77,8 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer // Back-end commands cache private CommandCache fCommandCache; + private CommandFactory fCommandFactory; + // Map of memory caches private Map fMemoryCaches; @@ -130,6 +131,8 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class); BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(commandControl, getExecutor(), 2); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + // This cache stores the result of a command when received; also, this cache // is manipulated when receiving events. Currently, events are received after // three scheduling of the executor, while command results after only one. This @@ -325,7 +328,7 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer Character asChar = null; fCommandCache.execute( - new MIDataReadMemory(dmc, offset, address.toString(), mode, word_size, nb_rows, nb_cols, asChar), + fCommandFactory.createMIDataReadMemory(dmc, offset, address.toString(), mode, word_size, nb_rows, nb_cols, asChar), new DataRequestMonitor(getExecutor(), drm) { @Override protected void handleSuccess() { @@ -373,7 +376,7 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer for (int i = 0; i < count; i++) { String value = new Byte(buffer[i]).toString(); fCommandCache.execute( - new MIDataWriteMemory(dmc, offset + i, baseAddress, format, word_size, value), + fCommandFactory.createMIDataWriteMemory(dmc, offset + i, baseAddress, format, word_size, value), new DataRequestMonitor(getExecutor(), countingRM) ); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIModules.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIModules.java index 498f0b56513..9abb06dda56 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIModules.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIModules.java @@ -25,7 +25,7 @@ import org.eclipse.cdt.dsf.debug.service.IModules; import org.eclipse.cdt.dsf.debug.service.command.CommandCache; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoSharedLibrary; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoSharedLibraryInfo; import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoSharedLibraryInfo.DsfMISharedInfo; import org.eclipse.cdt.dsf.service.AbstractDsfService; @@ -39,7 +39,8 @@ import org.osgi.framework.BundleContext; */ public class MIModules extends AbstractDsfService implements IModules, ICachingService { private CommandCache fModulesCache; - + private CommandFactory fCommandFactory; + public MIModules(DsfSession session) { super(session); } @@ -64,6 +65,9 @@ public class MIModules extends AbstractDsfService implements IModules, ICachingS ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class); fModulesCache = new CommandCache(getSession(), commandControl); fModulesCache.setContextAvailable(commandControl.getContext(), true); + + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + /* * Make ourselves known so clients can use us. */ @@ -155,7 +159,7 @@ public class MIModules extends AbstractDsfService implements IModules, ICachingS public void getModules(final ISymbolDMContext symCtx, final DataRequestMonitor rm) { if(symCtx != null){ - fModulesCache.execute(new CLIInfoSharedLibrary(symCtx), + fModulesCache.execute(fCommandFactory.createCLIInfoSharedLibrary(symCtx), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -184,7 +188,7 @@ public class MIModules extends AbstractDsfService implements IModules, ICachingS public void getModuleData(final IModuleDMContext dmc, final DataRequestMonitor rm) { assert dmc != null; if (dmc instanceof ModuleDMContext) { - fModulesCache.execute(new CLIInfoSharedLibrary(dmc), + fModulesCache.execute(fCommandFactory.createCLIInfoSharedLibrary(dmc), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java index bef70cd0d9d..d5a2f27cdc2 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java @@ -33,10 +33,7 @@ import org.eclipse.cdt.dsf.debug.service.command.CommandCache; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLIAttach; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLIDetach; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoThreads; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIThreadListIds; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoThreadsInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIThreadListIdsInfo; @@ -307,6 +304,7 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa private ICommandControlService fCommandControl; private CommandCache fContainerCommandCache; + private CommandFactory fCommandFactory; private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$ // The unique id should be an empty string so that the views know not to display the fake id @@ -350,6 +348,8 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa fCommandControl = getServicesTracker().getService(ICommandControlService.class); BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(fCommandControl, getExecutor(), 2); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + // This cache stores the result of a command when received; also, this cache // is manipulated when receiving events. Currently, events are received after // three scheduling of the executor, while command results after only one. This @@ -426,7 +426,7 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa protected void handleSuccess() { if (getData() instanceof IMIContainerDMContext) { IMIContainerDMContext contDmc = (IMIContainerDMContext)getData(); - fContainerCommandCache.execute(new CLIInfoThreads(contDmc), + fContainerCommandCache.execute(fCommandFactory.createCLIInfoThreads(contDmc), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -480,7 +480,7 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(procCtx, ICommandControlDMContext.class); fCommandControl.queueCommand( - new CLIAttach(controlDmc, ((IMIProcessDMContext)procCtx).getProcId()), + fCommandFactory.createCLIAttach(controlDmc, ((IMIProcessDMContext)procCtx).getProcId()), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -511,7 +511,7 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa // This service version cannot use -target-detach because it didn't exist // in versions of GDB up to and including GDB 6.8 fCommandControl.queueCommand( - new CLIDetach(controlDmc), + fCommandFactory.createCLIDetach(controlDmc), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -550,7 +550,7 @@ public class MIProcesses extends AbstractDsfService implements IMIProcesses, ICa final IMIContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class); if (containerDmc != null) { fContainerCommandCache.execute( - new MIThreadListIds(containerDmc), + fCommandFactory.createMIThreadListIds(containerDmc), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java index 301bc0670b9..50d18f18066 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java @@ -29,8 +29,7 @@ import org.eclipse.cdt.dsf.debug.service.command.BufferedCommandControl; import org.eclipse.cdt.dsf.debug.service.command.CommandCache; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataListRegisterNames; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataListRegisterValues; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.output.MIDataListRegisterNamesInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIDataListRegisterValuesInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; @@ -143,6 +142,8 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach * Internal control variables. */ + private CommandFactory fCommandFactory; + private MIRegisterGroupDMC fGeneralRegistersGroupDMC; private CommandCache fRegisterNameCache; // Cache for holding the Register Names in the single Group private CommandCache fRegisterValueCache; // Cache for holding the Register Values @@ -175,6 +176,8 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class); BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(commandControl, getExecutor(), 2); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + // This cache stores the result of a command when received; also, this cache // is manipulated when receiving events. Currently, events are received after // three scheduling of the executor, while command results after only one. This @@ -261,7 +264,7 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach int[] regnos = {miRegDmc.getRegNo()}; fRegisterValueCache.execute( - new MIDataListRegisterValues(execDmc, MIFormat.HEXADECIMAL, regnos), + fCommandFactory.createMIDataListRegisterValues(execDmc, MIFormat.HEXADECIMAL, regnos), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -319,7 +322,7 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach int[] regnos = {regDmc.getRegNo()}; fRegisterValueCache.execute( - new MIDataListRegisterValues(miExecDmc, NumberFormat, regnos), + fCommandFactory.createMIDataListRegisterValues(miExecDmc, NumberFormat, regnos), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -476,7 +479,7 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach if ( groupDmc.getGroupNo() == 0 ) { final IMIExecutionDMContext executionDmc = DMContexts.getAncestorOfType(dmc, IMIExecutionDMContext.class); fRegisterNameCache.execute( - new MIDataListRegisterNames(containerDmc), + fCommandFactory.createMIDataListRegisterNames(containerDmc), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java index f96f2f0df97..edffe66aadc 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java @@ -35,21 +35,11 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.cdt.dsf.debug.service.command.BufferedCommandControl; import org.eclipse.cdt.dsf.debug.service.command.CommandCache; +import org.eclipse.cdt.dsf.debug.service.command.ICommand; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLIJump; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLIThread; -import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecContinue; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecFinish; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecInterrupt; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecNext; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecNextInstruction; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecStep; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecStepInstruction; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecUntil; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIThreadListIds; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.events.IMIDMEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIBreakpointHitEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIErrorEvent; @@ -278,6 +268,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I private ICommandControlService fConnection; private CommandCache fMICommandCache; + private CommandFactory fCommandFactory; // State flags private boolean fSuspended = true; @@ -313,6 +304,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I fConnection = getServicesTracker().getService(ICommandControlService.class); BufferedCommandControl bufferedCommandControl = new BufferedCommandControl(fConnection, getExecutor(), 2); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); // This cache stores the result of a command when received; also, this cache // is manipulated when receiving events. Currently, events are received after // three scheduling of the executor, while command results after only one. This @@ -401,7 +393,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I // We need a proper thread id for the debug view to select the right thread // Bug 300096 comment #15 and Bug 302597 getConnection().queueCommand( - new CLIThread(containerDmc), + fCommandFactory.createCLIThread(containerDmc), new DataRequestMonitor(getExecutor(), null) { @Override protected void handleCompleted() { @@ -552,9 +544,9 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I assert context != null; if (doCanResume(context)) { - MIExecContinue cmd = null; + ICommand cmd = null; if(context instanceof IContainerDMContext) { - cmd = new MIExecContinue(context); + cmd = fCommandFactory.createMIExecContinue(context); } else { IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class); if (dmc == null) { @@ -562,7 +554,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I rm.done(); return; } - cmd = new MIExecContinue(dmc);//, new String[0]); + cmd = fCommandFactory.createMIExecContinue(dmc);//, new String[0]); } fResumePending = true; @@ -593,9 +585,9 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I assert context != null; if (doCanSuspend(context)) { - MIExecInterrupt cmd = null; + ICommand cmd = null; if(context instanceof IContainerDMContext){ - cmd = new MIExecInterrupt(context); + cmd = fCommandFactory.createMIExecInterrupt(context); } else { IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class); @@ -604,7 +596,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I rm.done(); return; } - cmd = new MIExecInterrupt(dmc); + cmd = fCommandFactory.createMIExecInterrupt(dmc); } fConnection.queueCommand(cmd, new DataRequestMonitor(getExecutor(), rm)); } else { @@ -638,13 +630,13 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I return; } - MICommand cmd = null; + ICommand cmd = null; switch(stepType) { case STEP_INTO: - cmd = new MIExecStep(dmc, 1); + cmd = fCommandFactory.createMIExecStep(dmc, 1); break; case STEP_OVER: - cmd = new MIExecNext(dmc); + cmd = fCommandFactory.createMIExecNext(dmc); break; case STEP_RETURN: // The -exec-finish command operates on the selected stack frame, but here we always @@ -656,7 +648,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I MIStack stackService = getServicesTracker().getService(MIStack.class); if (stackService != null) { IFrameDMContext topFrameDmc = stackService.createFrameDMContext(dmc, 0); - cmd = new MIExecFinish(topFrameDmc); + cmd = fCommandFactory.createMIExecFinish(topFrameDmc); } else { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, "Cannot create context for command, stack service not available.", null)); //$NON-NLS-1$ rm.done(); @@ -664,10 +656,10 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I } break; case INSTRUCTION_STEP_INTO: - cmd = new MIExecStepInstruction(dmc, 1); + cmd = fCommandFactory.createMIExecStepInstruction(dmc, 1); break; case INSTRUCTION_STEP_OVER: - cmd = new MIExecNextInstruction(dmc, 1); + cmd = fCommandFactory.createMIExecNextInstruction(dmc, 1); break; default: rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Given step type not supported", null)); //$NON-NLS-1$ @@ -694,7 +686,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I public void getExecutionContexts(final IContainerDMContext containerDmc, final DataRequestMonitor rm) { fMICommandCache.execute( - new MIThreadListIds(containerDmc), + fCommandFactory.createMIThreadListIds(containerDmc), new DataRequestMonitor( getExecutor(), rm) { @Override @@ -750,7 +742,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I if (doCanResume(dmc)) { fResumePending = true; fMICommandCache.setContextAvailable(dmc, false); - fConnection.queueCommand(new MIExecUntil(dmc, location), + fConnection.queueCommand(fCommandFactory.createMIExecUntil(dmc, location), new DataRequestMonitor(getExecutor(), rm)); } else { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED, @@ -774,7 +766,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I fResumePending = true; fMICommandCache.setContextAvailable(dmc, false); fConnection.queueCommand( - new CLIJump(dmc, location), + fCommandFactory.createCLIJump(dmc, location), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleFailure() { @@ -903,7 +895,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I // Can't use the resume() call because we 'silently' stopped // so resume() will not know we are actually stopped fConnection.queueCommand( - new MIExecContinue(getContextToSuspend()), + fCommandFactory.createMIExecContinue(getContextToSuspend()), new DataRequestMonitor(getExecutor(), rm)); } else { // We didn't suspend the container, so we don't need to resume it diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java index 0bbeb664379..76faef54fcc 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIStack.java @@ -33,12 +33,10 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent; import org.eclipse.cdt.dsf.debug.service.IRunControl.StateChangeReason; import org.eclipse.cdt.dsf.debug.service.command.BufferedCommandControl; import org.eclipse.cdt.dsf.debug.service.command.CommandCache; +import org.eclipse.cdt.dsf.debug.service.command.ICommand; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackInfoDepth; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackListArguments; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackListFrames; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackListLocals; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.events.IMIDMEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent; import org.eclipse.cdt.dsf.mi.service.command.output.MIArg; @@ -155,7 +153,8 @@ public class MIStack extends AbstractDsfService } private CommandCache fMICommandCache; - + private CommandFactory fCommandFactory; + // Two commands such as // -stack-info-depth 11 // -stack-info-depth 2 @@ -205,6 +204,8 @@ public class MIStack extends AbstractDsfService fMICommandCache.setContextAvailable(commandControl.getContext(), true); fRunControl = getServicesTracker().getService(IRunControl.class); + fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); + getSession().addServiceEventListener(this, null); register(new String[]{IStack.class.getName(), MIStack.class.getName()}, new Hashtable()); rm.done(); @@ -274,14 +275,14 @@ public class MIStack extends AbstractDsfService } } - final MIStackListFrames miStackListCmd; + final ICommand miStackListCmd; // firstIndex is the first index retrieved final int firstIndex; if (endIndex >= 0) { - miStackListCmd = new MIStackListFrames(execDmc, startIndex, endIndex); + miStackListCmd = fCommandFactory.createMIStackListFrames(execDmc, startIndex, endIndex); firstIndex = startIndex; } else { - miStackListCmd = new MIStackListFrames(execDmc); + miStackListCmd = fCommandFactory.createMIStackListFrames(execDmc); firstIndex = 0; } fMICommandCache.execute( @@ -432,7 +433,7 @@ public class MIStack extends AbstractDsfService } fMICommandCache.execute( - new MIStackListFrames(execDmc), + fCommandFactory.createMIStackListFrames(execDmc), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -476,7 +477,7 @@ public class MIStack extends AbstractDsfService // If not, retrieve the full list of frame data. fMICommandCache.execute( - new MIStackListArguments(execDmc, true), + fCommandFactory.createMIStackListArguments(execDmc, true), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -556,7 +557,7 @@ public class MIStack extends AbstractDsfService if (miVariableDmc.fType == MIVariableDMC.Type.ARGUMENT){ fMICommandCache.execute( - new MIStackListArguments(execDmc, true), + fCommandFactory.createMIStackListArguments(execDmc, true), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -576,7 +577,7 @@ public class MIStack extends AbstractDsfService }//if if (miVariableDmc.fType == MIVariableDMC.Type.LOCAL){ fMICommandCache.execute( - new MIStackListLocals(frameDmc, true), + fCommandFactory.createMIStackListLocals(frameDmc, true), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -638,7 +639,7 @@ public class MIStack extends AbstractDsfService }); fMICommandCache.execute( - new MIStackListLocals(frameDmc, true), + fCommandFactory.createMIStackListLocals(frameDmc, true), new DataRequestMonitor(getExecutor(), countingRm) { @Override protected void handleSuccess() { @@ -670,9 +671,9 @@ public class MIStack extends AbstractDsfService } } - MIStackInfoDepth depthCommand = null; - if (maxDepth > 0) depthCommand = new MIStackInfoDepth(execDmc, maxDepth); - else depthCommand = new MIStackInfoDepth(execDmc); + ICommand depthCommand = null; + if (maxDepth > 0) depthCommand = fCommandFactory.createMIStackInfoDepth(execDmc, maxDepth); + else depthCommand = fCommandFactory.createMIStackInfoDepth(execDmc); fMICommandCache.execute( depthCommand, diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java index dc7fa2cf001..0b4e69ca321 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java @@ -45,21 +45,13 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.mi.service.MIExpressions.ExpressionInfo; import org.eclipse.cdt.dsf.mi.service.MIExpressions.MIExpressionDMC; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.commands.ExprMetaGetAttributes; import org.eclipse.cdt.dsf.mi.service.command.commands.ExprMetaGetChildCount; import org.eclipse.cdt.dsf.mi.service.command.commands.ExprMetaGetChildren; import org.eclipse.cdt.dsf.mi.service.command.commands.ExprMetaGetValue; import org.eclipse.cdt.dsf.mi.service.command.commands.ExprMetaGetVar; import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataEvaluateExpression; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarAssign; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarCreate; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarDelete; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarEvaluateExpression; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarInfoPathExpression; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarListChildren; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarSetFormat; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarShowAttributes; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarUpdate; import org.eclipse.cdt.dsf.mi.service.command.output.ExprMetaGetAttributesInfo; import org.eclipse.cdt.dsf.mi.service.command.output.ExprMetaGetChildCountInfo; import org.eclipse.cdt.dsf.mi.service.command.output.ExprMetaGetChildrenInfo; @@ -402,7 +394,7 @@ public class MIVariableManager implements ICommandControl { rm.done(); } else { fCommandControl.queueCommand( - new MIVarShowAttributes(getRootToUpdate().getControlDMContext(), getGdbName()), + fCommandFactory.createMIVarShowAttributes(getRootToUpdate().getControlDMContext(), getGdbName()), new DataRequestMonitor(fSession.getExecutor(), rm) { @Override protected void handleSuccess() { @@ -490,7 +482,7 @@ public class MIVariableManager implements ICommandControl { } else { // We must first set the new format and then evaluate the variable fCommandControl.queueCommand( - new MIVarSetFormat(getRootToUpdate().getControlDMContext(), getGdbName(), dmc.getFormatID()), + fCommandFactory.createMIVarSetFormat(getRootToUpdate().getControlDMContext(), getGdbName(), dmc.getFormatID()), new DataRequestMonitor(fSession.getExecutor(), rm) { @Override protected void handleCompleted() { @@ -526,7 +518,7 @@ public class MIVariableManager implements ICommandControl { */ private void evaluate(final DataRequestMonitor rm) { fCommandControl.queueCommand( - new MIVarEvaluateExpression(getRootToUpdate().getControlDMContext(), getGdbName()), + fCommandFactory.createMIVarEvaluateExpression(getRootToUpdate().getControlDMContext(), getGdbName()), new DataRequestMonitor(fSession.getExecutor(), rm) { @Override protected void handleCompleted() { @@ -563,7 +555,7 @@ public class MIVariableManager implements ICommandControl { private void resetFormatToNatural() { if (!getCurrentFormat().equals(IFormattedValues.NATURAL_FORMAT)) { fCommandControl.queueCommand( - new MIVarSetFormat(getRootToUpdate().getControlDMContext(), getGdbName(), IFormattedValues.NATURAL_FORMAT), + fCommandFactory.createMIVarSetFormat(getRootToUpdate().getControlDMContext(), getGdbName(), IFormattedValues.NATURAL_FORMAT), new DataRequestMonitor(fSession.getExecutor(), null) { @Override protected void handleCompleted() { @@ -629,7 +621,7 @@ public class MIVariableManager implements ICommandControl { // be called here with a fully created object. // Also no need to lock the object, since getting the children won't affect other operations fCommandControl.queueCommand( - new MIVarListChildren(getRootToUpdate().getControlDMContext(), getGdbName()), + fCommandFactory.createMIVarListChildren(getRootToUpdate().getControlDMContext(), getGdbName()), new DataRequestMonitor(fSession.getExecutor(), rm) { @Override protected void handleSuccess() { @@ -746,7 +738,7 @@ public class MIVariableManager implements ICommandControl { // To build the child id, we need the fully qualified expression which we // can get from -var-info-path-expression starting from GDB 6.7 fCommandControl.queueCommand( - new MIVarInfoPathExpression(getRootToUpdate().getControlDMContext(), child.getVarName()), + fCommandFactory.createMIVarInfoPathExpression(getRootToUpdate().getControlDMContext(), child.getVarName()), new DataRequestMonitor(fSession.getExecutor(), childPathRm) { @Override protected void handleCompleted() { @@ -881,7 +873,7 @@ public class MIVariableManager implements ICommandControl { // No need to be in ready state or to lock the object fCommandControl.queueCommand( - new MIVarAssign(getRootToUpdate().getControlDMContext(), getGdbName(), value), + fCommandFactory.createMIVarAssign(getRootToUpdate().getControlDMContext(), getGdbName(), value), new DataRequestMonitor(fSession.getExecutor(), rm) { @Override protected void handleSuccess() { @@ -979,7 +971,7 @@ public class MIVariableManager implements ICommandControl { fControlContext = DMContexts.getAncestorOfType(exprCtx, ICommandControlDMContext.class); fCommandControl.queueCommand( - new MIVarCreate(exprCtx, exprCtx.getExpression()), + fCommandFactory.createMIVarCreate(exprCtx, exprCtx.getExpression()), new DataRequestMonitor(fSession.getExecutor(), rm) { @Override protected void handleCompleted() { @@ -1070,7 +1062,7 @@ public class MIVariableManager implements ICommandControl { // of a variable object, we immediately set it back to natural with a second // var-set-format command. This is done in the getValue() method fCommandControl.queueCommand( - new MIVarUpdate(getRootToUpdate().getControlDMContext(), getGdbName()), + fCommandFactory.createMIVarUpdate(getRootToUpdate().getControlDMContext(), getGdbName()), new DataRequestMonitor(fSession.getExecutor(), rm) { @Override protected void handleCompleted() { @@ -1140,7 +1132,7 @@ public class MIVariableManager implements ICommandControl { public void deleteInGdb() { if (getGdbName() != null) { fCommandControl.queueCommand( - new MIVarDelete(getRootToUpdate().getControlDMContext(), getGdbName()), + fCommandFactory.createMIVarDelete(getRootToUpdate().getControlDMContext(), getGdbName()), new DataRequestMonitor(fSession.getExecutor(), null)); // Nothing to do in the requestMonitor, since the object was already // removed from our list before calling this method. @@ -1336,6 +1328,8 @@ public class MIVariableManager implements ICommandControl { /** Provides access to the GDB/MI back-end */ private final ICommandControl fCommandControl; + private CommandFactory fCommandFactory; + // The stack service needs to be used to get information such // as the stack depth to differentiate between expressions that have the // same name but refer to a different context @@ -1365,7 +1359,8 @@ public class MIVariableManager implements ICommandControl { fCommandControl = tracker.getService(ICommandControl.class); fStackService = tracker.getService(IStack.class); fExpressionService = tracker.getService(IExpressions.class); - + fCommandFactory = tracker.getService(IMICommandControl.class).getCommandFactory(); + // Register to receive service events for this session. fSession.addServiceEventListener(this, null); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java index 7e70cbee9f2..fa4824e4bda 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/AbstractMIControl.java @@ -17,7 +17,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; -import com.ibm.icu.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -34,12 +33,12 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl; import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.cdt.dsf.debug.service.command.ICommand; -import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.debug.service.command.ICommandListener; import org.eclipse.cdt.dsf.debug.service.command.ICommandResult; import org.eclipse.cdt.dsf.debug.service.command.ICommandToken; import org.eclipse.cdt.dsf.debug.service.command.IEventListener; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackSelectFrame; @@ -59,6 +58,8 @@ import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import com.ibm.icu.text.MessageFormat; + /** * Base implementation of an MI control service. It provides basic handling * of input/output channels, and processing of the commands. @@ -66,7 +67,7 @@ import org.eclipse.core.runtime.Status; * Extending classes need to implement the initialize() and shutdown() methods. */ public abstract class AbstractMIControl extends AbstractDsfService - implements ICommandControlService + implements IMICommandControl { private static final String MI_TRACE_IDENTIFIER = " [MI] "; //$NON-NLS-1$ @@ -120,18 +121,21 @@ public abstract class AbstractMIControl extends AbstractDsfService */ private OutputStream fTracingStream = null; + private CommandFactory fCommandFactory; public AbstractMIControl(DsfSession session) { super(session); fUseThreadAndFrameOptions = false; + fCommandFactory = new CommandFactory(); } /** - * @since 1.1 + * @since 3.0 */ - public AbstractMIControl(DsfSession session, boolean useThreadAndFrameOptions) { + public AbstractMIControl(DsfSession session, boolean useThreadAndFrameOptions, CommandFactory factory) { super(session); fUseThreadAndFrameOptions = useThreadAndFrameOptions; + fCommandFactory = factory; } /** @@ -153,6 +157,13 @@ public abstract class AbstractMIControl extends AbstractDsfService return fTracingStream; } + /** + * @since 3.0 + */ + public CommandFactory getCommandFactory() { + return fCommandFactory; + } + /** * Starts the threads that process the debugger input/output channels. * To be invoked by the initialization routine of the extending class. diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java new file mode 100644 index 00000000000..54dca7c6294 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/CommandFactory.java @@ -0,0 +1,732 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + * ENEA Software AB - CLI command extension - fix for bug 190277 + * Ericsson - Implementation for DSF-GDB + *******************************************************************************/ + +package org.eclipse.cdt.dsf.mi.service.command; + +import org.eclipse.cdt.dsf.datamodel.IDMContext; +import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext; +import org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext; +import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext; +import org.eclipse.cdt.dsf.debug.service.IModules.IModuleDMContext; +import org.eclipse.cdt.dsf.debug.service.IModules.ISymbolDMContext; +import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; +import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; +import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; +import org.eclipse.cdt.dsf.debug.service.command.ICommand; +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; +import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceTargetDMContext; +import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLIAttach; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLIDetach; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLIExecAbort; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoSharedLibrary; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLIInfoThreads; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLIJump; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLIPasscount; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLIRecord; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLISource; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLIThread; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLITrace; +import org.eclipse.cdt.dsf.mi.service.command.commands.CLIUnsetEnv; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakAfter; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakCondition; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakDelete; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakDisable; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakEnable; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakList; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakPasscount; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakWatch; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataDisassemble; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataEvaluateExpression; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataListRegisterNames; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataListRegisterValues; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataReadMemory; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIDataWriteMemory; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIEnvironmentCD; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIEnvironmentDirectory; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecContinue; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecFinish; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecInterrupt; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecJump; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecNext; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecNextInstruction; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReturn; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseContinue; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseNext; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseNextInstruction; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseStep; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecReverseStepInstruction; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecRun; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecStep; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecStepInstruction; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecUncall; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecUntil; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIFileExecAndSymbols; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIFileExecFile; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIFileSymbolFile; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBExit; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSet; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetArgs; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetAutoSolib; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetEnv; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetNonStop; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetPagination; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetSolibSearchPath; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBSetTargetAsync; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBShowExitCode; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIInferiorTTYSet; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIInterpreterExec; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIInterpreterExecConsole; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIListThreadGroups; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackInfoDepth; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackListArguments; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackListFrames; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackListLocals; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackSelectFrame; +import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetAttach; +import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetDetach; +import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelect; +import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelectCore; +import org.eclipse.cdt.dsf.mi.service.command.commands.MITargetSelectTFile; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIThreadInfo; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIThreadListIds; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIThreadSelect; +import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceDefineVariable; +import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceListVariables; +import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceSave; +import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceStart; +import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceStatus; +import org.eclipse.cdt.dsf.mi.service.command.commands.MITraceStop; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarAssign; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarCreate; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarDelete; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarEvaluateExpression; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarInfoExpression; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarInfoNumChildren; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarInfoPathExpression; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarInfoType; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarListChildren; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarSetFormat; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarShowAttributes; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarShowFormat; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarUpdate; +import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoSharedLibraryInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoThreadsInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.CLIThreadInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.CLITraceInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakListInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIDataDisassembleInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIDataEvaluateExpressionInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIDataListRegisterNamesInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIDataListRegisterValuesInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIDataReadMemoryInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIDataWriteMemoryInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBShowExitCodeInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIListThreadGroupsInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIStackInfoDepthInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListArgumentsInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListFramesInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIStackListLocalsInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIThreadInfoInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIThreadListIdsInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MITraceListVariablesInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MITraceStatusInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MITraceStopInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarAssignInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarCreateInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarDeleteInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarEvaluateExpressionInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarInfoExpressionInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarInfoNumChildrenInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarInfoPathExpressionInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarInfoTypeInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarListChildrenInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarSetFormatInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarShowAttributesInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarShowFormatInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarUpdateInfo; + + +/** + * Factory to create MI/CLI commands. + * + * @since 3.0 + */ +public class CommandFactory { + + public ICommand createCLIAttach(IDMContext ctx, int pid) { + return new CLIAttach(ctx, pid); + } + + public ICommand createCLIAttach(ICommandControlDMContext ctx, String pid) { + return new CLIAttach(ctx, pid); + } + + public ICommand createCLIDetach(IDMContext ctx) { + return new CLIDetach(ctx); + } + + public ICommand createCLIExecAbort(ICommandControlDMContext ctx) { + return new CLIExecAbort(ctx); + } + + public ICommand createCLIInfoSharedLibrary(ISymbolDMContext ctx) { + return new CLIInfoSharedLibrary(ctx); + } + + public ICommand createCLIInfoSharedLibrary(IModuleDMContext ctx) { + return new CLIInfoSharedLibrary(ctx); + } + + public ICommand createCLIInfoThreads(IContainerDMContext ctx) { + return new CLIInfoThreads(ctx); + } + + public ICommand createCLIJump(IExecutionDMContext ctx, String location) { + return new CLIJump(ctx, location); + } + + public ICommand createCLIPasscount(IBreakpointsTargetDMContext ctx, int breakpoint, int passcount) { + return new CLIPasscount(ctx, breakpoint, passcount); + } + + public ICommand createCLIRecord(ICommandControlDMContext ctx, boolean enable) { + return new CLIRecord(ctx, enable); + } + + public ICommand createCLISource(ICommandControlDMContext ctx, String file) { + return new CLISource(ctx, file); + } + + public ICommand createCLIThread(IContainerDMContext ctx) { + return new CLIThread(ctx); + } + + public ICommand createCLITrace(IBreakpointsTargetDMContext ctx, String location) { + return new CLITrace(ctx, location); + } + + public ICommand createCLITrace(IBreakpointsTargetDMContext ctx, String location, String condition) { + return new CLITrace(ctx, location, condition); + } + + public ICommand createCLIUnsetEnv(ICommandControlDMContext ctx) { + return new CLIUnsetEnv(ctx); + } + + public ICommand createCLIUnsetEnv(ICommandControlDMContext ctx, String name) { + return new CLIUnsetEnv(ctx, name); + } + + public ICommand createMIBreakAfter(IBreakpointsTargetDMContext ctx, int breakpoint, int ignoreCount) { + return new MIBreakAfter(ctx, breakpoint, ignoreCount); + } + + public ICommand createMIBreakCondition(IBreakpointsTargetDMContext ctx, int breakpoint, String condition) { + return new MIBreakCondition(ctx, breakpoint, condition); + } + + public ICommand createMIBreakDelete(IBreakpointsTargetDMContext ctx, int[] array) { + return new MIBreakDelete(ctx, array); + } + + public ICommand createMIBreakDisable(IBreakpointsTargetDMContext ctx, int[] array) { + return new MIBreakDisable(ctx, array); + } + + public ICommand createMIBreakEnable(IBreakpointsTargetDMContext ctx, int[] array) { + return new MIBreakEnable(ctx, array); + } + + public ICommand createMIBreakInsert(IBreakpointsTargetDMContext ctx, String func) { + return new MIBreakInsert(ctx, func); + } + + public ICommand createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, + boolean isHardware, String condition, int ignoreCount, + String line, int tid) { + return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, line, tid); + } + + public ICommand createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, + boolean isHardware, String condition, int ignoreCount, + String location, int tid, boolean disabled, boolean isTracepoint) { + return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, location, tid, disabled, isTracepoint); + } + + public ICommand createMIBreakList(IBreakpointsTargetDMContext ctx) { + return new MIBreakList(ctx); + } + + public ICommand createMIBreakPasscount(IBreakpointsTargetDMContext ctx, int tracepoint, int passCount) { + return new MIBreakPasscount(ctx, tracepoint, passCount); + } + + public ICommand createMIBreakWatch(IBreakpointsTargetDMContext ctx, boolean isRead, boolean isWrite, String expression) { + return new MIBreakWatch(ctx, isRead, isWrite, expression); + } + + public ICommand createMIDataDisassemble(IDisassemblyDMContext ctx, String start, String end, boolean mode) { + return new MIDataDisassemble(ctx, start, end, mode); + } + + public ICommand createMIDataDisassemble(IDisassemblyDMContext ctx, String file, int linenum, int lines, boolean mode) { + return new MIDataDisassemble(ctx, file, linenum, lines, mode); + } + + public ICommand createMIDataEvaluateExpression(ICommandControlDMContext ctx, String expr) { + return new MIDataEvaluateExpression(ctx, expr); + } + + public ICommand createMIDataEvaluateExpression(IMIExecutionDMContext execDmc, String expr) { + return new MIDataEvaluateExpression(execDmc, expr); + } + + public ICommand createMIDataEvaluateExpression(IFrameDMContext frameDmc, String expr) { + return new MIDataEvaluateExpression(frameDmc, expr); + } + + public ICommand createMIDataEvaluateExpression(IExpressionDMContext exprDmc) { + return new MIDataEvaluateExpression(exprDmc); + } + + public ICommand createMIDataListRegisterNames(IContainerDMContext ctx) { + return new MIDataListRegisterNames(ctx); + } + + public ICommand createMIDataListRegisterNames(IContainerDMContext ctx, int [] regnos) { + return new MIDataListRegisterNames(ctx, regnos); + } + + public ICommand createMIDataListRegisterValues(IMIExecutionDMContext ctx, int fmt) { + return new MIDataListRegisterValues(ctx, fmt); + } + + public ICommand createMIDataListRegisterValues(IMIExecutionDMContext ctx, int fmt, int [] regnos) { + return new MIDataListRegisterValues(ctx, fmt, regnos); + } + + public ICommand createMIDataReadMemory(IDMContext ctx, long offset, String address, + int word_format, int word_size, int rows, int cols, + Character asChar) { + return new MIDataReadMemory(ctx, offset, address, word_format, word_size, rows, cols, asChar); + } + + public ICommand createMIDataWriteMemory(IDMContext ctx, long offset, String address, + int wordFormat, int wordSize, String value) { + return new MIDataWriteMemory(ctx, offset, address, wordFormat, wordSize, value); + } + + public ICommand createMIEnvironmentCD(ICommandControlDMContext ctx, String path) { + return new MIEnvironmentCD(ctx, path); + } + + public ICommand createMIEnvironmentDirectory(IDMContext ctx, String[] paths, boolean reset) { + return new MIEnvironmentDirectory(ctx, paths, reset); + } + + public ICommand createMIExecContinue(IExecutionDMContext dmc) { + return new MIExecContinue(dmc); + } + + public ICommand createMIExecContinue(IExecutionDMContext dmc, boolean allThreads) { + return new MIExecContinue(dmc, allThreads); + } + + public ICommand createMIExecContinue(IExecutionDMContext dmc, String groupId) { + return new MIExecContinue(dmc, groupId); + } + + public ICommand createMIExecFinish(IFrameDMContext dmc) { + return new MIExecFinish(dmc); + } + + public ICommand createMIExecInterrupt(IExecutionDMContext dmc) { + return new MIExecInterrupt(dmc); + } + + public ICommand createMIExecInterrupt(IExecutionDMContext dmc, boolean allThreads) { + return new MIExecInterrupt(dmc, allThreads); + } + + public ICommand createMIExecInterrupt(IExecutionDMContext dmc, String groupId) { + return new MIExecInterrupt(dmc, groupId); + } + + public ICommand createMIExecJump(IExecutionDMContext ctx, String location) { + return new MIExecJump(ctx, location); + } + + public ICommand createMIExecNextInstruction(IExecutionDMContext dmc) { + return new MIExecNextInstruction(dmc); + } + + public ICommand createMIExecNextInstruction(IExecutionDMContext dmc, int count) { + return new MIExecNextInstruction(dmc, count); + } + + public ICommand createMIExecNext(IExecutionDMContext dmc) { + return new MIExecNext(dmc); + } + + public ICommand createMIExecNext(IExecutionDMContext dmc, int count) { + return new MIExecNext(dmc, count); + } + + public ICommand createMIExecReturn(IFrameDMContext dmc) { + return new MIExecReturn(dmc); + } + + public ICommand createMIExecReturn(IFrameDMContext dmc, String arg) { + return new MIExecReturn(dmc, arg); + } + + public ICommand createMIExecReverseContinue(IExecutionDMContext dmc) { + return new MIExecReverseContinue(dmc); + } + + public ICommand createMIExecReverseNextInstruction(IExecutionDMContext dmc) { + return new MIExecReverseNextInstruction(dmc); + } + + public ICommand createMIExecReverseNextInstruction(IExecutionDMContext dmc, int count) { + return new MIExecReverseNextInstruction(dmc, count); + } + + public ICommand createMIExecReverseNext(IExecutionDMContext dmc) { + return new MIExecReverseNext(dmc); + } + + public ICommand createMIExecReverseNext(IExecutionDMContext dmc, int count) { + return new MIExecReverseNext(dmc, count); + } + + public ICommand createMIExecReverseStepInstruction(IExecutionDMContext dmc) { + return new MIExecReverseStepInstruction(dmc); + } + + public ICommand createMIExecReverseStepInstruction(IExecutionDMContext dmc, int count) { + return new MIExecReverseStepInstruction(dmc, count); + } + + public ICommand createMIExecReverseStep(IExecutionDMContext dmc) { + return new MIExecReverseStep(dmc); + } + + public ICommand createMIExecReverseStep(IExecutionDMContext dmc, int count) { + return new MIExecReverseStep(dmc, count); + } + + public ICommand createMIExecRun(IExecutionDMContext dmc) { + return new MIExecRun(dmc); + } + + public ICommand createMIExecRun(IExecutionDMContext dmc, String[] args) { + return new MIExecRun(dmc, args); + } + + public ICommand createMIExecStepInstruction(IExecutionDMContext dmc) { + return new MIExecStepInstruction(dmc); + } + + public ICommand createMIExecStepInstruction(IExecutionDMContext dmc, int count) { + return new MIExecStepInstruction(dmc, count); + } + + public ICommand createMIExecStep(IExecutionDMContext dmc) { + return new MIExecStep(dmc); + } + + public ICommand createMIExecStep(IExecutionDMContext dmc, int count) { + return new MIExecStep(dmc, count); + } + + public ICommand createMIExecUncall(IFrameDMContext dmc) { + return new MIExecUncall(dmc); + } + + public ICommand createMIExecUntil(IExecutionDMContext dmc) { + return new MIExecUntil(dmc); + } + + public ICommand createMIExecUntil(IExecutionDMContext dmc, String loc) { + return new MIExecUntil(dmc, loc); + } + + public ICommand createMIFileExecAndSymbols(ICommandControlDMContext dmc, String file) { + return new MIFileExecAndSymbols(dmc, file); + } + + public ICommand createMIFileExecAndSymbols(ICommandControlDMContext dmc) { + return new MIFileExecAndSymbols(dmc); + } + + public ICommand createMIFileExecFile(ICommandControlDMContext dmc, String file) { + return new MIFileExecFile(dmc, file); + } + + public ICommand createMIFileExecFile(ICommandControlDMContext dmc) { + return new MIFileExecFile(dmc); + } + + public ICommand createMIFileSymbolFile(ICommandControlDMContext dmc, String file) { + return new MIFileSymbolFile(dmc, file); + } + + public ICommand createMIFileSymbolFile(ICommandControlDMContext dmc) { + return new MIFileSymbolFile(dmc); + } + + public ICommand createMIGDBExit(IDMContext ctx) { + return new MIGDBExit(ctx); + } + + public ICommand createMIGDBSet(IDMContext ctx, String[] params) { + return new MIGDBSet(ctx, params); + } + + public ICommand createMIGDBSetArgs(ICommandControlDMContext dmc) { + return new MIGDBSetArgs(dmc); + } + + public ICommand createMIGDBSetArgs(ICommandControlDMContext dmc, String arguments) { + return new MIGDBSetArgs(dmc, arguments); + } + + public ICommand createMIGDBSetAutoSolib(ICommandControlDMContext ctx, boolean isSet) { + return new MIGDBSetAutoSolib(ctx, isSet); + } + + public ICommand createMIGDBSetEnv(ICommandControlDMContext dmc, String name) { + return new MIGDBSetEnv(dmc, name); + } + + public ICommand createMIGDBSetEnv(ICommandControlDMContext dmc, String name, String value) { + return new MIGDBSetEnv(dmc, name, value); + } + + public ICommand createMIGDBSetNonStop(ICommandControlDMContext ctx, boolean isSet) { + return new MIGDBSetNonStop(ctx, isSet); + } + + public ICommand createMIGDBSetPagination(ICommandControlDMContext ctx, boolean isSet) { + return new MIGDBSetPagination(ctx, isSet); + } + + public ICommand createMIGDBSetSolibSearchPath(ICommandControlDMContext ctx, String[] paths) { + return new MIGDBSetSolibSearchPath(ctx, paths); + } + + public ICommand createMIGDBSetTargetAsync(ICommandControlDMContext ctx, boolean isSet) { + return new MIGDBSetTargetAsync(ctx, isSet); + } + + public ICommand createMIGDBShowExitCode(ICommandControlDMContext ctx) { + return new MIGDBShowExitCode(ctx); + } + + public ICommand createMIInferiorTTYSet(ICommandControlDMContext dmc, String tty) { + return new MIInferiorTTYSet(dmc, tty); + } + + public ICommand createMIInterpreterExecConsole(IDMContext ctx, String cmd) { + return new MIInterpreterExecConsole(ctx, cmd); + } + + public ICommand createMIInterpreterExec(IDMContext ctx, String interpreter, String cmd) { + return new MIInterpreterExec(ctx, interpreter, cmd); + } + + public ICommand createMIListThreadGroups(ICommandControlDMContext ctx) { + return new MIListThreadGroups(ctx); + } + + public ICommand createMIListThreadGroups(ICommandControlDMContext ctx, String groupId) { + return new MIListThreadGroups(ctx, groupId); + } + + public ICommand createMIListThreadGroups(ICommandControlDMContext ctx, boolean listAll) { + return new MIListThreadGroups(ctx, listAll); + } + + public ICommand createMIStackInfoDepth(IMIExecutionDMContext ctx) { + return new MIStackInfoDepth(ctx); + } + + public ICommand createMIStackInfoDepth(IMIExecutionDMContext ctx, int maxDepth) { + return new MIStackInfoDepth(ctx, maxDepth); + } + + public ICommand createMIStackListArguments(IMIExecutionDMContext execDmc, boolean showValues) { + return new MIStackListArguments(execDmc, showValues); + } + + public ICommand createMIStackListArguments(IFrameDMContext frameDmc, boolean showValues) { + return new MIStackListArguments(frameDmc, showValues); + } + + public ICommand createMIStackListArguments(IMIExecutionDMContext execDmc, boolean showValues, int low, int high) { + return new MIStackListArguments(execDmc, showValues, low, high); + } + + public ICommand createMIStackListFrames(IMIExecutionDMContext execDmc) { + return new MIStackListFrames(execDmc); + } + + public ICommand createMIStackListFrames(IMIExecutionDMContext execDmc, int low, int high) { + return new MIStackListFrames(execDmc, low, high); + } + + public ICommand createMIStackListLocals(IFrameDMContext frameCtx, boolean printValues) { + return new MIStackListLocals(frameCtx, printValues); + } + + public ICommand createMIStackSelectFrame(IDMContext ctx, int frameNum) { + return new MIStackSelectFrame(ctx, frameNum); + } + + public ICommand createMITargetAttach(ICommandControlDMContext ctx, String groupId) { + return new MITargetAttach(ctx, groupId); + } + + public ICommand createMITargetDetach(ICommandControlDMContext ctx, String groupId) { + return new MITargetDetach(ctx, groupId); + } + + public ICommand createMITargetSelect(IDMContext ctx, String host, String port, boolean extended) { + return new MITargetSelect(ctx, host, port, extended); + } + + public ICommand createMITargetSelect(IDMContext ctx, String serialDevice, boolean extended) { + return new MITargetSelect(ctx, serialDevice, extended); + } + + public ICommand createMITargetSelectCore(IDMContext ctx, String coreFilePath) { + return new MITargetSelectCore(ctx, coreFilePath); + } + + public ICommand createMITargetSelectTFile(IDMContext ctx, String traceFilePath) { + return new MITargetSelectTFile(ctx, traceFilePath); + } + + public ICommand createMIThreadInfo(ICommandControlDMContext dmc) { + return new MIThreadInfo(dmc); + } + + public ICommand createMIThreadInfo(ICommandControlDMContext dmc, String threadId) { + return new MIThreadInfo(dmc, threadId); + } + + public ICommand createMIThreadListIds(IContainerDMContext contDmc) { + return new MIThreadListIds(contDmc); + } + + public ICommand createMIThreadSelect(IDMContext ctx, int threadNum) { + return new MIThreadSelect(ctx, threadNum); + } + + public ICommand createMIThreadSelect(IDMContext ctx, String threadNum) { + return new MIThreadSelect(ctx, threadNum); + } + + public ICommand createMITraceDefineVariable(ITraceTargetDMContext ctx, String varName) { + return new MITraceDefineVariable(ctx, varName); + } + + public ICommand createMITraceDefineVariable(ITraceTargetDMContext ctx, String varName, String varValue) { + return new MITraceDefineVariable(ctx, varName, varValue); + } + + public ICommand createMITraceListVariables(ITraceTargetDMContext ctx) { + return new MITraceListVariables(ctx); + } + + public ICommand createMITraceSave(ITraceTargetDMContext ctx, String file, boolean remoteSave) { + return new MITraceSave(ctx, file, remoteSave); + } + + public ICommand createMITraceStart(ITraceTargetDMContext ctx) { + return new MITraceStart(ctx); + } + + public ICommand createMITraceStatus(ITraceTargetDMContext ctx) { + return new MITraceStatus(ctx); + } + + public ICommand createMITraceStop(ITraceTargetDMContext ctx) { + return new MITraceStop(ctx); + } + + public ICommand createMIVarAssign(ICommandControlDMContext ctx, String name, String expression) { + return new MIVarAssign(ctx, name, expression); + } + + public ICommand createMIVarCreate(IExpressionDMContext dmc, String expression) { + return new MIVarCreate(dmc, expression); + } + + public ICommand createMIVarCreate(IExpressionDMContext dmc, String name, String expression) { + return new MIVarCreate(dmc, name, expression); + } + + public ICommand createMIVarCreate(IExpressionDMContext dmc, String name, String frameAddr, String expression) { + return new MIVarCreate(dmc, name, frameAddr, expression); + } + + public ICommand createMIVarDelete(ICommandControlDMContext dmc, String name) { + return new MIVarDelete(dmc, name); + } + + public ICommand createMIVarEvaluateExpression(ICommandControlDMContext dmc, String name) { + return new MIVarEvaluateExpression(dmc, name); + } + + public ICommand createMIVarInfoExpression(ICommandControlDMContext ctx, String name) { + return new MIVarInfoExpression(ctx, name); + } + + public ICommand createMIVarInfoNumChildren(IExpressionDMContext ctx, String name) { + return new MIVarInfoNumChildren(ctx, name); + } + + public ICommand createMIVarInfoPathExpression(ICommandControlDMContext dmc, String name) { + return new MIVarInfoPathExpression(dmc, name); + } + + public ICommand createMIVarInfoType(ICommandControlDMContext ctx, String name) { + return new MIVarInfoType(ctx, name); + } + + public ICommand createMIVarListChildren(ICommandControlDMContext ctx, String name) { + return new MIVarListChildren(ctx, name); + } + + public ICommand createMIVarSetFormat(ICommandControlDMContext ctx, String name, String fmt) { + return new MIVarSetFormat(ctx, name, fmt); + } + + public ICommand createMIVarShowAttributes(ICommandControlDMContext ctx, String name) { + return new MIVarShowAttributes(ctx, name); + } + + public ICommand createMIVarShowFormat(ICommandControlDMContext ctx, String name) { + return new MIVarShowFormat(ctx, name); + } + + public ICommand createMIVarUpdate(ICommandControlDMContext dmc, String name) { + return new MIVarUpdate(dmc, name); + } +} \ No newline at end of file diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java index af5d77203ae..cbeb8b3c385 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java @@ -32,16 +32,16 @@ import org.eclipse.cdt.dsf.concurrent.ThreadSafe; import org.eclipse.cdt.dsf.concurrent.ThreadSafeAndProhibitedFromDsfExecutor; import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; +import org.eclipse.cdt.dsf.debug.service.command.ICommand; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; import org.eclipse.cdt.dsf.debug.service.command.ICommandListener; import org.eclipse.cdt.dsf.debug.service.command.ICommandResult; import org.eclipse.cdt.dsf.debug.service.command.ICommandToken; import org.eclipse.cdt.dsf.debug.service.command.IEventListener; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerExitedDMEvent; import org.eclipse.cdt.dsf.mi.service.command.commands.CLICommand; -import org.eclipse.cdt.dsf.mi.service.command.commands.CLIExecAbort; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIGDBShowExitCode; import org.eclipse.cdt.dsf.mi.service.command.output.MIConst; import org.eclipse.cdt.dsf.mi.service.command.output.MIExecAsyncOutput; import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBShowExitCodeInfo; @@ -83,6 +83,7 @@ public class MIInferiorProcess extends Process private final PTY fPty; private final ICommandControlService fCommandControl; + private CommandFactory fCommandFactory; private IContainerDMContext fContainerDMContext; @@ -146,6 +147,13 @@ public class MIInferiorProcess extends Process fCommandControl = commandControl; fSession = commandControl.getSession(); + if (fCommandControl instanceof IMICommandControl) { + fCommandFactory = ((IMICommandControl)fCommandControl).getCommandFactory(); + } else { + // Should not happen + fCommandFactory = new CommandFactory(); + } + commandControl.addEventListener(this); commandControl.addCommandListener(this); @@ -282,7 +290,7 @@ public class MIInferiorProcess extends Process rm.done(); } else { getCommandControlService().queueCommand( - new MIGDBShowExitCode(getCommandControlService().getContext()), + fCommandFactory.createMIGDBShowExitCode(getCommandControlService().getContext()), new DataRequestMonitor(fSession.getExecutor(), rm) { @Override protected void handleSuccess() { @@ -355,7 +363,7 @@ public class MIInferiorProcess extends Process // To avoid a RejectedExecutionException, use an executor that // immediately executes in the same dispatch cycle. - CLIExecAbort cmd = new CLIExecAbort(getCommandControlService().getContext()); + ICommand cmd = fCommandFactory.createCLIExecAbort(getCommandControlService().getContext()); getCommandControlService().queueCommand( cmd, new DataRequestMonitor(ImmediateExecutor.getInstance(), null) { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarUpdate.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarUpdate.java index 535381a92f6..2adc1d0e142 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarUpdate.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIVarUpdate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 QNX Software Systems and others. + * Copyright (c) 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,7 +35,7 @@ public class MIVarUpdate extends MICommand { * @since 1.1 */ public MIVarUpdate(ICommandControlDMContext dmc, String name) { - super(dmc, "-var-update", new String[] { "1", name }); //$NON-NLS-1$//$NON-NLS-2$ + super(dmc, "-var-update", new String[] { "1" }, new String[] { name }); //$NON-NLS-1$//$NON-NLS-2$ } @Override diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/macos/MacOSMIEnvironmentCD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/macos/MacOSMIEnvironmentCD.java new file mode 100644 index 00000000000..38f0ccd83e5 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/macos/MacOSMIEnvironmentCD.java @@ -0,0 +1,22 @@ +/********************************************************************** + * Copyright (c) 2006, 2010 Nokia 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: + * Nokia - Initial API and implementation + * Marc-Andre Laperle - fix for bug 263689 (spaces in directory) +***********************************************************************/ +package org.eclipse.cdt.dsf.mi.service.command.commands.macos; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIEnvironmentCD; + +public class MacOSMIEnvironmentCD extends MIEnvironmentCD { + + public MacOSMIEnvironmentCD(ICommandControlDMContext ctx, String path) { + super(ctx, '\"' + path + '\"'); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/macos/MacOSMIVarUpdate.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/macos/MacOSMIVarUpdate.java index 602d3e26d23..5a5bf2f3b2e 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/macos/MacOSMIVarUpdate.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/macos/MacOSMIVarUpdate.java @@ -14,8 +14,9 @@ package org.eclipse.cdt.dsf.mi.service.command.commands.macos; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; -import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIVarUpdate; import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarUpdateInfo; import org.eclipse.cdt.dsf.mi.service.command.output.macos.MacOSMIVarUpdateInfo; /** @@ -35,15 +36,16 @@ import org.eclipse.cdt.dsf.mi.service.command.output.macos.MacOSMIVarUpdateInfo; * * @since 3.0 */ -public class MacOSMIVarUpdate extends MICommand { +public class MacOSMIVarUpdate extends MIVarUpdate { public MacOSMIVarUpdate(ICommandControlDMContext dmc, String name) { + super(dmc, name); // Must use --all-values instead of 1 for Mac OS - super(dmc, "-var-update", new String[] { "--all-values", name }); //$NON-NLS-1$//$NON-NLS-2$ + setOptions(new String[] { "--all-values" }); //$NON-NLS-1$ } @Override - public MacOSMIVarUpdateInfo getResult(MIOutput out) { + public MIVarUpdateInfo getResult(MIOutput out) { return new MacOSMIVarUpdateInfo(out); } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarUpdateInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarUpdateInfo.java index e0953c62108..8ae196f640a 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarUpdateInfo.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIVarUpdateInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. + * Copyright (c) 2000, 2010 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -52,10 +52,9 @@ public class MIVarUpdateInfo extends MIInfo { /** * For MI2 the format is now a MIList. - * @param tuple - * @param aList + * @since 3.0 */ - void parseChangeList(MIList miList, List aList) { + protected void parseChangeList(MIList miList, List aList) { MIValue[] values = miList.getMIValues(); for (int i = 0; i < values.length; ++i) { if (values[i] instanceof MITuple) { @@ -66,7 +65,10 @@ public class MIVarUpdateInfo extends MIInfo { } } - void parseChangeList(MITuple tuple, List aList) { + /** + * @since 3.0 + */ + protected void parseChangeList(MITuple tuple, List aList) { MIResult[] results = tuple.getMIResults(); MIVarChange change = null; for (int i = 0; i < results.length; i++) { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/macos/MacOSMIVarUpdateInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/macos/MacOSMIVarUpdateInfo.java index 68785c1909b..c5c2658e7fc 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/macos/MacOSMIVarUpdateInfo.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/macos/MacOSMIVarUpdateInfo.java @@ -11,18 +11,15 @@ *******************************************************************************/ package org.eclipse.cdt.dsf.mi.service.command.output.macos; -import java.util.ArrayList; import java.util.List; -import org.eclipse.cdt.dsf.mi.service.command.output.MIConst; -import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIList; import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput; import org.eclipse.cdt.dsf.mi.service.command.output.MIResult; -import org.eclipse.cdt.dsf.mi.service.command.output.MIResultRecord; import org.eclipse.cdt.dsf.mi.service.command.output.MITuple; import org.eclipse.cdt.dsf.mi.service.command.output.MIValue; import org.eclipse.cdt.dsf.mi.service.command.output.MIVarChange; +import org.eclipse.cdt.dsf.mi.service.command.output.MIVarUpdateInfo; /** * GDB/MI var-update for Mac OS. @@ -31,36 +28,10 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIVarChange; * * @since 3.0 */ -public class MacOSMIVarUpdateInfo extends MIInfo { - - MIVarChange[] changeList; +public class MacOSMIVarUpdateInfo extends MIVarUpdateInfo { public MacOSMIVarUpdateInfo(MIOutput record) { super(record); - List aList = new ArrayList(); - if (isDone()) { - MIOutput out = getMIOutput(); - MIResultRecord rr = out.getMIResultRecord(); - if (rr != null) { - MIResult[] results = rr.getMIResults(); - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - if (var.equals("changelist")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MITuple) { - parseChangeList((MITuple)value, aList); - } else if (value instanceof MIList) { - parseChangeList((MIList)value, aList); - } - } - } - } - } - changeList = aList.toArray(new MIVarChange[aList.size()]); - } - - public MIVarChange[] getMIVarChanges() { - return changeList; } /** @@ -68,7 +39,8 @@ public class MacOSMIVarUpdateInfo extends MIInfo { * @param tuple * @param aList */ - void parseChangeList(MIList miList, List aList) { + @Override + protected void parseChangeList(MIList miList, List aList) { // The MIList in Apple gdb contains MIResults instead of MIValues. It looks like: // ^done,changelist=[varobj={name="var1",in_scope="true",type_changed="false"}],time={.....} // Bug 250037 @@ -84,40 +56,5 @@ public class MacOSMIVarUpdateInfo extends MIInfo { } } } - } - - void parseChangeList(MITuple tuple, List aList) { - MIResult[] results = tuple.getMIResults(); - MIVarChange change = null; - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - MIValue value = results[i].getMIValue(); - if (value instanceof MITuple) { - parseChangeList((MITuple)value, aList); - } - else - { - String str = ""; //$NON-NLS-1$ - if (value instanceof MIConst) { - str = ((MIConst)value).getString(); - } - if (var.equals("name")) { //$NON-NLS-1$ - change = new MIVarChange(str); - aList.add(change); - } else if (var.equals("value")) { //$NON-NLS-1$ - if (change != null) { - change.setValue(str); - } - } else if (var.equals("in_scope")) { //$NON-NLS-1$ - if (change != null) { - change.setInScope("true".equals(str)); //$NON-NLS-1$ - } - } else if (var.equals("type_changed")) { //$NON-NLS-1$ - if (change != null) { - change.setChanged("true".equals(str)); //$NON-NLS-1$ - } - } - } - } } } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java index 6953d8e611c..6257566a45b 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java @@ -33,19 +33,13 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType; import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext; import org.eclipse.cdt.dsf.mi.service.IMIProcesses; import org.eclipse.cdt.dsf.mi.service.MIProcesses; import org.eclipse.cdt.dsf.mi.service.MIRunControl; import org.eclipse.cdt.dsf.mi.service.MIStack; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakDelete; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakList; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecContinue; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecFinish; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecNext; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecStep; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIExecUntil; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.events.MIRunningEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent; import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; @@ -70,6 +64,8 @@ public class SyncUtil { private static IExpressions fExpressions; private static DsfSession fSession; + private static CommandFactory fCommandFactory; + private static IContainerDMContext fGdbContainerDmc; private static IBreakpointsTargetDMContext fBreakpointsDmc; @@ -94,6 +90,8 @@ public class SyncUtil { fStack = tracker.getService(MIStack.class); fExpressions = tracker.getService(IExpressions.class); + fCommandFactory = tracker.getService(IMICommandControl.class).getCommandFactory(); + tracker.dispose(); } @@ -138,13 +136,13 @@ public class SyncUtil { // ServiceEvent telling us the program has been suspended again switch(stepType) { case STEP_INTO: - fCommandControl.queueCommand(new MIExecStep(dmc), null); + fCommandControl.queueCommand(fCommandFactory.createMIExecStep(dmc), null); break; case STEP_OVER: - fCommandControl.queueCommand(new MIExecNext(dmc), null); + fCommandControl.queueCommand(fCommandFactory.createMIExecNext(dmc), null); break; case STEP_RETURN: - fCommandControl.queueCommand(new MIExecFinish(fStack.createFrameDMContext(dmc, 0)), null); + fCommandControl.queueCommand(fCommandFactory.createMIExecFinish(fStack.createFrameDMContext(dmc, 0)), null); break; default: Assert.assertTrue("Unsupported step type; " + stepType.toString(), false); @@ -175,7 +173,7 @@ public class SyncUtil { // ServiceEvent telling us the program has been suspended again fCommandControl.queueCommand( - new MIExecUntil(dmc, fileName + ":" + lineNo), //$NON-NLS-1$ + fCommandFactory.createMIExecUntil(dmc, fileName + ":" + lineNo), //$NON-NLS-1$ null); } }); @@ -232,7 +230,7 @@ public class SyncUtil { }; fCommandControl.queueCommand( - new MIBreakInsert(fBreakpointsDmc, temporary, false, null, 0, location, 0), + fCommandFactory.createMIBreakInsert(fBreakpointsDmc, temporary, false, null, 0, location, 0), addBreakDone); wait.waitUntilDone(timeout); @@ -257,7 +255,7 @@ public class SyncUtil { } }; - fCommandControl.queueCommand(new MIBreakList(fBreakpointsDmc), listDRM); + fCommandControl.queueCommand(fCommandFactory.createMIBreakList(fBreakpointsDmc), listDRM); wait.waitUntilDone(timeout); assertTrue(wait.getMessage(), wait.isOK()); @@ -291,7 +289,7 @@ public class SyncUtil { }; fCommandControl.queueCommand( - new MIBreakDelete(fBreakpointsDmc, breakpointIndices), //$NON-NLS-1$ + fCommandFactory.createMIBreakDelete(fBreakpointsDmc, breakpointIndices), //$NON-NLS-1$ deleteBreakDone); wait.waitUntilDone(timeout); @@ -310,7 +308,7 @@ public class SyncUtil { // No need for a RequestMonitor since we will wait for the // ServiceEvent telling us the program has been suspended again fCommandControl.queueCommand( - new MIExecContinue(dmc), + fCommandFactory.createMIExecContinue(dmc), null); } }); @@ -338,7 +336,7 @@ public class SyncUtil { // No need for a RequestMonitor since we will wait for the // ServiceEvent telling us the program has been resumed fCommandControl.queueCommand( - new MIExecContinue(dmc), + fCommandFactory.createMIExecContinue(dmc), null); } });