python - How do you permenantly set number of lines shown in pdb? -
I show the l
during run time to show more lines before and after the existing row Can be executed in PDB, but can we do it permanently in a script or by command line option?
ywong: tmp ywong $ python tests.py & gt; /private/tmp/tests.py (23) & lt; Module & gt; () - & gt; Unittest.main (PDB) L18 self.assertEqual (1,1) 19 20 If __name__ == "__main__": 21 import pdb 22 pdb.set_trace () 23 - & gt; Unittest.main (# 24) # unittest.main (testRunner = MyRunner) [EOF] (PDB)
You can set yourself a function which creates a custom debuger by pdb.pdb
instantiating the object and executing the list apply
pdb < / Code> Interactive Prompt
In this way you can create custom debugger invocation function:
import pdb, cs def auto_list_debug (): create an example of # PDB class my_pdb = Pdb.Pdb () my_pdb.reset () #interactive quick My_pdb.cmdqueue.append ('l') # execute your list command before executing an interactive quick call with the current frame my_pdb.interaction (sys._getframe () .f_back, none)
< P> >>
Comments
Post a Comment