2009-03-02 95 views

回答

5

執行此操作的一種方法是別名您最喜愛的命令以運行命令,然後l。

例如

(Pdb) alias s step ;; l 
(Pdb) s 
> /usr/lib/python2.5/distutils/core.py(14)<module>() 
-> from types import * 
9  # This module should be kept compatible with Python 2.1. 
10  
11  __revision__ = "$Id: core.py 38672 2005-03-20 22:19:47Z fdrake $" 
12  
13  import sys, os 
14 -> from types import * 
15  
16  from distutils.debug import DEBUG 
17  from distutils.errors import * 
18  from distutils.util import grok_environment_error 
19  

在你的〜/ .pdbrc所以你每次有他們,你可以添加別名:

alias s step ;; l 
2

';;'允許分開命令

 

[[email protected] tmp]$ python t.py 
> /home/crchemist/tmp/t.py(7)() 
-> a() 
(Pdb) p a ;; l 
function a at 0xb7e96df4 
    2   b = 49 + 45 
    3   v = 'fff' 
    4   return v 
    5 
    6  import pdb; pdb.set_trace() 
    7 -> a() [EOF] 
(Pdb) s ;; l 
--Call-- 
> /home/crchemist/tmp/t.py(1)a() 
-> def a(): 
    1 -> def a(): 
    2   b = 49 + 45 
    3   v = 'fff' 
    4   return v 
    5 
    6  import pdb; pdb.set_trace() 
    7  a() [EOF] 
(Pdb) s ;; l 
> /home/crchemist/tmp/t.py(2)a() 
-> b = 49 + 45 
    1  def a(): 
    2 ->  b = 49 + 45 
    3   v = 'fff' 
    4   return v 
    5 
    6  import pdb; pdb.set_trace() 
    7  a() [EOF] 
(Pdb) 
 
相關問題