mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
[memory-agent] Move enabling/disabling memory agent from registry to "Debugger" configurable
This commit is contained in:
@@ -3,6 +3,7 @@ package com.intellij.debugger.impl;
|
||||
|
||||
import com.intellij.debugger.*;
|
||||
import com.intellij.debugger.engine.*;
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointManager;
|
||||
import com.intellij.debugger.ui.tree.render.BatchEvaluator;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
@@ -348,7 +349,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent
|
||||
return new RemoteConnectionBuilder(debuggerInServerMode, transport, debugPort)
|
||||
.checkValidity(checkValidity)
|
||||
.asyncAgent(addAsyncDebuggerAgent)
|
||||
.memoryAgent(Registry.is("debugger.enable.memory.agent"))
|
||||
.memoryAgent(DebuggerSettings.getInstance().ENABLE_MEMORY_AGENT)
|
||||
.create(parameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ public class GenericDebuggerRunner extends JavaPatchableProgramRunner<GenericDeb
|
||||
}
|
||||
return new RemoteConnectionBuilder(debuggerSettings.LOCAL, debuggerSettings.getTransport(), debuggerSettings.getDebugPort())
|
||||
.asyncAgent(beforeExecution)
|
||||
.memoryAgent(beforeExecution && Registry.is("debugger.enable.memory.agent"))
|
||||
.memoryAgent(beforeExecution && DebuggerSettings.getInstance().ENABLE_MEMORY_AGENT)
|
||||
.create(javaParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.memory.agent.extractor.AgentExtractor;
|
||||
import com.intellij.debugger.memory.ui.JavaReferenceInfo;
|
||||
import com.intellij.debugger.memory.ui.SizedReferenceInfo;
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.execution.JavaExecutionUtil;
|
||||
import com.intellij.execution.configurations.JavaParameters;
|
||||
import com.intellij.execution.configurations.ParametersList;
|
||||
@@ -37,7 +38,7 @@ public class MemoryAgentUtil {
|
||||
private static final Logger LOG = Logger.getInstance(MemoryAgentUtil.class);
|
||||
|
||||
public static void addMemoryAgent(@NotNull JavaParameters parameters) {
|
||||
if (!Registry.is("debugger.enable.memory.agent")) {
|
||||
if (!DebuggerSettings.getInstance().ENABLE_MEMORY_AGENT) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,8 +114,8 @@ public class MemoryAgentUtil {
|
||||
|
||||
@Nullable
|
||||
private MemoryAgent initMemoryAgent(@NotNull SuspendContextImpl suspendContext) {
|
||||
if (!Registry.is("debugger.enable.memory.agent")) {
|
||||
LOG.info("Memory agent disabled by registry key");
|
||||
if (!DebuggerSettings.getInstance().ENABLE_MEMORY_AGENT) {
|
||||
LOG.info("Memory agent disabled");
|
||||
return AgentLoader.DEFAULT_PROXY;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ class DebuggerLaunchingConfigurable implements ConfigurableUi<DebuggerSettings>
|
||||
private JCheckBox myCbShowAlternativeSource;
|
||||
private JCheckBox myCbKillImmediately;
|
||||
private JCheckBox myCbAlwaysDebug;
|
||||
private JCheckBox myCbEnableMemoryAgent;
|
||||
|
||||
@Override
|
||||
public void reset(@NotNull DebuggerSettings settings) {
|
||||
@@ -43,6 +44,7 @@ class DebuggerLaunchingConfigurable implements ConfigurableUi<DebuggerSettings>
|
||||
myCbShowAlternativeSource.setSelected(settings.SHOW_ALTERNATIVE_SOURCE);
|
||||
myCbKillImmediately.setSelected(settings.KILL_PROCESS_IMMEDIATELY);
|
||||
myCbAlwaysDebug.setSelected(settings.ALWAYS_DEBUG);
|
||||
myCbEnableMemoryAgent.setSelected(settings.ENABLE_MEMORY_AGENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,6 +64,7 @@ class DebuggerLaunchingConfigurable implements ConfigurableUi<DebuggerSettings>
|
||||
settings.SHOW_ALTERNATIVE_SOURCE = myCbShowAlternativeSource.isSelected();
|
||||
settings.KILL_PROCESS_IMMEDIATELY = myCbKillImmediately.isSelected();
|
||||
settings.ALWAYS_DEBUG = myCbAlwaysDebug.isSelected();
|
||||
settings.ENABLE_MEMORY_AGENT = myCbEnableMemoryAgent.isSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,6 +84,8 @@ class DebuggerLaunchingConfigurable implements ConfigurableUi<DebuggerSettings>
|
||||
myRbShmem = new JRadioButton(DebuggerBundle.message("label.debugger.launching.configurable.shmem"));
|
||||
myCbKillImmediately = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.kill.immediately"));
|
||||
myCbAlwaysDebug = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.always.debug"));
|
||||
myCbEnableMemoryAgent = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.enable.memory.agent"));
|
||||
myCbEnableMemoryAgent.setToolTipText(DebuggerBundle.message("label.debugger.general.configurable.enable.memory.agent.tooltip.text"));
|
||||
|
||||
final ButtonGroup gr = new ButtonGroup();
|
||||
gr.add(myRbSocket);
|
||||
@@ -101,6 +106,7 @@ class DebuggerLaunchingConfigurable implements ConfigurableUi<DebuggerSettings>
|
||||
panel.add(myCbDisableJIT);
|
||||
panel.add(myCbShowAlternativeSource);
|
||||
panel.add(myCbKillImmediately);
|
||||
panel.add(myCbEnableMemoryAgent);
|
||||
if (Registry.is("execution.java.always.debug")) {
|
||||
panel.add(myCbAlwaysDebug);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ public class DebuggerSettings implements Cloneable, PersistentStateComponent<Ele
|
||||
public boolean DISABLE_JIT;
|
||||
public boolean SHOW_ALTERNATIVE_SOURCE = true;
|
||||
public boolean HOTSWAP_IN_BACKGROUND = true;
|
||||
public boolean ENABLE_MEMORY_AGENT = false;
|
||||
public boolean SKIP_SYNTHETIC_METHODS = true;
|
||||
public boolean SKIP_CONSTRUCTORS;
|
||||
public boolean SKIP_GETTERS;
|
||||
@@ -160,6 +161,7 @@ public class DebuggerSettings implements Cloneable, PersistentStateComponent<Ele
|
||||
KILL_PROCESS_IMMEDIATELY == secondSettings.KILL_PROCESS_IMMEDIATELY &&
|
||||
ALWAYS_DEBUG == secondSettings.ALWAYS_DEBUG &&
|
||||
HOTSWAP_IN_BACKGROUND == secondSettings.HOTSWAP_IN_BACKGROUND &&
|
||||
ENABLE_MEMORY_AGENT == secondSettings.ENABLE_MEMORY_AGENT &&
|
||||
SKIP_SYNTHETIC_METHODS == secondSettings.SKIP_SYNTHETIC_METHODS &&
|
||||
SKIP_CLASSLOADERS == secondSettings.SKIP_CLASSLOADERS &&
|
||||
SKIP_CONSTRUCTORS == secondSettings.SKIP_CONSTRUCTORS &&
|
||||
|
||||
@@ -352,8 +352,6 @@ debugger.resume.yourkit.threads=true
|
||||
debugger.keep.step.requests=false
|
||||
debugger.enable.memory.view=true
|
||||
debugger.enable.overhead.monitor=true
|
||||
debugger.enable.memory.agent=false
|
||||
debugger.enable.memory.agent.description=Allow to start java debug sessions with attached debugger memory agent
|
||||
debugger.memory.agent.debug=false
|
||||
debugger.memory.agent.debug.description=Enable debug logging to stdout from memory agent
|
||||
debugger.memory.agent.debug.path=
|
||||
|
||||
@@ -247,6 +247,8 @@ label.debugger.launching.configurable.shmem=Shared &memory
|
||||
label.debugger.general.configurable.show.alternative.source=Show alternative source switcher
|
||||
label.debugger.general.configurable.kill.immediately=Kill the debug process immediately
|
||||
label.debugger.general.configurable.always.debug=Start run configurations with the debug agent
|
||||
label.debugger.general.configurable.enable.memory.agent=Enable memory agent
|
||||
label.debugger.general.configurable.enable.memory.agent.tooltip.text=Allow to start java debug sessions with attached memory agent
|
||||
label.debugger.general.configurable.skip.synthetic.methods=Ski&p synthetic methods
|
||||
label.debugger.general.configurable.skip.constructors=Skip &constructors
|
||||
label.debugger.general.configurable.skip.classLoaders=Skip class l&oaders
|
||||
|
||||
Reference in New Issue
Block a user