diff --git a/java/debugger/debugger-agent-storage/src/com/intellij/rt/debugger/agent/CaptureStorage.java b/java/debugger/debugger-agent-storage/src/com/intellij/rt/debugger/agent/CaptureStorage.java index 88ce127ec197..612ecd578217 100644 --- a/java/debugger/debugger-agent-storage/src/com/intellij/rt/debugger/agent/CaptureStorage.java +++ b/java/debugger/debugger-agent-storage/src/com/intellij/rt/debugger/agent/CaptureStorage.java @@ -26,9 +26,13 @@ public class CaptureStorage { private static final JavaLangAccess ourJavaLangAccess = SharedSecrets.getJavaLangAccess(); private static boolean DEBUG = false; + private static boolean ENABLED = true; @SuppressWarnings("unused") public static void capture(Object key) { + if (!ENABLED) { + return; + } if (DEBUG) { System.out.println("capture - " + key); } @@ -50,6 +54,9 @@ public class CaptureStorage { @SuppressWarnings("unused") public static void insertEnter(Object key) { + if (!ENABLED) { + return; + } CapturedStack stack = STORAGE.get(key); Deque currentStacks = CURRENT_STACKS.get(); if (stack != null) { @@ -68,6 +75,9 @@ public class CaptureStorage { @SuppressWarnings("unused") public static void insertExit(Object key) { + if (!ENABLED) { + return; + } Deque currentStacks = CURRENT_STACKS.get(); currentStacks.removeLast(); if (DEBUG) { @@ -156,4 +166,8 @@ public class CaptureStorage { public static void setDebug(boolean debug) { DEBUG = debug; } + + public static void setEnabled(boolean enabled) { + ENABLED = enabled; + } } diff --git a/java/debugger/debugger-agent/src/com/intellij/rt/debugger/agent/CaptureAgent.java b/java/debugger/debugger-agent/src/com/intellij/rt/debugger/agent/CaptureAgent.java index 6455e7dfcbf8..22b4ecaa0d24 100644 --- a/java/debugger/debugger-agent/src/com/intellij/rt/debugger/agent/CaptureAgent.java +++ b/java/debugger/debugger-agent/src/com/intellij/rt/debugger/agent/CaptureAgent.java @@ -68,6 +68,9 @@ public class CaptureAgent { DEBUG = true; CaptureStorage.setDebug(true); } + else if ("disabled".equals(s)) { + CaptureStorage.setEnabled(false); + } else { asmPath = s; }