1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

[290896] Trace checks should be lightweight

This commit is contained in:
John Cortell 2009-09-30 13:06:41 +00:00
parent 1754ae59b2
commit 1596d56719
3 changed files with 11 additions and 5 deletions

View file

@ -583,7 +583,7 @@ public class MISession extends Observable {
*/
public synchronized void postCommand0(Command cmd, long timeout) throws MIException {
// TRACING: print the command;
if (MIPlugin.getDefault().isDebugging()) {
if (MIPlugin.DEBUG) {
MIPlugin.getDefault().debugLog(cmd.toString());
}

View file

@ -88,7 +88,7 @@ public class RxThread extends Thread {
String line;
while ((line = reader.readLine()) != null) {
// TRACING: print the output.
if (MIPlugin.getDefault().isDebugging()) {
if (MIPlugin.DEBUG) {
MIPlugin.getDefault().debugLog(line);
}

View file

@ -36,6 +36,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Status;
@ -69,6 +70,11 @@ public class MIPlugin extends Plugin {
private static final int INTERNAL_ERROR = 42;
/**
* Has tracing for this plug-in been turned on?
*/
public static final boolean DEBUG = "true".equals( //$NON-NLS-1$
Platform.getDebugOption("org.eclipse.cdt.debug.mi.core/debug")); //$NON-NLS-1$
/**
* The singleton command factory manager.
*/
@ -220,7 +226,7 @@ public class MIPlugin extends Plugin {
int launchTimeout = MIPlugin.getDefault().getPluginPreferences().getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT);
MIProcess pgdb = new MIProcessAdapter(args, launchTimeout, monitor);
if (MIPlugin.getDefault().isDebugging()) {
if (MIPlugin.DEBUG) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < args.length; ++i) {
sb.append(args[i]);
@ -287,7 +293,7 @@ public class MIPlugin extends Plugin {
int launchTimeout = MIPlugin.getDefault().getPluginPreferences().getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT);
MIProcess pgdb = new MIProcessAdapter(args, launchTimeout, monitor);
if (MIPlugin.getDefault().isDebugging()) {
if (MIPlugin.DEBUG) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < args.length; ++i) {
sb.append(args[i]);
@ -452,7 +458,7 @@ public class MIPlugin extends Plugin {
try {
pgdb = factory.createMIProcess(args, launchTimeout, monitor);
if (MIPlugin.getDefault().isDebugging()) {
if (MIPlugin.DEBUG) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < args.length; ++i) {
sb.append(args[i]);