From 52be905ca022b1a6a3998b3bcae52d4e641e9d8a Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sun, 27 Jul 2008 19:12:00 +0000 Subject: [PATCH] Bug 241985 --- .../launching/ServicesLaunchSequence.java | 9 +- .../service/GdbDebugServicesFactory.java | 84 +++++++++++-------- .../service/command/GDBControl.java | 18 +++- 3 files changed, 71 insertions(+), 40 deletions(-) diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/ServicesLaunchSequence.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/ServicesLaunchSequence.java index 622b1ebf04c..e0fa84e73ae 100644 --- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/ServicesLaunchSequence.java +++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/ServicesLaunchSequence.java @@ -40,8 +40,13 @@ public class ServicesLaunchSequence extends Sequence { // // Create the connection. // - fCommandControl = new GDBControl(fSession, LaunchUtils.getGDBPath(fLaunch.getLaunchConfiguration()), - fExecPath, fSessionType, fAttach, 30); + fCommandControl = fLaunch.getServiceFactory().createService(fSession, GDBControl.class); + + fCommandControl.setAttach(fAttach); + fCommandControl.setExecPath(fExecPath); + fCommandControl.setGdbPath(LaunchUtils.getGDBPath(fLaunch.getLaunchConfiguration())); + fCommandControl.setSessionType(fSessionType); + fCommandControl.initialize(requestMonitor); } }, diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GdbDebugServicesFactory.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GdbDebugServicesFactory.java index 6781f481573..1491ec861e6 100644 --- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GdbDebugServicesFactory.java +++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GdbDebugServicesFactory.java @@ -22,7 +22,9 @@ import org.eclipse.dd.dsf.debug.service.IRegisters; import org.eclipse.dd.dsf.debug.service.IRunControl; import org.eclipse.dd.dsf.debug.service.ISourceLookup; import org.eclipse.dd.dsf.debug.service.IStack; +import org.eclipse.dd.dsf.debug.service.command.ICommandControl; import org.eclipse.dd.dsf.service.DsfSession; +import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl; import org.eclipse.dd.mi.service.CSourceLookup; import org.eclipse.dd.mi.service.ExpressionService; import org.eclipse.dd.mi.service.MIBreakpoints; @@ -35,10 +37,14 @@ import org.eclipse.dd.mi.service.MIStack; public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory { + private final String fVersion; + public GdbDebugServicesFactory(String version) { + fVersion = version; } - + public String getVersion() { return fVersion; } + @Override @SuppressWarnings("unchecked") public V createService(DsfSession session, Class clazz) { @@ -49,58 +55,62 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory { return super.createService(session, clazz); } - @Override - protected IDisassembly createDisassemblyService(DsfSession session) { - return new MIDisassembly(session); + protected MIBreakpointsManager createBreakpointManagerService(DsfSession session) { + return new MIBreakpointsManager(session, CDebugCorePlugin.PLUGIN_ID); } - - @Override - protected IRegisters createRegistersService(DsfSession session) { - return new MIRegisters(session); - } - + @Override protected IBreakpoints createBreakpointService(DsfSession session) { return new MIBreakpoints(session); } @Override - protected ISourceLookup createSourceLookupService(DsfSession session) { - return new CSourceLookup(session); + protected ICommandControl createCommandControl(DsfSession session) { + return new GDBControl(session); + } + + @Override + protected IDisassembly createDisassemblyService(DsfSession session) { + return new MIDisassembly(session); } @Override protected IExpressions createExpressionService(DsfSession session) { return new ExpressionService(session); } + + @Override + protected IMemory createMemoryService(DsfSession session) { + return new MIMemory(session); + } + + @Override + protected IModules createModulesService(DsfSession session) { + return new MIModules(session); + } + + @Override + protected IProcesses createProcessesService(DsfSession session) { + return new GDBProcesses(session); + } + + @Override + protected IRegisters createRegistersService(DsfSession session) { + return new MIRegisters(session); + } + + @Override + protected IRunControl createRunControlService(DsfSession session) { + return new GDBRunControl(session); + } + + @Override + protected ISourceLookup createSourceLookupService(DsfSession session) { + return new CSourceLookup(session); + } @Override protected IStack createStackService(DsfSession session) { return new MIStack(session); } - - @Override - protected IModules createModulesService(DsfSession session) { - return new MIModules(session); - } - - @Override - protected IMemory createMemoryService(DsfSession session) { - return new MIMemory(session); - } - - @Override - protected IRunControl createRunControlService(DsfSession session) { - return new GDBRunControl(session); - } - - @Override - protected IProcesses createProcessesService(DsfSession session) { - return new GDBProcesses(session); - } - - protected MIBreakpointsManager createBreakpointManagerService(DsfSession session) { - return new MIBreakpointsManager(session, CDebugCorePlugin.PLUGIN_ID); - } - } diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/command/GDBControl.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/command/GDBControl.java index e058dbebf7b..376a987bcbc 100644 --- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/command/GDBControl.java +++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/command/GDBControl.java @@ -103,7 +103,7 @@ public class GDBControl extends AbstractMIControl { private IPath fExecPath; private Process fProcess; private int fGDBExitValue; - final private int fGDBLaunchTimeout; + private int fGDBLaunchTimeout = 30; private MIRunControlEventProcessor fMIEventProcessor; private CLIEventProcessor fCLICommandProcessor; @@ -112,6 +112,22 @@ public class GDBControl extends AbstractMIControl { private PTY fPty; + public GDBControl(DsfSession session) { + super(session); + fControlDmc = new GDBControlDMContext(session.getId(), "gdbcontrol[" + ++fgInstanceCounter + "]"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + public void setGdbPath(IPath path) { fGdbPath = path; } + + public void setExecPath(IPath path) { fExecPath = path; } + + public void setSessionType(SessionType type) { fSessionType = type; } + + public void setAttach(boolean attach) { fAttach = attach; } + + public void setLaunchTimeout(int timeout) { fGDBLaunchTimeout = timeout; } + + @Deprecated public GDBControl(DsfSession session, IPath gdbPath, IPath execPath, SessionType sessionType, boolean attach, int gdbLaunchTimeout) { super(session); fSessionType = sessionType;