IDEA-43728 Provide a way to step in a chosen thread while others remain suspended - setting to enable

This commit is contained in:
Egor.Ushakov
2016-01-29 15:50:58 +03:00
parent 0c877c89fc
commit 4979bd074c
6 changed files with 21 additions and 8 deletions
@@ -186,7 +186,7 @@ public class DebugProcessEvents extends DebugProcessImpl {
// check if there is already one request with policy SUSPEND_ALL
for (SuspendContextImpl context : getSuspendManager().getEventContexts()) {
if (context.getSuspendPolicy() == EventRequest.SUSPEND_ALL) {
if (Registry.is("debugger.step.resumes.one.thread") && locatableEvent != null) {
if (isResumeOnlyCurrentThread() && locatableEvent != null) {
// if step event is present - switch context
getSuspendManager().resume(context);
//((SuspendManagerImpl)getSuspendManager()).popContext(context);
@@ -202,7 +202,7 @@ public class DebugProcessEvents extends DebugProcessImpl {
SuspendContextImpl suspendContext = null;
if (Registry.is("debugger.step.resumes.one.thread") && locatableEvent != null) {
if (isResumeOnlyCurrentThread() && locatableEvent != null) {
for (SuspendContextImpl context : getSuspendManager().getEventContexts()) {
ThreadReferenceProxyImpl threadProxy = getVirtualMachineProxy().getThreadReferenceProxy(locatableEvent.thread());
if (context.getSuspendPolicy() == EventRequest.SUSPEND_ALL &&
@@ -921,7 +921,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
}
private static int getInvokePolicy(SuspendContext suspendContext) {
if (suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD || Registry.is("debugger.step.resumes.one.thread")) {
if (suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD || isResumeOnlyCurrentThread()) {
return ObjectReference.INVOKE_SINGLE_THREADED;
}
return 0;
@@ -1696,11 +1696,11 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
protected void resumeAction() {
SuspendContextImpl context = getSuspendContext();
if (context != null &&
(context.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD || Registry.is("debugger.step.resumes.one.thread"))) {
(context.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD || isResumeOnlyCurrentThread())) {
myThreadBlockedMonitor.startWatching(myContextThread);
}
if (context != null
&& Registry.is("debugger.step.resumes.one.thread")
&& isResumeOnlyCurrentThread()
&& context.getSuspendPolicy() == EventRequest.SUSPEND_ALL
&& myContextThread != null) {
getSuspendManager().resumeThread(context, myContextThread);
@@ -2229,4 +2229,8 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
public DebuggerSession getSession() {
return mySession;
}
static boolean isResumeOnlyCurrentThread() {
return DebuggerSettings.getInstance().RESUME_ONLY_CURRENT_THREAD;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -85,6 +85,8 @@ public class DebuggerSettings implements Cloneable, PersistentStateComponent<Ele
public String EVALUATE_FINALLY_ON_POP_FRAME = EVALUATE_FINALLY_ASK;
public boolean RESUME_ONLY_CURRENT_THREAD = false;
private ClassFilter[] mySteppingFilters = ClassFilter.EMPTY_ARRAY;
private Map<String, ContentState> myContentStates = new LinkedHashMap<String, ContentState>();
@@ -162,6 +164,7 @@ public class DebuggerSettings implements Cloneable, PersistentStateComponent<Ele
SKIP_CLASSLOADERS == secondSettings.SKIP_CLASSLOADERS &&
SKIP_CONSTRUCTORS == secondSettings.SKIP_CONSTRUCTORS &&
SKIP_GETTERS == secondSettings.SKIP_GETTERS &&
RESUME_ONLY_CURRENT_THREAD == secondSettings.RESUME_ONLY_CURRENT_THREAD &&
COMPILE_BEFORE_HOTSWAP == secondSettings.COMPILE_BEFORE_HOTSWAP &&
HOTSWAP_HANG_WARNING_ENABLED == secondSettings.HOTSWAP_HANG_WARNING_ENABLED &&
(RUN_HOTSWAP_AFTER_COMPILE != null ? RUN_HOTSWAP_AFTER_COMPILE.equals(secondSettings.RUN_HOTSWAP_AFTER_COMPILE) : secondSettings.RUN_HOTSWAP_AFTER_COMPILE == null) &&
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -37,6 +37,7 @@ class DebuggerSteppingConfigurable implements ConfigurableUi<DebuggerSettings> {
private JRadioButton myRbEvaluateFinallyAlways;
private JRadioButton myRbEvaluateFinallyNever;
private JRadioButton myRbEvaluateFinallyAsk;
private JCheckBox myCbResumeOnlyCurrentThread;
@Override
public void reset(@NotNull DebuggerSettings settings) {
@@ -59,6 +60,7 @@ class DebuggerSteppingConfigurable implements ConfigurableUi<DebuggerSettings> {
else {
myRbEvaluateFinallyAsk.setSelected(true);
}
myCbResumeOnlyCurrentThread.setSelected(settings.RESUME_ONLY_CURRENT_THREAD);
}
@Override
@@ -84,6 +86,7 @@ class DebuggerSteppingConfigurable implements ConfigurableUi<DebuggerSettings> {
settings.EVALUATE_FINALLY_ON_POP_FRAME = DebuggerSettings.EVALUATE_FINALLY_ASK;
}
settings.RESUME_ONLY_CURRENT_THREAD = myCbResumeOnlyCurrentThread.isSelected();
settings.setSteppingFilters(mySteppingFilterEditor.getFilters());
}
@@ -145,6 +148,9 @@ class DebuggerSteppingConfigurable implements ConfigurableUi<DebuggerSettings> {
evalFinallyPanel.add(new JLabel(DebuggerBundle.message("label.debugger.general.configurable.evaluate.finally.on.pop")), BorderLayout.WEST);
panel.add(evalFinallyPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(4, cbLeftOffset, 0, 0), 0, 0));
myCbResumeOnlyCurrentThread = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.resume.only.current.thread"));
panel.add(myCbResumeOnlyCurrentThread, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0),0, 0));
return panel;
}
}
@@ -199,7 +199,6 @@ debugger.batch.evaluation=false
debugger.compiling.evaluator=true
debugger.watches.in.variables=false
debugger.auto.fetch.icons=true
debugger.step.resumes.one.thread=false
debugger.close.dialog.on.navigate=true
debugger.close.dialog.on.navigate.description=Close evaluate dialog on Jump to (type) source action
debugger.async.smart.step.into=true
@@ -242,6 +242,7 @@ label.debugger.general.configurable.evaluate.finally.on.pop=Evaluate finally blo
label.debugger.general.configurable.evaluate.finally.always=&Always
label.debugger.general.configurable.evaluate.finally.never=N&ever
label.debugger.general.configurable.evaluate.finally.ask=As&k
label.debugger.general.configurable.resume.only.current.thread=Resume only the current thread
label.threads.view.configurable.show.source.file.name=Show source file name
label.threads.view.configurable.show.class.name=Show class name
label.threads.view.configurable.show.package=Show package name