Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2015-03-12 09:43:12 -0400
committerAnton Leherbauer2015-03-12 09:43:12 -0400
commit7c020fe1d4f75d547cd27d617486a2b33911f38a (patch)
tree8a18428694e8911c60cda284991d71440d908511
parent62e3fd571366b7f78903d2baf6690a60a06b4946 (diff)
downloadorg.eclipse.tcf-7c020fe1d4f75d547cd27d617486a2b33911f38a.tar.gz
org.eclipse.tcf-7c020fe1d4f75d547cd27d617486a2b33911f38a.tar.xz
org.eclipse.tcf-7c020fe1d4f75d547cd27d617486a2b33911f38a.zip
Target Explorer: Fix termination of launch if target is offline
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbLaunchDelegate.java33
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java15
2 files changed, 24 insertions, 24 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbLaunchDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbLaunchDelegate.java
index 71d843de2..d6aced122 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbLaunchDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbLaunchDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 Mentor Graphics Corporation and others.
+ * Copyright (c) 2010, 2015 Mentor Graphics Corporation 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
@@ -84,23 +84,20 @@ public class TEGdbLaunchDelegate extends GdbLaunchDelegate {
monitor.setTaskName(Messages.RemoteRunLaunchDelegate_9);
final AtomicBoolean gdbServerStarted = new AtomicBoolean(false);
+ final AtomicBoolean gdbServerReady = new AtomicBoolean(false);
+ final AtomicBoolean gdbServerExited = new AtomicBoolean(false);
+ final StringBuffer gdbServerOutput = new StringBuffer();
+ final Object lock = new Object();
+
final GdbLaunch l = (GdbLaunch) launch;
final Callback callback = new Callback() {
@Override
protected void internalDone(Object caller, IStatus status) {
if (!status.isOK()) {
- // Need to shutdown the DSF launch session because it is
- // partially started already.
- try {
- l.getSession().getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- l.shutdownSession(new ImmediateRequestMonitor());
- }
- });
- }
- catch (RejectedExecutionException e) {
- // Session disposed.
+ gdbServerOutput.append(status.getMessage());
+ gdbServerExited.set(true);
+ synchronized (lock) {
+ lock.notifyAll();
}
} else {
gdbServerStarted.set(true);
@@ -109,16 +106,6 @@ public class TEGdbLaunchDelegate extends GdbLaunchDelegate {
}
};
- // We cannot use a global variable because multiple launches
- // could access them at the same time. We need a different
- // variable for each launch, but we also need it be final.
- // Use a final array to do that.
- final AtomicBoolean gdbServerReady = new AtomicBoolean(false);
- final AtomicBoolean gdbServerExited = new AtomicBoolean(false);
-
- final Object lock = new Object();
-
- final StringBuilder gdbServerOutput = new StringBuilder();
StreamsDataReceiver.Listener listener = new StreamsDataReceiver.Listener() {
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java
index a801ae356..cbe6d4a0f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/launcher/ProcessLauncher.java
@@ -36,8 +36,10 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.core.Command;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IChannel.IChannelListener;
+import org.eclipse.tcf.protocol.IErrorReport;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.protocol.Protocol;
@@ -57,6 +59,7 @@ import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.utils.StatusHelper;
import org.eclipse.tcf.te.tcf.core.Tcf;
import org.eclipse.tcf.te.tcf.core.async.CallbackInvocationDelegate;
+import org.eclipse.tcf.te.tcf.core.channelmanager.OpenChannelException;
import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager;
import org.eclipse.tcf.te.tcf.core.streams.StreamsDataProvider;
import org.eclipse.tcf.te.tcf.core.streams.StreamsDataReceiver;
@@ -393,8 +396,18 @@ public class ProcessLauncher extends PlatformObject implements IProcessLauncher
onChannelOpenDone(peer);
} else {
+ String detail = error.getLocalizedMessage();
+ if (detail == null && error instanceof OpenChannelException) {
+ Throwable inner = ((OpenChannelException) error).getError();
+ if (inner instanceof IErrorReport)
+ detail = Command.toErrorString(((IErrorReport)inner).getAttributes());
+ else
+ detail = inner.getLocalizedMessage();
+ }
+ if (detail == null)
+ detail = "N/A"; //$NON-NLS-1$
IStatus status = new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(),
- NLS.bind(Messages.ProcessLauncher_error_channelConnectFailed, peer.getID(), error.getLocalizedMessage()),
+ NLS.bind(Messages.ProcessLauncher_error_channelConnectFailed, peer.getName(), detail),
error);
invokeCallback(status, null);
}

Back to the top