Pdb崩溃:无法设置断点 [英] Pdb Crashed: Cannot set breakpoint

查看:83
本文介绍了Pdb崩溃:无法设置断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我突然无法在python程序中设置任何断点.请注意,显示了两个(Pdb).我想知道Pdb之前是否已损坏.在发生此问题之前,我确实尝试使用Pdb进入 abc.so 文件中的一些已编译C ++代码:

I suddenly cannot set any breakpoint in my python program. Note there are two (Pdb) showing up. I wonder if the Pdb was damaged before. I did try to step into some compiled C++ code in an abc.so file using Pdb before this issue started happening:

-> print('haha')
(Pdb) (Pdb) 
Traceback (most recent call last):
  File "high.py", line 38, in <module>
    print('haha')
  File "high.py", line 38, in <module>
    print('haha')
  File "/Users/ludaming/anaconda2/lib/python2.7/bdb.py", line 49, in trace_dispatch
    return self.dispatch_line(frame)
  File "/Users/ludaming/anaconda2/lib/python2.7/bdb.py", line 68, in dispatch_line
    if self.quitting: raise BdbQuit
bdb.BdbQuit

推荐答案

现在我发现Pdb不会出现故障.这是因为Python从Pdb旁边的stdin读取数据,这会进入Pdb的交互式控制台并引起问题.因此,绕过的是从文件而不是stdin中读取

Now I figured it out that the Pdb is not malfunctioning. It is because Python reads from stdin right next to the Pdb, which enters to the Pdb's interactive console and causing a problem. So a bypass is to read from file instead of stdin

fp = open(sys.argv[1], 'r')  
t = int(fp.readline())

代替

t = int(raw_input())

这篇关于Pdb崩溃:无法设置断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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