Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
7ac1c81f
Kaydet (Commit)
7ac1c81f
authored
Ock 16, 1992
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added 'r(et)v(al) command.
Added pdd (post-mortem debugging) method to class Pdb.
üst
6fe08b0f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
22 deletions
+50
-22
pdb.py
Lib/pdb.py
+50
-22
No files found.
Lib/pdb.py
Dosyayı görüntüle @
7ac1c81f
...
@@ -33,6 +33,7 @@ class Pdb(Cmd):
...
@@ -33,6 +33,7 @@ class Pdb(Cmd):
self
.
breaks
=
{}
self
.
breaks
=
{}
self
.
botframe
=
None
self
.
botframe
=
None
self
.
stopframe
=
None
self
.
stopframe
=
None
self
.
lastretval
=
None
self
.
forget
()
self
.
forget
()
def
forget
(
self
):
def
forget
(
self
):
...
@@ -41,20 +42,25 @@ class Pdb(Cmd):
...
@@ -41,20 +42,25 @@ class Pdb(Cmd):
def
setup
(
self
,
f
,
t
):
def
setup
(
self
,
f
,
t
):
self
.
lineno
=
None
self
.
lineno
=
None
self
.
stack
=
[]
self
.
stack
=
[]
self
.
curindex
=
0
self
.
curframe
=
None
if
f
is
None
and
t
is
None
:
return
if
t
and
t
.
tb_frame
is
f
:
if
t
and
t
.
tb_frame
is
f
:
t
=
t
.
tb_next
t
=
t
.
tb_next
while
f
and
f
is
not
self
.
botfram
e
:
while
f
is
not
Non
e
:
self
.
stack
.
append
((
f
,
f
.
f_lineno
))
self
.
stack
.
append
((
f
,
f
.
f_lineno
))
if
f
is
self
.
botframe
:
break
f
=
f
.
f_back
f
=
f
.
f_back
else
:
print
'[Weird: bottom frame not in stack trace.]'
self
.
stack
.
reverse
()
self
.
stack
.
reverse
()
self
.
curindex
=
max
(
0
,
len
(
self
.
stack
)
-
1
)
self
.
curindex
=
max
(
0
,
len
(
self
.
stack
)
-
1
)
while
t
:
while
t
is
not
None
:
self
.
stack
.
append
((
t
.
tb_frame
,
t
.
tb_lineno
))
self
.
stack
.
append
((
t
.
tb_frame
,
t
.
tb_lineno
))
t
=
t
.
tb_next
t
=
t
.
tb_next
if
0
<=
self
.
curindex
<
len
(
self
.
stack
):
self
.
curframe
=
self
.
stack
[
self
.
curindex
][
0
]
self
.
curframe
=
self
.
stack
[
self
.
curindex
][
0
]
else
:
self
.
curframe
=
None
def
run
(
self
,
cmd
):
def
run
(
self
,
cmd
):
import
__main__
import
__main__
...
@@ -62,23 +68,38 @@ class Pdb(Cmd):
...
@@ -62,23 +68,38 @@ class Pdb(Cmd):
self
.
runctx
(
cmd
,
dict
,
dict
)
self
.
runctx
(
cmd
,
dict
,
dict
)
def
runctx
(
self
,
cmd
,
globals
,
locals
):
def
runctx
(
self
,
cmd
,
globals
,
locals
):
t
=
None
self
.
reset
()
self
.
reset
()
sys
.
trace
=
self
.
dispatch
sys
.
trace
=
self
.
dispatch
try
:
try
:
exec
(
cmd
+
'
\n
'
,
globals
,
locals
)
exec
(
cmd
+
'
\n
'
,
globals
,
locals
)
except
PdbQuit
:
except
PdbQuit
:
pass
return
except
:
except
:
print
'***'
,
sys
.
exc_type
+
':'
,
`sys.exc_value`
print
'***'
,
sys
.
exc_type
+
':'
,
`sys.exc_value`
print
'*** Post Mortem Debugging:'
t
=
sys
.
exc_traceback
sys
.
trace
=
None
finally
:
del
sys
.
trace
self
.
trace
=
None
try
:
del
self
.
trace
self
.
ask_user
(
None
,
sys
.
exc_traceback
)
self
.
forget
()
except
PdbQuit
:
print
'!!! Post-mortem debugging'
pass
self
.
pmd
(
t
)
def
pmd
(
self
,
traceback
):
t
=
traceback
if
self
.
botframe
is
not
None
:
while
t
is
not
None
:
if
t
.
tb_frame
is
not
self
.
botframe
:
break
t
=
t
.
tb_next
else
:
t
=
sys
.
exc_traceback
try
:
self
.
ask_user
(
self
.
botframe
,
t
)
except
PdbQuit
:
pass
finally
:
finally
:
self
.
res
et
()
self
.
forg
et
()
def
dispatch
(
self
,
frame
,
event
,
arg
):
def
dispatch
(
self
,
frame
,
event
,
arg
):
if
self
.
quitting
:
if
self
.
quitting
:
...
@@ -101,21 +122,24 @@ class Pdb(Cmd):
...
@@ -101,21 +122,24 @@ class Pdb(Cmd):
def
dispatch_call
(
self
,
frame
,
arg
):
def
dispatch_call
(
self
,
frame
,
arg
):
if
self
.
botframe
is
None
:
if
self
.
botframe
is
None
:
# First call dispatch since reset()
self
.
botframe
=
frame
self
.
botframe
=
frame
return
return
None
if
not
(
self
.
stop_here
(
frame
)
or
self
.
break_anywhere
(
frame
)):
if
not
(
self
.
stop_here
(
frame
)
or
self
.
break_anywhere
(
frame
)):
return
return
None
frame
.
f_locals
[
'__args__'
]
=
arg
if
arg
is
None
:
print
'[Entering non-function block.]'
else
:
frame
.
f_locals
[
'__args__'
]
=
arg
return
self
.
dispatch
return
self
.
dispatch
def
dispatch_return
(
self
,
frame
,
arg
):
def
dispatch_return
(
self
,
frame
,
arg
):
if
self
.
stop_here
(
frame
):
self
.
lastretval
=
arg
print
'!!! return'
,
`arg`
return
None
return
def
dispatch_exception
(
self
,
frame
,
arg
):
def
dispatch_exception
(
self
,
frame
,
arg
):
if
self
.
stop_here
(
frame
):
if
self
.
stop_here
(
frame
):
print
'!!!
exception
'
,
arg
[
0
]
+
':'
,
`arg[1]`
print
'!!!'
,
arg
[
0
]
+
':'
,
`arg[1]`
self
.
ask_user
(
frame
,
arg
[
2
])
self
.
ask_user
(
frame
,
arg
[
2
])
return
self
.
dispatch
return
self
.
dispatch
...
@@ -247,6 +271,10 @@ class Pdb(Cmd):
...
@@ -247,6 +271,10 @@ class Pdb(Cmd):
return
1
return
1
do_r
=
do_return
do_r
=
do_return
def
do_retval
(
self
,
arg
):
print
self
.
lastretval
do_rv
=
do_retval
def
do_continue
(
self
,
arg
):
def
do_continue
(
self
,
arg
):
self
.
stopframe
=
self
.
botframe
self
.
stopframe
=
self
.
botframe
return
1
return
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment