Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2018-11-02 17:05:20 +0000
committerEugene Tarassov2018-11-02 17:05:20 +0000
commitd368c18ad59c03702d8a5e1a8a1f4b3a73f22710 (patch)
treec6b8d52f111fa93fc1bf3ff365fd7e3ebf13a2e0
parentb311d3747992a543452dcad840e9010602f26a19 (diff)
downloadorg.eclipse.tcf-d368c18ad59c03702d8a5e1a8a1f4b3a73f22710.tar.gz
org.eclipse.tcf-d368c18ad59c03702d8a5e1a8a1f4b3a73f22710.tar.xz
org.eclipse.tcf-d368c18ad59c03702d8a5e1a8a1f4b3a73f22710.zip
TCF Debugger: check for CanTerminateAttached capability of the Processes service
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IProcessesV1.java2
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java44
2 files changed, 34 insertions, 12 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IProcessesV1.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IProcessesV1.java
index 33c36da99..82262aa23 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IProcessesV1.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IProcessesV1.java
@@ -110,7 +110,7 @@ public interface IProcessesV1 extends IProcesses {
* @param error The error description if the operation failed, <code>null</code> if succeeded.
* @param properties The global processes service or context specific capabilities.
*/
- public void doneGetCapabilities(IToken token, Exception error, Map<String, Object> properties);
+ public void doneGetCapabilities(IToken token, Exception error, Map<String,Object> properties);
}
/**
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java
index fd5dae2fb..642447383 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007-2018 Wind River Systems, Inc. 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
@@ -178,6 +178,8 @@ public class TCFLaunch extends Launch {
private String dprintf_stream_id;
+ private boolean can_terminate_attached = false;
+
private final IStreams.StreamsListener streams_listener = new IStreams.StreamsListener() {
public void created(String stream_type, String stream_id, String context_id) {
@@ -816,6 +818,23 @@ public class TCFLaunch extends Launch {
final Set<Integer> dont_stop = TCFLaunchDelegate.readSigSet(cfg.getAttribute(TCFLaunchDelegate.ATTR_SIGNALS_DONT_STOP, ""));
final Set<Integer> dont_pass = TCFLaunchDelegate.readSigSet(cfg.getAttribute(TCFLaunchDelegate.ATTR_SIGNALS_DONT_PASS, ""));
final IProcessesV1 ps_v1 = channel.getRemoteService(IProcessesV1.class);
+ if (ps_v1 != null) {
+ // Get processes service capabilities
+ new LaunchStep() {
+ @Override
+ void start() throws Exception {
+ ps_v1.getCapabilities(null, new IProcessesV1.DoneGetCapabilities() {
+ @Override
+ public void doneGetCapabilities(IToken token, Exception error, Map<String,Object> properties) {
+ can_terminate_attached = properties != null &&
+ properties.get("CanTerminateAttached") instanceof Boolean &&
+ ((Boolean)properties.get("CanTerminateAttached")).booleanValue();
+ done();
+ }
+ });
+ }
+ };
+ }
// Start the process
new LaunchStep() {
@Override
@@ -1239,16 +1258,19 @@ public class TCFLaunch extends Launch {
if (disconnecting) return;
disconnecting = true;
final Set<IToken> cmds = new HashSet<IToken>();
- for (ProcessContext ctx : attached_processes.values()) {
- cmds.add(ctx.terminate(new IProcesses.DoneCommand() {
- public void doneCommand(IToken token, Exception error) {
- cmds.remove(token);
- if (error != null) channel.terminate(error);
- else if (cmds.isEmpty()) channel.close();
- }
- }));
- }
if (channel.getState() == IChannel.STATE_OPEN) {
+ for (final ProcessContext ctx : attached_processes.values()) {
+ IProcesses.DoneCommand prs_done_cmd = new IProcesses.DoneCommand() {
+ public void doneCommand(IToken token, Exception error) {
+ cmds.remove(token);
+ if (!attached_processes.containsKey(ctx.getID())) error = null;
+ if (error != null) channel.terminate(error);
+ else if (cmds.isEmpty()) channel.close();
+ }
+ };
+ if (!can_terminate_attached) cmds.add(ctx.detach(prs_done_cmd));
+ cmds.add(ctx.terminate(prs_done_cmd));
+ }
IStreams streams = getService(IStreams.class);
IStreams.DoneDisconnect done_disconnect = new IStreams.DoneDisconnect() {
public void doneDisconnect(IToken token, Exception error) {
@@ -1370,7 +1392,7 @@ public class TCFLaunch extends Launch {
done(false);
return;
}
- if (!detached && process.isAttached()) {
+ if (!can_terminate_attached && !detached && process.isAttached()) {
process.detach(new IProcesses.DoneCommand() {
@Override
public void doneCommand(IToken token, Exception error) {

Back to the top