OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
12 * the License. | 12 * the License. |
13 */ | 13 */ |
14 package com.google.dart.tools.debug.core.configs; | 14 package com.google.dart.tools.debug.core.configs; |
15 | 15 |
16 import com.google.dart.tools.core.DartCore; | 16 import com.google.dart.tools.core.DartCore; |
17 import com.google.dart.tools.core.model.DartSdkManager; | 17 import com.google.dart.tools.core.model.DartSdkManager; |
18 import com.google.dart.tools.debug.core.DartDebugCorePlugin; | 18 import com.google.dart.tools.debug.core.DartDebugCorePlugin; |
19 import com.google.dart.tools.debug.core.DartLaunchConfigWrapper; | 19 import com.google.dart.tools.debug.core.DartLaunchConfigWrapper; |
20 import com.google.dart.tools.debug.core.server.ServerDebugTarget; | |
21 import com.google.dart.tools.debug.core.util.NetUtils; | 20 import com.google.dart.tools.debug.core.util.NetUtils; |
22 | 21 |
23 import org.eclipse.core.resources.IResource; | 22 import org.eclipse.core.resources.IResource; |
24 import org.eclipse.core.resources.ResourcesPlugin; | 23 import org.eclipse.core.resources.ResourcesPlugin; |
25 import org.eclipse.core.runtime.CoreException; | 24 import org.eclipse.core.runtime.CoreException; |
26 import org.eclipse.core.runtime.IProgressMonitor; | 25 import org.eclipse.core.runtime.IProgressMonitor; |
27 import org.eclipse.core.runtime.IStatus; | 26 import org.eclipse.core.runtime.IStatus; |
28 import org.eclipse.core.runtime.Path; | 27 import org.eclipse.core.runtime.Path; |
29 import org.eclipse.core.runtime.Status; | 28 import org.eclipse.core.runtime.Status; |
30 import org.eclipse.debug.core.DebugException; | 29 import org.eclipse.debug.core.DebugException; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 DartDebugCorePlugin.createErrorStatus("The executable path for the Dar
t VM has not been set.")); | 107 DartDebugCorePlugin.createErrorStatus("The executable path for the Dar
t VM has not been set.")); |
109 } | 108 } |
110 | 109 |
111 List<String> commandsList = new ArrayList<String>(); | 110 List<String> commandsList = new ArrayList<String>(); |
112 | 111 |
113 int connectionPort = NetUtils.findUnusedPort(DEFAULT_PORT_NUMBER); | 112 int connectionPort = NetUtils.findUnusedPort(DEFAULT_PORT_NUMBER); |
114 | 113 |
115 commandsList.add(vmExecPath); | 114 commandsList.add(vmExecPath); |
116 commandsList.addAll(Arrays.asList(launchConfig.getVmArgumentsAsArray())); | 115 commandsList.addAll(Arrays.asList(launchConfig.getVmArgumentsAsArray())); |
117 | 116 |
118 if (enableDebugging && !DartCore.isWindows()) { | 117 // BUG(5883) Debugging of standalone programs is disabled |
119 commandsList.add("--debug:" + connectionPort); | 118 // because it sometimes leads to program crashes. |
120 } | 119 // if (enableDebugging && !DartCore.isWindows()) { |
| 120 // commandsList.add("--debug:" + connectionPort); |
| 121 // } |
121 | 122 |
122 String packageRoot = DartCore.getPlugin().getPackageRootPref(); | 123 String packageRoot = DartCore.getPlugin().getPackageRootPref(); |
123 if (packageRoot != null) { | 124 if (packageRoot != null) { |
124 packageRoot = new Path(packageRoot).makeAbsolute().toOSString(); | 125 packageRoot = new Path(packageRoot).makeAbsolute().toOSString(); |
125 String fileSeparator = System.getProperty("file.separator"); | 126 String fileSeparator = System.getProperty("file.separator"); |
126 if (!packageRoot.endsWith(fileSeparator)) { | 127 if (!packageRoot.endsWith(fileSeparator)) { |
127 packageRoot += fileSeparator; | 128 packageRoot += fileSeparator; |
128 } | 129 } |
129 commandsList.add("--package-root=" + packageRoot); | 130 commandsList.add("--package-root=" + packageRoot); |
130 } | 131 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 if (runtimeProcess != null) { | 170 if (runtimeProcess != null) { |
170 runtimeProcess.destroy(); | 171 runtimeProcess.destroy(); |
171 } | 172 } |
172 | 173 |
173 throw new CoreException( | 174 throw new CoreException( |
174 DartDebugCorePlugin.createErrorStatus("Error starting Dart VM process"
)); | 175 DartDebugCorePlugin.createErrorStatus("Error starting Dart VM process"
)); |
175 } | 176 } |
176 | 177 |
177 eclipseProcess.setAttribute(IProcess.ATTR_CMDLINE, generateCommandLine(comma
nds)); | 178 eclipseProcess.setAttribute(IProcess.ATTR_CMDLINE, generateCommandLine(comma
nds)); |
178 | 179 |
179 if (enableDebugging && !DartCore.isWindows()) { | 180 // BUG(5883) Debugging of standalone programs is disabled |
180 ServerDebugTarget debugTarget = new ServerDebugTarget(launch, eclipseProce
ss, connectionPort); | 181 // because it sometimes leads to program crashes. |
181 | 182 // if (enableDebugging && !DartCore.isWindows()) { |
182 try { | 183 // ServerDebugTarget debugTarget = new ServerDebugTarget(launch, eclipsePro
cess, connectionPort); |
183 debugTarget.connect(); | 184 // |
184 | 185 // try { |
185 launch.addDebugTarget(debugTarget); | 186 // debugTarget.connect(); |
186 } catch (DebugException ex) { | 187 // |
187 // We don't throw an exception if the process died before we could conne
ct. | 188 // launch.addDebugTarget(debugTarget); |
188 if (!isProcessDead(runtimeProcess)) { | 189 // } catch (DebugException ex) { |
189 throw ex; | 190 // // We don't throw an exception if the process died before we could con
nect. |
190 } | 191 // if (!isProcessDead(runtimeProcess)) { |
191 } | 192 // throw ex; |
192 } | 193 // } |
| 194 // } |
| 195 // } |
193 | 196 |
194 monitor.done(); | 197 monitor.done(); |
195 } | 198 } |
196 | 199 |
197 private String describe(ProcessBuilder processBuilder) { | 200 private String describe(ProcessBuilder processBuilder) { |
198 StringBuilder builder = new StringBuilder(); | 201 StringBuilder builder = new StringBuilder(); |
199 | 202 |
200 for (String arg : processBuilder.command()) { | 203 for (String arg : processBuilder.command()) { |
201 // Showing the --debug option doesn't provide a lot of value. | 204 // Showing the --debug option doesn't provide a lot of value. |
202 if (arg.startsWith("--debug")) { | 205 if (arg.startsWith("--debug")) { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 return process.getOutputStream(); | 357 return process.getOutputStream(); |
355 } | 358 } |
356 | 359 |
357 @Override | 360 @Override |
358 public int waitFor() throws InterruptedException { | 361 public int waitFor() throws InterruptedException { |
359 return process.waitFor(); | 362 return process.waitFor(); |
360 } | 363 } |
361 }; | 364 }; |
362 } | 365 } |
363 } | 366 } |
OLD | NEW |