如何在Pycharm中暂停程序执行(暂停按钮不起作用)? [英] How to pause program execution in Pycharm (pause button not working)?

查看:595
本文介绍了如何在Pycharm中暂停程序执行(暂停按钮不起作用)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Pycharm 5.0.4中调试我的Python 3.5图形时,我试图按一下暂停按钮以查找程序挂起的原因/位置(可以在Visual Studio中完成).

While debugging my Python 3.5 pogram in Pycharm 5.0.4, I am trying to hit the pause button to find how why/where the program is hanging (as can be done in Visual Studio).

但是,什么也没发生:暂停按钮不会变成灰色,恢复按钮保持灰色,并且在调试器工具窗口中,框架不可用".

However, nothing happens: the pause button does not become grey and the resume button stays grey, and in the debugger tool window, "Frames are not available".

我尝试了在Linux和Windows上使用不同的基本程序,但无济于事.

I tried with different basic programs, on Linux and on Windows, to no avail.

这是错误还是我在Pycharm调试应该如何工作方面缺少一些东西?

Is this a bug or am I missing something in how Pycharm debugging is supposed to work?

我还注意到,当遇到断点时,只有一个线程被挂起,而我看不到有任何方法可以挂起其他线程来检查它们的堆栈帧.我想知道如何也实现这种特定于线程的挂起.

I also noticed that when a breakpoint is hit, only one thread is suspended and I could see no way to suspend other threads to inspect their stack frames. I would be interested to know how to achieve this thread-specific suspension as well.

推荐答案

听起来像您的程序正处于睡眠状态或类似的状态,或者可能是某些本机代码上.

Sounds like your program is hanging on a sleep or something of that sort, or maybe on some native code.

如果这是一个常规的python循环,则暂停python将起作用.我相信问题出在python本身,而不是您使用的调试工具.

If it was a regular python loop the pause python would work. I believe the problem is with python itself and not the debug tool you are using.

当您暂停python程序时,您会暂停Interperter,因此在Interperter上下文中运行的所有线程都将暂停,您可以在框架窗口中看到它们.任何显示消息在非暂停状态下都无法使用帧"消息的线程都不会被暂停,因为在您暂停程序时它正在休眠.

When you pause a python program you pause the interperter and so all threads that are running in the context of the interperter are paused and you can see the them in the frames window. Any thread that show the message "Frames not available in non-suspended state" is not suspended because it is was sleeping when you paused the program.

有关如何调试C代码的信息,请参见此内容无法在pycharm或C语言中的C线程中使用python断点eclipse + pydev

see this for how to debug c code Not working python breakpoints in C thread in pycharm or eclipse+pydev

这篇关于如何在Pycharm中暂停程序执行(暂停按钮不起作用)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆