在perl调试器中,如果您反复列出使您远离当前行的代码段,则可以通过输入命令.(点)返回到当前行.
我无法使用python PDB模块找到任何可比性的东西.如果我将自己列出当前行并希望再次查看它,我似乎要记住当前正在执行的行号(对我来说不太可能)或执行语句(通常是不合需要的).
我错过了什么吗?
有没有办法在ipython中进入函数的第一行.我想象的东西看起来像:
%step foo(1, 2)
Run Code Online (Sandbox Code Playgroud)
它运行ipdb并在第一行设置断点foo.
如果我现在想要这样做,我必须转到函数的源代码并添加import ipdb; ipdb.set_trace()一行.
我正在尝试调试模块"main",它在"another_module"的第356行调用一个函数"broken_function".我在该函数中遇到错误,并希望在其开头添加断点.以下是列表.难道我做错了什么?原因,断点不起作用:
$ python -m pdb main
(Pdb) import sys
(Pdb) sys.path.append("/home/user/path/to/another/module")
(Pdb) import another_module
(Pdb) b another_module:356
Breakpoint 1 at /home/user/path/to/another/module/another_module.py:356
(Pdb) c
Traceback (most recent call last):
...
File "/home/user/path/to/another/module/another_module.py", line 383, in broken_function
f=open("../jobs/temptree.tre", "r")
IOError: [Errno 2] No such file or directory: '../jobs/temptree.tre'
Uncaught exception. Entering post mortem debugging
...
Run Code Online (Sandbox Code Playgroud) 我尝试在Python pdb中列出对象的所有属性.
假设我要列出所有属性和所有方法sys.stderr.
我怎样才能做到这一点?
来自PDB
(Pdb) help l
l(ist) [first [,last]]
List source code for the current file.
Without arguments, list 11 lines around the current line
or continue the previous listing.
With one argument, list 11 lines starting at that line.
With two arguments, list the given range;
if the second argument is less than the first, it is a count.
Run Code Online (Sandbox Code Playgroud)
"继续上一个上市"功能非常好,但是你怎么把它关掉?
我已经下载了一些dll文件,随之而来的还有pdb,exp和ilk文件.现在我需要知道我是否需要将它们放入我的系统文件中,或者不是,它们在一般情况下的目的是什么?
我在Ubuntu Linux 11.04(natty)机器上的virtualenv中使用python 2.6.我在我的(django)python代码中有这个代码:
import pdb ; pdb.set_trace()
Run Code Online (Sandbox Code Playgroud)
为了启动python调试器(pdb).
直到今天,这个工作正常.但是现在当pdb启动时,它适用于调试,运行和断点等,但是当我按下up arrow显示上一个命令时,它打印^[[A而不是上升.当我输入内容并按下时Home,它会打印^[OH而不是移动光标.
我可以用完/ home/etc.在bash终端启动我的python django unittests(有pdb调用)很好.
这是怎么回事?我该如何修复我的pdb?我的readline有什么问题?
我正在尝试在EntityFramework NuGet包(版本6.1.3)中调试StackOverflow.为了查看堆栈帧,我需要EntityFramework.DLL和EntityFramework.SqlServer.DLL的PDB文件.但是,我似乎无法让Visual Studio从MSFT符号源或从SymbolSource.org下载它(我可以获得其他系统PDB和NewtonSoft.json之类的东西).EF PDB可以在任何地方使用吗?
这是什么意思?
我的函数从python/c库中获取两个numpy数组.在该函数调用之后,我打开调试器来查找错误,所以我添加了一行来查看两个numpy数组.
import pdb; pdb.set_trace()
Run Code Online (Sandbox Code Playgroud)
但是对于其中一个arrays pdb唯一返回消息的值*** Newest frame
PDB输出:
(Pdb) type(d)
<type 'numpy.ndarray'>
(Pdb) type(f)
<type 'numpy.ndarray'>
(Pdb) f.shape
(3, 3, 17856)
(Pdb) d[0].shape
*** Newest frame
(Pdb) d[0]
*** Newest frame
Run Code Online (Sandbox Code Playgroud) 我有一个python脚本,我怀疑有一个死锁.我试图调试,pdb但如果我一步一步地去,它不会得到死锁,并且通过返回的输出我可以看到它没有被挂在同一个迭代上.我想将我的脚本仅在它被锁定时附加到调试器,是否可能?如果有必要,我愿意使用其他调试器.