mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Do update debugger's focus if debugger is already suspended and other threads suspend (PY-2431)
This commit is contained in:
@@ -13,7 +13,7 @@ import java.io.IOException;
|
||||
public interface IPyDebugProcess extends PyFrameAccessor {
|
||||
PyPositionConverter getPositionConverter();
|
||||
|
||||
void threadSuspended(PyThreadInfo thread);
|
||||
void threadSuspended(PyThreadInfo thread, boolean updateSourcePosition);
|
||||
|
||||
boolean canSaveToTemp(String name);
|
||||
|
||||
|
||||
@@ -586,8 +586,13 @@ public class RemoteDebugger implements ProcessDebugger {
|
||||
thread.updateState(PyThreadInfo.State.SUSPENDED, event.getFrames());
|
||||
thread.setStopReason(event.getStopReason());
|
||||
thread.setMessage(event.getMessage());
|
||||
myDebugProcess.threadSuspended(thread);
|
||||
myDebugProcess.suspendAllOtherThreads(thread);
|
||||
boolean updateSourcePosition = true;
|
||||
if (event.getStopReason() == AbstractCommand.SUSPEND_THREAD) {
|
||||
// That means that the thread was stopped manually from the Java side either while suspending all threads
|
||||
// or after the "Pause" command. In both cases we shouldn't change debugger focus if session is already suspended.
|
||||
updateSourcePosition = !myDebugProcess.getSession().isSuspended();
|
||||
}
|
||||
myDebugProcess.threadSuspended(thread, updateSourcePosition);
|
||||
break;
|
||||
}
|
||||
case AbstractCommand.RESUME_THREAD: {
|
||||
@@ -611,7 +616,7 @@ public class RemoteDebugger implements ProcessDebugger {
|
||||
// notify UI of suspended threads left in debugger if one thread finished its work
|
||||
if ((threadInfo != null) && (threadInfo.getState() == PyThreadInfo.State.SUSPENDED)) {
|
||||
myDebugProcess.threadResumed(threadInfo);
|
||||
myDebugProcess.threadSuspended(threadInfo);
|
||||
myDebugProcess.threadSuspended(threadInfo, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,7 +798,7 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
}
|
||||
|
||||
@Override
|
||||
public void threadSuspended(final PyThreadInfo threadInfo) {
|
||||
public void threadSuspended(final PyThreadInfo threadInfo, boolean updateSourcePosition) {
|
||||
if (!mySuspendedThreads.contains(threadInfo)) {
|
||||
mySuspendedThreads.add(threadInfo);
|
||||
|
||||
@@ -821,14 +821,20 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
breakpoint = myRegisteredExceptionBreakpoints.get(exceptionName);
|
||||
}
|
||||
}
|
||||
|
||||
if (breakpoint != null) {
|
||||
if (!getSession().breakpointReached(breakpoint, threadInfo.getMessage(), suspendContext)) {
|
||||
resume(suspendContext);
|
||||
}
|
||||
// add check for breakpoint type
|
||||
suspendAllOtherThreads(threadInfo);
|
||||
}
|
||||
else {
|
||||
getSession().positionReached(suspendContext);
|
||||
|
||||
if (updateSourcePosition) {
|
||||
if (breakpoint != null) {
|
||||
if (!getSession().breakpointReached(breakpoint, threadInfo.getMessage(), suspendContext)) {
|
||||
resume(suspendContext);
|
||||
}
|
||||
}
|
||||
else {
|
||||
getSession().positionReached(suspendContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user