|
21 | 21 | import org.eclipse.core.runtime.FileLocator;
|
22 | 22 | import org.eclipse.core.runtime.Path;
|
23 | 23 | import org.eclipse.core.runtime.Platform;
|
| 24 | +import org.eclipse.core.runtime.Status; |
24 | 25 | import org.eclipse.linuxtools.oprofile.core.IOpcontrolProvider;
|
25 | 26 | import org.eclipse.linuxtools.oprofile.core.OpcontrolException;
|
26 | 27 | import org.eclipse.linuxtools.oprofile.core.Oprofile;
|
27 | 28 | import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
|
| 29 | +import org.eclipse.linuxtools.oprofile.core.OprofileProperties; |
28 | 30 | import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
|
29 | 31 | import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonOptions;
|
30 | 32 | import org.eclipse.linuxtools.oprofile.core.opxml.sessions.SessionManager;
|
@@ -284,25 +286,42 @@ private boolean _runOpcontrol(ArrayList<String> args) throws OpcontrolException
|
284 | 286 | stdout.close();
|
285 | 287 | errout.close();
|
286 | 288 |
|
287 |
| - // give some hints which may be helpful for discovering the real |
288 |
| - // reason of weird problems. |
289 |
| - if (OprofileCorePlugin.isDebugMode()) { |
| 289 | + int ret = p.waitFor(); |
| 290 | + if (ret != 0) { |
| 291 | + // give some hints which may be helpful for discovering the real |
| 292 | + // reason of weird problems. |
| 293 | + boolean extraInfo = false; |
| 294 | + |
290 | 295 | if (!errOutput.equals("")) { //$NON-NLS-1$
|
291 |
| - System.err.println(OprofileCorePlugin.DEBUG_PRINT_PREFIX + errOutput); |
| 296 | + extraInfo = true; |
| 297 | + OprofileCorePlugin |
| 298 | + .log(Status.ERROR, |
| 299 | + OprofileProperties |
| 300 | + .getString("opcontrol.error.log.stderr") + ": " + errOutput); //$NON-NLS-1$ |
292 | 301 | }
|
293 | 302 | if (!output.equals("")) { //$NON-NLS-1$
|
294 |
| - System.out.println(OprofileCorePlugin.DEBUG_PRINT_PREFIX + output); |
| 303 | + extraInfo = true; |
| 304 | + OprofileCorePlugin |
| 305 | + .log(Status.ERROR, // log as error, since stderr output might be masked as stdout |
| 306 | + OprofileProperties |
| 307 | + .getString("opcontrol.error.log.stdout") + ": " + output); //$NON-NLS-1$ |
295 | 308 | }
|
296 |
| - } |
297 |
| - |
298 |
| - int ret = p.waitFor(); |
299 |
| - if (ret != 0) { |
| 309 | + |
300 | 310 | // Red Hat BZ #694631: NMI Watchdog problem.
|
301 | 311 | // Give better advice as to what the problem might be.
|
302 | 312 | if (output.contains("nmi_watchdog") && output.startsWith("Error:")) { //$NON-NLS-1$ $NON-NLS-2$
|
303 |
| - throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolNmiWatchdog", null)); //$NON-NLS-1$ |
| 313 | + throw new OpcontrolException( |
| 314 | + OprofileCorePlugin.createErrorStatus( |
| 315 | + "opcontrolNmiWatchdog", null)); //$NON-NLS-1$ |
| 316 | + } else if (extraInfo) { |
| 317 | + throw new OpcontrolException( |
| 318 | + OprofileCorePlugin |
| 319 | + .createErrorStatus( |
| 320 | + "opcontrolNonZeroExitCodeExtraInfo", null)); //$NON-NLS-1$ |
304 | 321 | } else {
|
305 |
| - throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolNonZeroExitCode", null)); //$NON-NLS-1$ |
| 322 | + throw new OpcontrolException( |
| 323 | + OprofileCorePlugin.createErrorStatus( |
| 324 | + "opcontrolNonZeroExitCode", null)); //$NON-NLS-1$ |
306 | 325 | }
|
307 | 326 | }
|
308 | 327 |
|
|
0 commit comments