diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF index 73872b5105b..899bf61de84 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true -Bundle-Version: 5.0.0.qualifier +Bundle-Version: 5.1.0.qualifier Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/pom.xml b/dsf-gdb/org.eclipse.cdt.dsf.gdb/pom.xml index 9933f6d7bc1..ca205eed581 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/pom.xml +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/pom.xml @@ -11,7 +11,7 @@ ../../pom.xml - 5.0.0-SNAPSHOT + 5.1.0-SNAPSHOT org.eclipse.cdt.dsf.gdb eclipse-plugin 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 3f0ac45f7a0..51d414b572a 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 @@ -505,53 +505,73 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { @Override protected void initialize(final RequestMonitor requestMonitor) { - InputStream errorStream = null; - if (fMIBackend instanceof IMIBackend2) { - errorStream = ((IMIBackend2)fMIBackend).getMIErrorStream(); - } - startCommandProcessing(fMIBackend.getMIInputStream(), fMIBackend.getMIOutputStream(), errorStream); - requestMonitor.done(); + doCommandMonitoringStep(requestMonitor); } @Override protected void shutdown(RequestMonitor requestMonitor) { - stopCommandProcessing(); - requestMonitor.done(); + undoCommandMonitoringStep(requestMonitor); } } + /** @since 5.1 */ + protected void doCommandMonitoringStep(final RequestMonitor requestMonitor) { + InputStream errorStream = null; + if (fMIBackend instanceof IMIBackend2) { + errorStream = ((IMIBackend2)fMIBackend).getMIErrorStream(); + } + startCommandProcessing(fMIBackend.getMIInputStream(), fMIBackend.getMIOutputStream(), errorStream); + requestMonitor.done(); + } + + /** @since 5.1 */ + protected void undoCommandMonitoringStep(RequestMonitor requestMonitor) { + stopCommandProcessing(); + requestMonitor.done(); + } + protected class CommandProcessorsStep extends InitializationShutdownStep { CommandProcessorsStep(Direction direction) { super(direction); } @Override public void initialize(final RequestMonitor requestMonitor) { - try { - fCLIProcess = new GDBBackendCLIProcess(GDBControl.this, fMIBackend); - } - catch(IOException e) { - requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Failed to create CLI Process", e)); //$NON-NLS-1$ - requestMonitor.done(); - return; - } - - fCLICommandProcessor = createCLIEventProcessor(GDBControl.this, getContext()); - fMIEventProcessor = createMIRunControlEventProcessor(GDBControl.this, getContext()); - fControlEventProcessor = createControlEventProcessor(); - - requestMonitor.done(); + doCommandProcessorsStep(requestMonitor); } - + @Override protected void shutdown(RequestMonitor requestMonitor) { - fControlEventProcessor.dispose(); - fCLICommandProcessor.dispose(); - fMIEventProcessor.dispose(); - fCLIProcess.dispose(); - - requestMonitor.done(); + undoCommandProcessorsStep(requestMonitor); } } + /** @since 5.1 */ + protected void doCommandProcessorsStep(final RequestMonitor requestMonitor) { + try { + fCLIProcess = new GDBBackendCLIProcess(GDBControl.this, fMIBackend); + } + catch(IOException e) { + requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "Failed to create CLI Process", e)); //$NON-NLS-1$ + requestMonitor.done(); + return; + } + + fCLICommandProcessor = createCLIEventProcessor(GDBControl.this, getContext()); + fMIEventProcessor = createMIRunControlEventProcessor(GDBControl.this, getContext()); + fControlEventProcessor = createControlEventProcessor(); + + requestMonitor.done(); + } + + /** @since 5.1 */ + protected void undoCommandProcessorsStep(RequestMonitor requestMonitor) { + fControlEventProcessor.dispose(); + fCLICommandProcessor.dispose(); + fMIEventProcessor.dispose(); + fCLIProcess.dispose(); + + requestMonitor.done(); + } + /** * @since 4.1 */ @@ -562,47 +582,67 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { @Override public void initialize( final RequestMonitor requestMonitor ) { - fCommandTimeoutManager = createCommandTimeoutManager( GDBControl.this ); - if (fCommandTimeoutManager != null) { - fCommandTimeoutManager.addCommandTimeoutListener(fTimeoutListener); - } - requestMonitor.done(); + doCommandTimeoutStep(requestMonitor); } @Override protected void shutdown( RequestMonitor requestMonitor ) { - if ( fCommandTimeoutManager != null ) { - fCommandTimeoutManager.removeCommandTimeoutListener(fTimeoutListener); - fCommandTimeoutManager.dispose(); - } - requestMonitor.done(); + undoCommandTimeoutStep(requestMonitor); } } + /** @since 5.1 */ + protected void doCommandTimeoutStep(final RequestMonitor requestMonitor) { + fCommandTimeoutManager = createCommandTimeoutManager( GDBControl.this ); + if (fCommandTimeoutManager != null) { + fCommandTimeoutManager.addCommandTimeoutListener(fTimeoutListener); + } + requestMonitor.done(); + } + + /** @since 5.1 */ + protected void undoCommandTimeoutStep(RequestMonitor requestMonitor) { + if ( fCommandTimeoutManager != null ) { + fCommandTimeoutManager.removeCommandTimeoutListener(fTimeoutListener); + fCommandTimeoutManager.dispose(); + } + requestMonitor.done(); + } + protected class RegisterStep extends InitializationShutdownStep { RegisterStep(Direction direction) { super(direction); } @Override public void initialize(final RequestMonitor requestMonitor) { - getSession().addServiceEventListener(GDBControl.this, null); - register( - new String[]{ ICommandControl.class.getName(), - ICommandControlService.class.getName(), - IMICommandControl.class.getName(), - AbstractMIControl.class.getName(), - IGDBControl.class.getName() }, - new Hashtable()); - getSession().dispatchEvent(new GDBControlInitializedDMEvent(getContext()), getProperties()); - requestMonitor.done(); + doRegisterStep(requestMonitor); } @Override protected void shutdown(RequestMonitor requestMonitor) { - unregister(); - getSession().removeServiceEventListener(GDBControl.this); - requestMonitor.done(); + undoRegisterStep(requestMonitor); } } + /** @since 5.1 */ + protected void doRegisterStep(final RequestMonitor requestMonitor) { + getSession().addServiceEventListener(GDBControl.this, null); + register( + new String[]{ ICommandControl.class.getName(), + ICommandControlService.class.getName(), + IMICommandControl.class.getName(), + AbstractMIControl.class.getName(), + IGDBControl.class.getName() }, + new Hashtable()); + getSession().dispatchEvent(new GDBControlInitializedDMEvent(getContext()), getProperties()); + requestMonitor.done(); + } + + /** @since 5.1 */ + protected void undoRegisterStep(RequestMonitor requestMonitor) { + unregister(); + getSession().removeServiceEventListener(GDBControl.this); + requestMonitor.done(); + } + /** @since 4.0 */ @Override public List getFeatures() { 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 29c92149964..960e3c4afb2 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 @@ -91,7 +91,8 @@ public class GDBControl_7_0 extends GDBControl { return new MIRunControlEventProcessor_7_0(connection, controlDmc); } - private void listFeatures(final RequestMonitor requestMonitor) { + /** @since 5.1 */ + protected void doListFeatures(final RequestMonitor requestMonitor) { queueCommand( getCommandFactory().createMIListFeatures(getContext()), new DataRequestMonitor(getExecutor(), requestMonitor) { @@ -103,6 +104,11 @@ public class GDBControl_7_0 extends GDBControl { }); } + /** @since 5.1 */ + protected void undoListFeatures(RequestMonitor requestMonitor) { + requestMonitor.done(); + } + @Override protected Sequence getCompleteInitializationSequence(Map attributes, RequestMonitorWithProgress rm) { return new FinalLaunchSequence_7_0(getSession(), attributes, rm); @@ -130,12 +136,12 @@ public class GDBControl_7_0 extends GDBControl { @Override protected void initialize(final RequestMonitor requestMonitor) { - listFeatures(requestMonitor); + doListFeatures(requestMonitor); } @Override protected void shutdown(RequestMonitor requestMonitor) { - requestMonitor.done(); + undoListFeatures(requestMonitor); } }