diff options
author | Eugene Tarassov | 2016-04-02 19:33:16 +0000 |
---|---|---|
committer | Eugene Tarassov | 2016-04-02 19:33:16 +0000 |
commit | 3d77e375e2cb90e661e58273dbff16f1591d2dcd (patch) | |
tree | 07c8adaf857487a04b18b8c5929f7ac17ebd4cbe /plugins/org.eclipse.tcf.core | |
parent | 07bfe246b3c83dfe415c750390caf0a7fb0def37 (diff) | |
download | org.eclipse.tcf-3d77e375e2cb90e661e58273dbff16f1591d2dcd.tar.gz org.eclipse.tcf-3d77e375e2cb90e661e58273dbff16f1591d2dcd.tar.xz org.eclipse.tcf-3d77e375e2cb90e661e58273dbff16f1591d2dcd.zip |
Bug 490874 - Eclipse can't handle signals > 31
Diffstat (limited to 'plugins/org.eclipse.tcf.core')
-rw-r--r-- | plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ProcessesProxy.java | 54 | ||||
-rw-r--r-- | plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IProcesses.java | 45 |
2 files changed, 97 insertions, 2 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ProcessesProxy.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ProcessesProxy.java index ab4c7ab2c..76607936d 100644 --- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ProcessesProxy.java +++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ProcessesProxy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2016 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 @@ -13,7 +13,9 @@ package org.eclipse.tcf.internal.services.remote; import java.io.IOException; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import org.eclipse.tcf.core.Command; import org.eclipse.tcf.protocol.IChannel; @@ -249,6 +251,26 @@ public class ProcessesProxy implements IProcesses { }.token; } + public IToken getSignalMask(String context_id, final DoneGetSignalMaskSets done) { + return new Command(channel, ProcessesProxy.this, + "getSignalMask", new Object[]{ context_id }) { + @Override + public void done(Exception error, Object[] args) { + Set<Integer> dont_stop = null; + Set<Integer> dont_pass = null; + Set<Integer> pending = null; + if (error == null) { + assert args.length == 4; + error = toError(args[0]); + dont_stop = toSigSet(args[1]); + dont_pass = toSigSet(args[2]); + pending = toSigSet(args[3]); + } + done.doneGetSignalMask(token, error, dont_stop, dont_pass, pending); + } + }.token; + } + public IToken setSignalMask(String context_id, int dont_stop, int dont_pass, final DoneCommand done) { return new Command(channel, ProcessesProxy.this, "setSignalMask", new Object[]{ context_id, dont_stop, dont_pass }) { @@ -263,6 +285,20 @@ public class ProcessesProxy implements IProcesses { }.token; } + public IToken setSignalMask(String context_id, Set<Integer> dont_stop, Set<Integer> dont_pass, final DoneCommand done) { + return new Command(channel, ProcessesProxy.this, + "setSignalMask", new Object[]{ context_id, dont_stop, dont_pass }) { + @Override + public void done(Exception error, Object[] args) { + if (error == null) { + assert args.length == 1; + error = toError(args[0]); + } + done.doneCommand(token, error); + } + }.token; + } + public IToken signal(String context_id, long signal, final DoneCommand done) { return new Command(channel, ProcessesProxy.this, "signal", new Object[]{ context_id, signal }) { @@ -312,4 +348,20 @@ public class ProcessesProxy implements IProcesses { if (o == null) return null; return (Collection<Map<String,Object>>)o; } + + @SuppressWarnings("unchecked") + private static Set<Integer> toSigSet(Object o) { + Set<Integer> set = new HashSet<Integer>(); + if (o instanceof Number) { + long n = ((Number)o).longValue(); + for (int i = 0; i < 64; i++) { + if ((n & (1l << i)) != 0) set.add(i); + } + } + else if (o != null) { + Collection<Number> c = (Collection<Number>)o; + for (Number n : c) set.add(n.intValue()); + } + return set; + } } diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IProcesses.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IProcesses.java index 87c4cd0bc..d096c865f 100644 --- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IProcesses.java +++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IProcesses.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 Wind River Systems, Inc. and others. + * Copyright (c) 2007, 2016 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 @@ -12,6 +12,7 @@ package org.eclipse.tcf.services; import java.util.Collection; import java.util.Map; +import java.util.Set; import org.eclipse.tcf.protocol.IService; import org.eclipse.tcf.protocol.IToken; @@ -221,11 +222,13 @@ public interface IProcesses extends IService { * If context is not attached the command will return an error. * @param done - call back interface called when operation is completed. * @return pending command handle, can be used to cancel the command. + * TODO: deprecated - cannot support more than 32 signals */ IToken getSignalMask(String context_id, DoneGetSignalMask done); /** * Call-back interface to be called when "getSignalMask" command is complete. + * TODO: deprecated - cannot support more than 32 signals */ interface DoneGetSignalMask { /** @@ -239,6 +242,32 @@ public interface IProcesses extends IService { } /** + * Get process or thread signal mask. + * Signal indices in the mask control how signals should be handled by debug agent. + * When new context is created it inherits the mask from its parent. + * If context is not attached the command will return an error. + * @param done - call back interface called when operation is completed. + * @return pending command handle, can be used to cancel the command. + * @since 1.4 + */ + IToken getSignalMask(String context_id, DoneGetSignalMaskSets done); + + /** + * Call-back interface to be called when "getSignalMask" command is complete. + * @since 1.4 + */ + interface DoneGetSignalMaskSets { + /** + * @param token - command handle. + * @param dont_stop - set of signals that should suspend execution of the context. + * @param dont_pass - set of signals that should not be delivered to the context. + * @param pending - set of signals that are generated but not delivered yet. + * Note: "pending" is meaningful only if the context is suspended. + */ + void doneGetSignalMask(IToken token, Exception error, Set<Integer> dont_stop, Set<Integer> dont_pass, Set<Integer> pending); + } + + /** * Set process or thread signal mask. * Bits in the mask control how signals should be handled by debug agent. * If context is not attached the command will return an error. @@ -247,10 +276,24 @@ public interface IProcesses extends IService { * @param dont_pass - bit-set of signals that should not be delivered to the context. * @param done - call back interface called when operation is completed. * @return pending command handle, can be used to cancel the command. + * TODO: deprecated - cannot support more than 32 signals */ IToken setSignalMask(String context_id, int dont_stop, int dont_pass, DoneCommand done); /** + * Set process or thread signal mask. + * Signal indices in the mask control how signals should be handled by debug agent. + * If context is not attached the command will return an error. + * @param dont_stop - set of signals that should not suspend execution of the context. + * By default, debugger suspends a context before it receives a signal. + * @param dont_pass - set of signals that should not be delivered to the context. + * @param done - call back interface called when operation is completed. + * @return pending command handle, can be used to cancel the command. + * @since 1.4 + */ + IToken setSignalMask(String context_id, Set<Integer> dont_stop, Set<Integer> dont_pass, DoneCommand done); + + /** * Send a signal to a process or thread. * @param context_id - context ID. * @param signal - signal code. |