python - 在 pdb 中,如何重置列表 (l) 命令行计数?

标签 python pdb

来自 PDB

(Pdb) help l
l(ist) [first [,last]]
  List source code for the current file.
  Without arguments, list 11 lines around the current line
  or continue the previous listing.
  With one argument, list 11 lines starting at that line.
  With two arguments, list the given range;
  if the second argument is less than the first, it is a count.

“继续上一个listing”功能确实不错,但是怎么关掉呢?

最佳答案

晚了,但希望仍然有用。在 pdb 中,创建以下别名(您可以将其添加到 .pdbrc 文件中,使其始终可用):

alias ll u;;d;;l

然后每当你输入 ll 时,pdb 就会从当前位置开始列出。它通过向上堆栈然后向下堆栈来工作,这会将'l'重置为从当前位置显示。 (如果您位于堆栈跟踪的顶部,这将不起作用。)

关于python - 在 pdb 中,如何重置列表 (l) 命令行计数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1318676/

相关文章:

python - 如何根据pandas DataFrame中的说话者#将单词分组为句子

python - 在自定义 Django 表单字段中与 to_python 相反?

python - 为 Distutils list 模板使用 MANIFEST.in 以外的名称

python - Windows 上的 Celery + Django : debugging asynchronous tasks

python - 处理 python pdb flakiness re/stdout 的最佳方法?

python - 以某种方式使用 py.test 时,我可以使用 python 调试器进行调试吗?

python - 使用时间、日期、timedelta

python - 多重矩阵乘法

重定向 sys.stdout 时 Python PDB 交互模式中断

python - 发生异常后在最旧的堆栈帧中启动 python 调试器