码迷,mamicode.com
首页 > 数据库 > 详细

Python: PDB命令

时间:2016-11-11 17:33:47      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:上下文   lis   rgs   调用   condition   ext   down   返回   nbsp   

1. where(w) 找出当前代码运行位置

2. list(l) 显示当前代码的部分上下文

3. list <line number> 显示指定行的上下文

4. list <line number1, line number2> 显示指定开始行到结束行的代码

5. up(u) 返回上个调用点

6. down(d) 返回下个调用点

7. args(a) 显示当前所有变量

8. print(p) 打印表达式结果

9 ! 运行python命令,比如!test=‘hello‘ 将会把test变量的值改变为hello

10. pp 打印美化过的表达式结果

11. step 步进运行至下行代码(如果是调用函数,则运行至所调用函数的第一行)

12. next 运行至下行代码(如果是调用函数,会直接运行完此函数)

13. until 运行至当前代码端底部

14. return 运行至return代码处

15. break <line number> 运行时设置断点

16. continue 运行程序直至遇到下一个断点

17. break <file name:line number> 运行时设置另一个文件的断点

18. break 显示断点情况

19. disable <break number> 将指定的断点失效(但存在)

20. enable <break number> 将指定的断点生效

21. clear <break number> 删除断点

22. tbreak <line number> 运行时设置临时断点(运行一次后自动删除)

23. break <line number> <condition> 运行时设置断点,当满足condition条件时触发断点,ex: break 11 i > 10 表示在第11行代码处,当变量i大于10时,触发断点

24. condition <break number> <condition> 设置指定断点的触发条件

25. ignore <break number> <n> 忽略指定断点n次

26. command <break number> ... end 对指定断点编写脚本,当运行到该断点时自动执行

     ex:

command 1
print("debug i = ", i)
print("debug j = ", j)
print("debug k = ", k)
end

27. jump <line number> 跳转至指定程序行(如果是前行,则忽略中间行代码。如果是后退,状态重设为回退行状态)

28. run <arg...> 重新运行程序(断点设置不会丢失)

Python: PDB命令

标签:上下文   lis   rgs   调用   condition   ext   down   返回   nbsp   

原文地址:http://www.cnblogs.com/ilovewindy/p/6054923.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!