2
在Python中,有没有一种方法可以在使用PDB进行调试时显示线程/进程ID?如何在Python PDB中显示线程/进程ID?
我在看https://docs.python.org/2/library/pdb.html,但找不到与之相关的任何内容?
在Python中,有没有一种方法可以在使用PDB进行调试时显示线程/进程ID?如何在Python PDB中显示线程/进程ID?
我在看https://docs.python.org/2/library/pdb.html,但找不到与之相关的任何内容?
(pdb) import os,threading; os.getpid(), threading.current_thread().ident
如果你需要经常这样做,这将是方便你.pdbrc
文件中添加一个别名:
alias tid import os,threading;; p os.getpid(), threading.current_thread().ident
谢谢。有效。 – Hem
@激动,很酷。请参阅我添加的关于定义别名的建议。 – shx2
我不知道pdbrc。谢谢你的奖金小费。 – Hem