Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2016-04-02 19:33:16 +0000
committerEugene Tarassov2016-04-02 19:33:16 +0000
commit3d77e375e2cb90e661e58273dbff16f1591d2dcd (patch)
tree07c8adaf857487a04b18b8c5929f7ac17ebd4cbe /plugins/org.eclipse.tcf.debug
parent07bfe246b3c83dfe415c750390caf0a7fb0def37 (diff)
downloadorg.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.debug')
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java47
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java16
2 files changed, 54 insertions, 9 deletions
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java
index ec4da2bb4..70df6dad2 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java
@@ -14,8 +14,10 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -339,6 +341,51 @@ public class TCFLaunchDelegate extends LaunchConfigurationDelegate {
return program_path.toOSString();
}
+ /**
+ * Utility function for parsing ATTR_SIGNALS_DONT_STOP and ATTR_SIGNALS_DONT_PASS
+ */
+ public static Set<Integer> readSigSet(String s) {
+ Set<Integer> set = new HashSet<Integer>();
+ int l = s.length();
+ int i = 0;
+ while (i < l && s.charAt(i) == ' ') i++;
+ if (i < l && s.charAt(i) == '[') {
+ for (;;) {
+ i++;
+ int n = 0;
+ while (i < l && s.charAt(i) == ' ') i++;
+ if (i >= l || s.charAt(i) < '0' || s.charAt(i) > '9') break;
+ while (i < l && s.charAt(i) >= '0' && s.charAt(i) <= '9') {
+ n = n * 10 + (s.charAt(i++) - '0');
+ }
+ set.add(n);
+ while (i < l && s.charAt(i) == ' ') i++;
+ if (i >= l || s.charAt(i) != ',') break;
+ }
+ }
+ else if (i < l) {
+ int n = Integer.parseInt(s, 16);
+ for (int m = 0; m < 31; m++) {
+ if ((n & (1 << m)) != 0) set.add(m);
+ }
+ }
+ return set;
+ }
+
+ /**
+ * Utility function for setting ATTR_SIGNALS_DONT_STOP and ATTR_SIGNALS_DONT_PASS
+ */
+ public static String writeSigSet(Set<Integer> s) {
+ StringBuffer buf = new StringBuffer();
+ buf.append('[');
+ for (int n : s) {
+ if (buf.length() > 1) buf.append(',');
+ buf.append(n);
+ }
+ buf.append(']');
+ return buf.toString();
+ }
+
@Override
protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
ITCFLaunchProjectBuilder builder = TCFLaunchProjectBuilder.getLaunchProjectBuilder(configuration);
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 4c833776d..fd5dae2fb 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
@@ -813,10 +813,8 @@ public class TCFLaunch extends Launch {
final boolean stop_at_entry = cfg.getAttribute(TCFLaunchDelegate.ATTR_STOP_AT_ENTRY, true);
final boolean stop_at_main = cfg.getAttribute(TCFLaunchDelegate.ATTR_STOP_AT_MAIN, true);
final boolean use_terminal = cfg.getAttribute(TCFLaunchDelegate.ATTR_USE_TERMINAL, true);
- final String dont_stop = cfg.getAttribute(TCFLaunchDelegate.ATTR_SIGNALS_DONT_STOP, "");
- final String dont_pass = cfg.getAttribute(TCFLaunchDelegate.ATTR_SIGNALS_DONT_PASS, "");
- final int no_stop = dont_stop.length() > 0 ? Integer.parseInt(dont_stop, 16) : 0;
- final int no_pass = dont_pass.length() > 0 ? Integer.parseInt(dont_pass, 16) : 0;
+ 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);
// Start the process
new LaunchStep() {
@@ -868,8 +866,8 @@ public class TCFLaunch extends Launch {
params.put(IProcessesV1.START_ATTACH_CHILDREN, attach_children);
params.put(IProcessesV1.START_STOP_AT_ENTRY, stop_at_entry);
params.put(IProcessesV1.START_STOP_AT_MAIN, stop_at_main);
- if (dont_stop.length() > 0) params.put(IProcessesV1.START_SIG_DONT_STOP, no_stop);
- if (dont_pass.length() > 0) params.put(IProcessesV1.START_SIG_DONT_PASS, no_pass);
+ if (dont_stop.size() > 0) params.put(IProcessesV1.START_SIG_DONT_STOP, dont_stop);
+ if (dont_pass.size() > 0) params.put(IProcessesV1.START_SIG_DONT_PASS, dont_pass);
}
if (use_terminal) params.put(IProcessesV1.START_USE_TERMINAL, true);
ps_v1.start(dir, file, args_arr, process_env, params, done);
@@ -897,7 +895,7 @@ public class TCFLaunch extends Launch {
}
};
// Set process signal masks
- if (ps_v1 == null && (no_stop != 0 || no_pass != 0)) {
+ if (ps_v1 == null && (dont_stop.size() > 0 || dont_pass.size() > 0)) {
new LaunchStep() {
@Override
void start() {
@@ -909,14 +907,14 @@ public class TCFLaunch extends Launch {
else if (cmds.size() == 0) done();
}
};
- cmds.add(ps.setSignalMask(process.getID(), no_stop, no_pass, done_set_mask));
+ cmds.add(ps.setSignalMask(process.getID(), dont_stop, dont_pass, done_set_mask));
final IRunControl rc = channel.getRemoteService(IRunControl.class);
if (rc != null) {
final IRunControl.DoneGetChildren done_get_children = new IRunControl.DoneGetChildren() {
public void doneGetChildren(IToken token, Exception error, String[] context_ids) {
if (context_ids != null) {
for (String id : context_ids) {
- cmds.add(ps.setSignalMask(id, no_stop, no_pass, done_set_mask));
+ cmds.add(ps.setSignalMask(id, dont_stop, dont_pass, done_set_mask));
cmds.add(rc.getChildren(id, this));
}
}

Back to the top