diff options
author | Jonah Graham | 2016-03-13 19:18:34 +0000 |
---|---|---|
committer | Jonah Graham | 2016-03-13 19:18:34 +0000 |
commit | 6eb1e1da299e24a9a699c88fbe735a5db3bd3018 (patch) | |
tree | 6c9bdfcb1b8f140f09c78d89200c2558e908edfc | |
parent | 82e5a0e04629bb413608ef6757b53b94f3cb2bbf (diff) | |
download | org.eclipse.tcf-6eb1e1da299e24a9a699c88fbe735a5db3bd3018.tar.gz org.eclipse.tcf-6eb1e1da299e24a9a699c88fbe735a5db3bd3018.tar.xz org.eclipse.tcf-6eb1e1da299e24a9a699c88fbe735a5db3bd3018.zip |
Bug 489489: Adapt to API that is different in CDT 8 and 9
cleanupLaunch() was replaced by cleanupLaunch(ILaunch) in CDT 9,
while TCF wants to support 8 and 9 from single code base the behaviour
of cleanupLaunch has been copied to TEGdbAbstractLaunchDelegate.
This method is deprecated and intended to be removed once TCF no
longer supports CDT < 9.
Change-Id: Ia06e9a708d38fa049a7960d34d559210a8d048bd
Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java index 26c3ca162..dc8dcdd3b 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java @@ -405,12 +405,44 @@ public abstract class TEGdbAbstractLaunchDelegate extends GdbLaunchDelegate { throw new DebugException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), "Cannot attach to process", e)); //$NON-NLS-1$ } finally { if (!ok) { - cleanupLaunch(); + cleanupLaunchLocal(l); } } } /** + * @deprecated While waiting for TCF to drop support for CDT < 9.0 we need this method copied + * from CDT 9.0. Once support for old CDT is removed this should become simply + * super.cleanupLaunch(ILaunch). + */ + @Deprecated + protected void cleanupLaunchLocal(ILaunch launch) throws DebugException { + if (launch instanceof GdbLaunch) { + final GdbLaunch gdbLaunch = (GdbLaunch)launch; + Query<Object> launchShutdownQuery = new Query<Object>() { + @Override + protected void execute(DataRequestMonitor<Object> rm) { + gdbLaunch.shutdownSession(rm); + } + }; + + gdbLaunch.getSession().getExecutor().execute(launchShutdownQuery); + + // wait for the shutdown to finish. + // The Query.get() method is a synchronous call which blocks until the + // query completes. + try { + launchShutdownQuery.get(); + } catch (InterruptedException e) { + throw new DebugException( new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), DebugException.INTERNAL_ERROR, "InterruptedException while shutting down debugger launch " + launch, e)); //$NON-NLS-1$ + } catch (ExecutionException e) { + throw new DebugException(new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), DebugException.REQUEST_FAILED, "Error in shutting down debugger launch " + launch, e)); //$NON-NLS-1$ + } + } + + } + + /** * On Windows, if gdb was started as part of a batch script, the script does not exit silently * if it has been interrupted before. Therefore we listen for the completion of the -gdb-exit command * and terminate the backend by force if necessary. |