如何在pydev中启用验尸调试? [英] How do I enable post mortem debugging in pydev?

查看:117
本文介绍了如何在pydev中启用验尸调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我的程序引发未处理的异常时,我都希望pydev进入交互式控制台模式,但是我不知道该怎么做。按照现在的行为,将报告异常,并且该过程将立即终止。



经过一番搜索后,我发现:


并选中暂停未捕获的异常。在大多数情况下,您将希望捕获各种异常(因此请选择全选),但是您也可以选择要单独管理的异常。



I want to make pydev enter into an interactive console mode whenever my program raises an unhandled exception but I can't figure out how to do it. As it behaves now, the exception is reported and the process is terminated immidiately.

After some searching around I found this: http://sourceforge.net/tracker/index.php?func=detail&aid=3029746&group_id=85796&atid=577332 which suggests to use pydevd.set_pm_excepthook()

However, when i add

import pydevd
pydevd.set_pm_excepthook()

to my code, I get an exception:

This function is now replaced by GetGlobalDebugger().setExceptHook and is now controlled by the PyDev UI.')
DeprecationWarning: This function is now replaced by GetGlobalDebugger().setExceptHook and is now controlled by the PyDev UI.

But:

GetGlobalDebugger().setExceptHook()

Doesn't seem to work, GetGlobalDebugger() does not exist in the global namespace.

解决方案

Actually, you don't need to do this programmatically... you can go to the Debug perspective > Pydev menu > Manage Exception Breakpoints

and check 'Suspend on uncaught exceptions'. In most cases you will want to catch all kinds of exceptions (so choose "Select All") but you can also select exceptions to be managed individually.

这篇关于如何在pydev中启用验尸调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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