黑马程序员技术交流社区

标题: python断点调试pdb [打印本页]

作者: 易大帅    时间: 2017-3-20 07:11
标题: python断点调试pdb
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






欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2