From c0f47df431ba68756190fe6edf9fc78b5e4784f6 Mon Sep 17 00:00:00 2001 From: Elizaveta Shashkova Date: Sun, 17 Sep 2017 15:30:10 +0300 Subject: [PATCH] Fix focus requesting for error stepping (PY-9537) --- python/helpers/pydev/pydevd.py | 17 +++++++---------- .../python/debugger/PyDebugProcess.java | 1 - 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/python/helpers/pydev/pydevd.py b/python/helpers/pydev/pydevd.py index 0f3d79ea0dc1..7915ed8f28c9 100644 --- a/python/helpers/pydev/pydevd.py +++ b/python/helpers/pydev/pydevd.py @@ -757,17 +757,17 @@ class PyDB: response_msg = "jump is available only within the bottom frame" return stop, old_line, response_msg - def do_wait_suspend(self, thread, frame, event, arg, suspend_type="trace"): #@UnusedVariable + def do_wait_suspend(self, thread, frame, event, arg, suspend_type="trace", send_suspend_message=True): #@UnusedVariable """ busy waits until the thread state changes to RUN it expects thread's state as attributes of the thread. Upon running, processes any outstanding Stepping commands. """ self.process_internal_commands() - message = thread.additional_info.pydev_message - - cmd = self.cmd_factory.make_thread_suspend_message(get_thread_id(thread), frame, thread.stop_reason, message, suspend_type) - self.writer.add_command(cmd) + if send_suspend_message: + message = thread.additional_info.pydev_message + cmd = self.cmd_factory.make_thread_suspend_message(get_thread_id(thread), frame, thread.stop_reason, message, suspend_type) + self.writer.add_command(cmd) CustomFramesContainer.custom_frames_lock.acquire() # @UndefinedVariable try: @@ -834,11 +834,8 @@ class PyDB: cmd = self.cmd_factory.make_set_next_stmnt_status_message(seq, stop, response_msg) self.writer.add_command(cmd) - cmd = self.cmd_factory.make_thread_run_message(get_thread_id(thread), info.pydev_step_cmd) - self.writer.add_command(cmd) - info.pydev_state = STATE_RUN - if stop: + info.pydev_state = STATE_RUN # `f_line` should be assigned within a tracing function, so, we can't assign it here # for the frame evaluation debugger. For tracing debugger it will be assigned, but we should # revert the previous value, because both debuggers should behave the same way @@ -851,7 +848,7 @@ class PyDB: info.pydev_state = STATE_SUSPEND thread.stop_reason = CMD_THREAD_SUSPEND # return to the suspend state and wait for other command - self.do_wait_suspend(thread, frame, event, arg, "trace") + self.do_wait_suspend(thread, frame, event, arg, "trace", send_suspend_message=False) return elif info.pydev_step_cmd == CMD_STEP_RETURN: diff --git a/python/src/com/jetbrains/python/debugger/PyDebugProcess.java b/python/src/com/jetbrains/python/debugger/PyDebugProcess.java index de12e764614b..2bc0079118da 100644 --- a/python/src/com/jetbrains/python/debugger/PyDebugProcess.java +++ b/python/src/com/jetbrains/python/debugger/PyDebugProcess.java @@ -548,7 +548,6 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr XSourcePosition sourcePosition, PyDebugCallback> callback) { if (!checkCanPerformCommands()) return; - getSession().sessionResumed(); dropFrameCaches(); if (isConnected()) { String threadId = threadIdBeforeResumeOrStep(context);