PyCharm - how to suspend all threads
Asked Answered
M

1

15

We're using PyCharm 5.0.1 for multi-thread debugging.
When it stops at a break point, only the specific thread stops while all the other continue. This makes it hard to "freeze the moment" and check params values, and the current state of the other threads.

Is it possible to suspend all the thread while one of them has stopped on a breakpoint?

Is this possible on the newest Pycharm 2016 or the [latest] Pycharm version?

Madiemadigan answered 3/3, 2016 at 12:49 Comment(4)
Why is the title of the question using "PyCharm 3" and body of the question says PyCharm 5.0.1?Mciver
You are right, fixed, thank you.Madiemadigan
FYI, there is a brand new version of Pycharm just released: 2016.1, haven't tested yet to see if it helps with this but it does list a number of improvements for debugging in the release notes.Mciver
Its an open and very important (imho) functionality, so changed the question to also ask about the latest version of Pycharm....Arlon
A
14

According to this thread this is possible after PyCharm 2016.2:

Elizaveta Shashkova 27 Jul 2016:

The new feature has appeared in PyCharm 2016.2: breakpoint thread suspend policy. You can go to Run | View breakpoints, select the breakpoint and change its threads suspend policy: "Thread" or "All". Also you can set the default policy for all your breakpoints.

Arlon answered 3/5, 2017 at 9:25 Comment(1)
This does not always work. For example if one of your threads is waiting in a C-level function (e.g. socket.recv()) then even with "All" set, the impacted thread will not be interrupted and the stack pane will show "Frames not available in non-suspended state".Spinozism

© 2022 - 2024 — McMap. All rights reserved.