A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 易大帅 高级黑马   /  2017-3-20 07:11  /  2061 人查看  /  0 人回复  /   1 人收藏 转载请遵从CC协议 禁止商业使用本文

python断点调试pdb(lovejunelove)                       
                                                        运行上面的命令后进入以下界面,可以输入类似 gdb 的命令来改变程序的执行流程:
$ python -m pdb 程序名.py



命令用途
break 或 b设置断点
continue 或 c继续执行程序
list 或 l查看当前行的代码段
step 或 s进入函数
return 或 r执行代码直到从当前函数返回
exit 或 q中止并退出
next 或 n执行下一行
pp打印变量的值
help帮助


代码中引用pdb:
import pdb
以下是设置方法:
     |  set_break(self, filename, lineno, temporary=0, cond=None, funcname=None)
     |
     |  set_continue(self)
     |
     |  set_next(self, frame)
     |      Stop on the next line in or below the given frame.
     |
     |  set_quit(self)
     |
     |  set_return(self, frame)
     |      Stop when returning from the given frame.
     |
     |  set_step(self)
     |      Stop after one line of code.
     |
     |  set_trace(self, frame=None)
     |      Start debugging from `frame`.
     |
     |      If frame is not specified, debugging starts from caller's frame.
     |
     |  set_until(self, frame)
     |      Stop when the line with the line no greater than the current one is
     |      reached or when returning from current frame

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马