pdb

Python - start interactive debugger when exception would be otherwise thrown

自作多情 提交于 2019-12-02 23:02:07
Is there any way to make a python program start an interactive debugger, like what import pdb; pdb.set_trace() instead of actually throwing an exception? I know the difficulty of making this work, but it would be much more valuable than a huge stack trace after which I have to use to figure out where to insert breakpoints and then restart the program to debug it. I know that simply making the debugger start instead of throwing an exception would not make sense because any exception can be caught at a level or another, so if I could just select a list of exceptions for which an interactive

Python程序调试――pdb

匿名 (未验证) 提交于 2019-12-02 22:54:36
pdb的常用命令说明: 1)查看运行到哪行代码 l 2)单步运行,跳过函数 n 3)单步运行,可进入函数 s 4)查看变量值 p 变量 5)断点设置到第几行 b 行号 6)显示所有断点列表 b 7)删除某个断点 cl 断点号 8)删除所有断点 cl 9)跳到下一个断点 c 10)return当前函数 r 11)退出 exit 调试记录: 1.pdb设置断点 import pdb 在需要设置断点的地方加入pdb.set_trace() 2.执行 python3 -m pdb test.py 转载于:https://www.cnblogs.com/chinasun021/archive/2013/03/19/2969107.html 转载请标明出处: Python程序调试――pdb 文章来源: Python程序调试――pdb

ubuntu下命令行调试Python程序

匿名 (未验证) 提交于 2019-12-02 22:51:30
Python https://docs.python.org/2/library/pdb.html https://docs.python.org/3/library/pdb.html python -m pdb hello.py 删除断点:(Pdb) cl 2 #删除第2个断点 (clear的首字母) Run to Line:(Pdb) j 10 #运行到地10行,jump的首字母 (Pdb) a #查看全部栈内变量 (Pdb) q #退出,quit的首字母 来源:博客园 作者: damoguying 链接:https://www.cnblogs.com/puhongtao/p/11454568.html

python pdb调试

匿名 (未验证) 提交于 2019-12-02 22:51:30
原文链接: http://www.cnblogs.com/yansjhere/p/3789262.html python -m pdb myscript.py #注意这会重启myscript.py 可以在程序中这么设置断点: import pdb; pdb.set_trace() 可以修改变量的值,但是要注意,前面加上!比如要修改final的值,应该这样!final="newvalue" 支持的命令: 补充: 1.import sys 2.在需要设定breakpoints的地方,写下:pdb.set_trace() 转载于:https://www.cnblogs.com/yansjhere/p/3789262.html 文章来源: https://blog.csdn.net/weixin_30872733/article/details/96707410

理解 Oracle 多租户体系中(12c,18c,19c)创建用户作用域范围

一曲冷凌霜 提交于 2019-12-02 19:56:48
本篇探讨以下几个问题:你可提前猜测下面6个场景语句中,哪几个可以成功创建用户? 1. 在CDB级别中创建公共用户,不带 container 子句的效果; 2. 在CDB级别中创建公共用户,带 container=all 子句的效果; 3. 在CDB级别中创建公共用户,带 container=current 子句的效果; 4. 在PDB级别中创建本地用户,不带 container 子句的效果; 5. 在PDB级别中创建本地用户,带 container=all 子句的效果; 6. 在PDB级别中创建本地用户,带 container=current 子句的效果; 在理解上面问题之前,我们需要提前约定,就是需要提前知道: 1. CDB级别 创建的用户称为 公共用户 , PDB级别 创建的用户称为 本地用户 。 2. 公共用户命名规则对应参数 common_user_prefix ,该参数值默认为 C## 。所以,在CDB级别创建公共用户,需要带 C## (也可以更改参数值,但不建议)。 3. PDB$SEED 仅为种子容器,对应 CON_ID 为 2,只读模式,不参与讨论。 演示数据库版本:18.3.0.0.0(18c) 目录 1. CDB 不带 container 默认 2. CDB带 container=all 3. CDB带 container=current 4. PDB不带

Is it possible to step backwards in pdb?

一笑奈何 提交于 2019-12-02 17:51:50
After I hit n to evaluate a line, I want to go back and then hit s to step into that function if it failed. Is this possible? The docs say: j(ump) lineno Set the next line that will be executed. Only available in the bottom-most frame. This lets you jump back and execute code again, or jump forward to skip code that you don’t want to run. The GNU debugger, gdb: It is extremely slow, as it undoes single machine instruction at a time. The Python debugger, pdb: The jump command takes you backwards in the code, but does not reverse the state of the program. For Python, the extended python debugger

“Browse To Find Source” in Visual Studio 2010

大兔子大兔子 提交于 2019-12-02 17:09:26
When is "Browse To Find source" enabled in Visual Studio 2010? (see below) In addition, I want to have it enabled so that I could browse to already-downloaded source code files from http://referencesource.microsoft.com/ . This would be useful since Microsoft doesn't always release PDB /source code at the same time with their latest patches. So if I want to step for example into DateTime, I really don't care about the latest patches which didn't involve DateTime. I just want to browse to its code which I downloaded from http://referencesource.microsoft.com/ . After some investigations I found

Stepping into a function in IPython

你。 提交于 2019-12-02 17:04:36
Is there a way to step into the first line of a function in ipython. I imagine something that would look like: %step foo(1, 2) which runs ipdb and sets a breakpoint at the first line of foo . If I want to do this now I have to go to the function's source code and add an import ipdb; ipdb.set_trace() line. ipdb has had support for runcall, runeval and run since 0.7, earlier this year. You can use it just like pdb.runcall : In [1]: def foo(a, b): ...: print a + b ...: In [2]: import ipdb In [3]: ipdb.runcall(foo, 1, 2) > <ipython-input-1-2e565fd9c4a4>(2)foo() 1 def foo(a, b): ----> 2 print a + b

How do I manipulate a variable whose name conflicts with PDB commands?

无人久伴 提交于 2019-12-02 16:03:29
My code is, for better or worse, rife with single letter variables (it's physics stuff, so those letters are meaningful), as well as NumPy's, which I'm often interacting with. When using the Python debugger, occasionally I'll want to look at the value of, say, n . However, when I hit n<enter> , that's the PDB command for (n)ext , which has a higher priority. print n works around looking at it, but how can I set it? Abraham Use an exclamation mark ! before a statement to have it run : python -m pdb test.py > /home/user/test.py(1)<module>() -> print('foo') (Pdb) !n = 77 (Pdb) !n 77 (Pdb) n foo >