python - pdb:如何显示当前行,而不是在上一个列表之后继续?

标签 python python-2.7 pdb

当使用 pdb 调试 python 脚本时,重复 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 around at that line. With two arguments, list the given range; if the second argument is less than the first, it is interpreted as a count.

如何重复显示当前行(即程序运行暂停的行),而不是在上一个列表之后继续显示?谢谢。

最佳答案

直接的方法当然是将该行作为参数传递给l

但是,如果不必费尽心思找到当前行并键入它,我通常这样做的非最佳方法是通过向上+向下导航调用堆栈返回到同一行,然后再次列出。命令序列为:u(向上)、d(向下)、l

关于python - pdb:如何显示当前行,而不是在上一个列表之后继续?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33696300/

相关文章:

python - 有没有办法禁用Python调试器的pdb库set_trace默认别名?

python - 使用 IPython 对象?在IP数据库中

python - 已安装 django-axes,但 axes.middleware 模块不可用

python - 行或行末尾的 '\' 会导致 split() 错误

python - 将 PIL 图像保存到 4D Numpy 数组时显示的静态图像

python - 迭代每个文件夹中的 2 个文件并比较它们

python - Scrapy导入错误: cannot import name "______Item"

python - 如何访问数组?

python-2.7 - 从目录中读取图像并用空格分隔 python 传递每个图像

c++ - 如何使用调试符号构建 openssl? [添加 libeay.pdb]