如何在 pdb (python) 中使用 'debug' 命令
How to use the 'debug' command inside pdb (python)
我想知道如何在 pdb 中使用 debug
命令?
(Pdb) help
Documented commands (type help <topic>):
========================================
EOF c d h list q rv undisplay
a cl debug help ll quit s unt
alias clear disable ignore longlist r source until
args commands display interact n restart step up
b condition down j next return tbreak w
break cont enable jump p retval u whatis
bt continue exit l pp run unalias where
Miscellaneous help topics:
==========================
pdb exec
(Pdb) help debug
debug code
Enter a recursive debugger that steps through the code
argument (which is an arbitrary expression or statement to be
executed in the current environment).
(Pdb) debug print('hello')
ENTERING RECURSIVE DEBUGGER
> <string>(1)<module>()->None
((Pdb)) n
hello
--Return--
> <string>(1)<module>()->None
((Pdb)) n
LEAVING RECURSIVE DEBUGGER
(Pdb)
让,你有一堆代码。你把 pdb,说第 3 行。
在这种情况下,当您 运行 程序时,第 1 行和第 2 行会自动执行,您可以通过输入变量名来查看结果,而第 4 行不会执行。
如果你想在第 3 行之后看到结果,你必须编写你想看到的结果的代码,或者你可以使用 n
进入下一行,c
继续这意味着退出调试模式。
这个问题让我困惑多年。我总是忘记搜索最终答案。但是今天我明白了,并在这里分享我的发现。
How can I debug manually typed expression and statements in pdb?
当你第一次进入递归调试模式时,输入s
,你就会知道接下来要做什么。
我想知道如何在 pdb 中使用 debug
命令?
(Pdb) help
Documented commands (type help <topic>):
========================================
EOF c d h list q rv undisplay
a cl debug help ll quit s unt
alias clear disable ignore longlist r source until
args commands display interact n restart step up
b condition down j next return tbreak w
break cont enable jump p retval u whatis
bt continue exit l pp run unalias where
Miscellaneous help topics:
==========================
pdb exec
(Pdb) help debug
debug code
Enter a recursive debugger that steps through the code
argument (which is an arbitrary expression or statement to be
executed in the current environment).
(Pdb) debug print('hello')
ENTERING RECURSIVE DEBUGGER
> <string>(1)<module>()->None
((Pdb)) n
hello
--Return--
> <string>(1)<module>()->None
((Pdb)) n
LEAVING RECURSIVE DEBUGGER
(Pdb)
让,你有一堆代码。你把 pdb,说第 3 行。
在这种情况下,当您 运行 程序时,第 1 行和第 2 行会自动执行,您可以通过输入变量名来查看结果,而第 4 行不会执行。
如果你想在第 3 行之后看到结果,你必须编写你想看到的结果的代码,或者你可以使用 n
进入下一行,c
继续这意味着退出调试模式。
这个问题让我困惑多年。我总是忘记搜索最终答案。但是今天我明白了,并在这里分享我的发现。
How can I debug manually typed expression and statements in pdb?
当你第一次进入递归调试模式时,输入s
,你就会知道接下来要做什么。