IDEA-197854 Always use debug agent - configuration ui

This commit is contained in:
Egor Ushakov
2018-09-03 16:38:59 +03:00
parent 629f73c2a5
commit 005acb8dfb
4 changed files with 14 additions and 16 deletions
@@ -1,23 +1,10 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.debugger.settings;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.openapi.options.ConfigurableUi;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.StateRestoringCheckBox;
import com.intellij.ui.components.panels.VerticalBox;
import com.intellij.util.ui.JBUI;
@@ -34,6 +21,7 @@ class DebuggerLaunchingConfigurable implements ConfigurableUi<DebuggerSettings>
private JCheckBox myCbDisableJIT;
private JCheckBox myCbShowAlternativeSource;
private JCheckBox myCbKillImmediately;
private JCheckBox myCbAlwaysDebug;
@Override
public void reset(@NotNull DebuggerSettings settings) {
@@ -54,6 +42,7 @@ class DebuggerLaunchingConfigurable implements ConfigurableUi<DebuggerSettings>
myCbDisableJIT.setSelected(settings.DISABLE_JIT);
myCbShowAlternativeSource.setSelected(settings.SHOW_ALTERNATIVE_SOURCE);
myCbKillImmediately.setSelected(settings.KILL_PROCESS_IMMEDIATELY);
myCbAlwaysDebug.setSelected(settings.ALWAYS_DEBUG);
}
@Override
@@ -72,6 +61,7 @@ class DebuggerLaunchingConfigurable implements ConfigurableUi<DebuggerSettings>
settings.DISABLE_JIT = myCbDisableJIT.isSelected();
settings.SHOW_ALTERNATIVE_SOURCE = myCbShowAlternativeSource.isSelected();
settings.KILL_PROCESS_IMMEDIATELY = myCbKillImmediately.isSelected();
settings.ALWAYS_DEBUG = myCbAlwaysDebug.isSelected();
}
@Override
@@ -90,6 +80,7 @@ class DebuggerLaunchingConfigurable implements ConfigurableUi<DebuggerSettings>
myRbSocket = new JRadioButton(DebuggerBundle.message("label.debugger.launching.configurable.socket"));
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"));
final ButtonGroup gr = new ButtonGroup();
gr.add(myRbSocket);
@@ -110,6 +101,9 @@ class DebuggerLaunchingConfigurable implements ConfigurableUi<DebuggerSettings>
panel.add(myCbDisableJIT);
panel.add(myCbShowAlternativeSource);
panel.add(myCbKillImmediately);
if (Registry.is("execution.java.always.debug")) {
panel.add(myCbAlwaysDebug);
}
JPanel result = new JPanel(new BorderLayout());
result.add(panel, BorderLayout.NORTH);
@@ -77,6 +77,7 @@ public class DebuggerSettings implements Cloneable, PersistentStateComponent<Ele
public volatile boolean AUTO_VARIABLES_MODE = false;
public volatile boolean KILL_PROCESS_IMMEDIATELY = false;
public volatile boolean ALWAYS_DEBUG = true;
public String EVALUATE_FINALLY_ON_POP_FRAME = EVALUATE_FINALLY_ASK;
@@ -157,6 +158,7 @@ public class DebuggerSettings implements Cloneable, PersistentStateComponent<Ele
DISABLE_JIT == secondSettings.DISABLE_JIT &&
SHOW_ALTERNATIVE_SOURCE == secondSettings.SHOW_ALTERNATIVE_SOURCE &&
KILL_PROCESS_IMMEDIATELY == secondSettings.KILL_PROCESS_IMMEDIATELY &&
ALWAYS_DEBUG == secondSettings.ALWAYS_DEBUG &&
HOTSWAP_IN_BACKGROUND == secondSettings.HOTSWAP_IN_BACKGROUND &&
SKIP_SYNTHETIC_METHODS == secondSettings.SKIP_SYNTHETIC_METHODS &&
SKIP_CLASSLOADERS == secondSettings.SKIP_CLASSLOADERS &&
@@ -5,6 +5,7 @@ import com.intellij.concurrency.JobScheduler;
import com.intellij.debugger.engine.JavaDebugProcess;
import com.intellij.debugger.impl.attach.JavaDebuggerAttachUtil;
import com.intellij.debugger.impl.attach.PidRemoteConnection;
import com.intellij.debugger.settings.DebuggerSettings;
import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.ExecutionResult;
@@ -84,7 +85,7 @@ public class DefaultJavaProgramRunner extends JavaPatchableProgramRunner {
final JavaParameters parameters = ((JavaCommandLine)state).getJavaParameters();
patch(parameters, env.getRunnerSettings(), env.getRunProfile(), true);
if (Registry.is("execution.java.always.debug")) {
if (Registry.is("execution.java.always.debug") && DebuggerSettings.getInstance().ALWAYS_DEBUG) {
ParametersList parametersList = parameters.getVMParametersList();
if (parametersList.getList().stream().noneMatch(s -> s.startsWith("-agentlib:jdwp"))) {
parametersList.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,quiet=y");
@@ -245,6 +245,7 @@ label.debugger.launching.configurable.socket=&Socket
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.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