zoukankan      html  css  js  c++  java
  • python--pdb

    pdb 常用命令

    命令             解释
    
    break 或 b 设置断点       设置断点
    
    continue 或 c        继续执行程序
    
    list 或 l           查看当前行的代码段
    
    step 或 s          进入函数
    
    return 或 r           执行代码直到从当前函数返回
    
    exit 或 q           中止并退出
    
    next 或 n          执行下一行 pp 打印变量的值
    
    help            帮助
    (Pdb) s
    --Call--
    > c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py(3)pdb_test()
    -> def pdb_test(arg):
    (Pdb) l
      1   import pdb
      2   
      3  -> def pdb_test(arg):
      4       pdb.set_trace()
      5       for i in range(arg):
      6           print(i)
      7       return arg
    [EOF]
    (Pdb) b 6
    Breakpoint 1 at c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py:6
    (Pdb) b 3
    Breakpoint 2 at c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py:3
    (Pdb) b
    Num Type         Disp Enb   Where
    1   breakpoint   keep yes   at c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py:6
    2   breakpoint   keep yes   at c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py:3
    (Pdb) c
    > c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py(5)pdb_test()
    -> for i in range(arg):
    (Pdb) l
      1   import pdb
      2   
      3   def pdb_test(arg):
      4       pdb.set_trace()
      5  ->     for i in range(arg):
      6           print(i)
      7       return arg
    [EOF]
    (Pdb) n
    > c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py(6)pdb_test()
    -> print(i)
    (Pdb) 
    0
    > c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py(5)pdb_test()
    -> for i in range(arg):
    (Pdb) 
    *** SyntaxError: invalid syntax (<stdin>, line 1)
    (Pdb) 
    *** SyntaxError: invalid syntax (<stdin>, line 1)
    (Pdb) n
    > c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py(6)pdb_test()
    -> print(i)
    (Pdb) 
    1
    > c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py(5)pdb_test()
    -> for i in range(arg):
    (Pdb) n
    > c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py(6)pdb_test()
    -> print(i)
    (Pdb) 
    2
    > c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py(5)pdb_test()
    -> for i in range(arg):
    (Pdb) l
      1   import pdb
      2   
      3   def pdb_test(arg):
      4       pdb.set_trace()
      5  ->     for i in range(arg):
      6           print(i)
      7       return arg
    [EOF]
    (Pdb) a
    arg = 5
    (Pdb) p i
    2
    (Pdb) s
    > c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py(6)pdb_test()
    -> print(i)
    (Pdb) b
    (Pdb) l
      1   import pdb
      2   
      3   def pdb_test(arg):
      4       pdb.set_trace()
      5       for i in range(arg):
      6  ->         print(i)
      7       return arg
    [EOF]
    (Pdb) b 5
    Breakpoint 3 at c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py:5
    (Pdb) condition 2 i==3
    (Pdb) b
    Num Type         Disp Enb   Where
    1   breakpoint   keep yes   at c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py:6
    2   breakpoint   keep yes   at c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py:3
     stop only if i==3
    3   breakpoint   keep yes   at c:userswuchan4xdesktopeilingeunit_tests_dumppbd_test02.py:5
    (Pdb) a
    arg = 5
  • 相关阅读:
    在线编辑Office文件
    将自然数分解为若干连续的自然数
    C#远程连接Oracle数据库(不安装客户端)
    大数阶乘
    小写金额转换为大写金额
    SQL优化
    C#枚举器:foreach语句、IEnumerable、IEnumerator以及yield return (二)
    C#枚举器:foreach语句、IEnumerable、IEnumerator以及yield return (一)
    PPT播完最后一个动画后自动进入下一页
    C#中的abstract、virtual、override和new
  • 原文地址:https://www.cnblogs.com/eilinge/p/9239143.html
Copyright © 2011-2022 走看看