Wie zu zeigen, die Ausgabe von 'l' in python pdb nach jedem eingegebenen Befehl
Frage
Ich möchte die Ausgabe von python pdb - 'l' Befehl gedruckt, auf dem Bildschirm nach jedem Befehl, den ich eingeben in einer interaktiven debugging-Sitzung.
Gibt es einen Weg, um das setup python pdb, dies zu tun?
Lösung
Ein Weg dies zu tun ist, um alias-Ihre Favoriten-Befehle, um den Befehl auszuführen und dann l.
z.B.
(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
In Ihrem ~/.pdbrc können Sie die Aliase, sodass Sie diese jedes mal:
alias s step ;; l
Andere Tipps
';;' ermöglichen, Befehle zu trennen
[crchemist@test 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)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow