diff options
author | Uwe Stieber | 2016-03-14 07:00:21 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-03-14 07:00:21 +0000 |
commit | b01e6f17640af1dd44a466f81e13957af2550f4d (patch) | |
tree | f8318d556dfe7b80daffbdd02cc1c961ccda0efa | |
parent | a3513a106e5c0f180108adedad89eda150a6f3bb (diff) | |
parent | 6eb1e1da299e24a9a699c88fbe735a5db3bd3018 (diff) | |
download | org.eclipse.tcf-b01e6f17640af1dd44a466f81e13957af2550f4d.tar.gz org.eclipse.tcf-b01e6f17640af1dd44a466f81e13957af2550f4d.tar.xz org.eclipse.tcf-b01e6f17640af1dd44a466f81e13957af2550f4d.zip |
Merge "Bug 489489: Adapt to API that is different in CDT 8 and 9"
-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. |