【问题标题】:Is it possible to skip breakpoints in pdb / ipdb?是否可以跳过 pdb / ipdb 中的断点?
【发布时间】:2016-09-07 13:46:05
【问题描述】:

有没有办法告诉 pdb 或 ipdb 跳过所有未来的断点并像它们不存在一样完成执行?

【问题讨论】:

标签: python pdb ipdb


【解决方案1】:

如果您想保留断点而不是清除它们,但又不想到达它们,您可以使用pdbdisable 命令。我看不到以简洁的方式禁用所有断点的便捷方法,但您可以在disable 命令中列出它们的编号。您也可以对此有所选择,并禁用一些断点并启用其他断点。您可以使用pdbs enable 命令撤消disable 命令的效果。不带参数的break 命令(或只是b)针对每个断点显示是否启用。

【讨论】:

    【解决方案2】:

    也许你可以试试 clear。

    来自帮助:

    (Pdb) help clear
    cl(ear) filename:lineno
    cl(ear) [bpnumber [bpnumber...]]
    With a space separated list of breakpoint numbers, clear
    those breakpoints.  Without argument, clear all breaks (but
    first ask confirmation).  With a filename:lineno argument,
    clear all breaks at that line in that file.
    
    Note that the argument is different from previous versions of
    the debugger (in python distributions 1.5.1 and before) where
    a linenumber was used instead of either filename:lineno or
    breakpoint numbers.
    

    还有一个话题讨论你的问题:How to exit pdb and allow program to continue?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-19
      相关资源
      最近更新 更多