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
8e84c656
Kaydet (Commit)
8e84c656
authored
Mar 13, 2007
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
üst
c3a64319
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
3 deletions
+49
-3
libpdb.tex
Doc/lib/libpdb.tex
+8
-0
pdb.doc
Lib/pdb.doc
+6
-0
pdb.py
Lib/pdb.py
+32
-3
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/lib/libpdb.tex
Dosyayı görüntüle @
8e84c656
...
@@ -378,6 +378,14 @@ command with a \samp{global} command on the same line, e.g.:
...
@@ -378,6 +378,14 @@ command with a \samp{global} command on the same line, e.g.:
(Pdb)
(Pdb)
\end{verbatim}
\end{verbatim}
\item
[run \optional{\var{args} ...}]
Restart the debugged python program. If an argument is supplied, it is
splitted with "shlex" and the result is used as the new sys.argv.
History, breakpoints, actions and debugger options are preserved.
"restart" is an alias for "run".
\versionadded
{
2.6
}
\item
[q(uit)]
\item
[q(uit)]
Quit from the debugger.
Quit from the debugger.
...
...
Lib/pdb.doc
Dosyayı görüntüle @
8e84c656
...
@@ -131,6 +131,12 @@ n(ext)
...
@@ -131,6 +131,12 @@ n(ext)
r(eturn)
r(eturn)
Continue execution until the current function returns.
Continue execution until the current function returns.
run [args...]
Restart the debugged python program. If a string is supplied it is
splitted with "shlex", and the result is used as the new sys.argv.
History, breakpoints, actions and debugger options are preserved.
"restart" is an alias for "run".
c(ont(inue))
c(ont(inue))
Continue execution, only stop when a breakpoint is encountered.
Continue execution, only stop when a breakpoint is encountered.
...
...
Lib/pdb.py
Dosyayı görüntüle @
8e84c656
...
@@ -13,6 +13,12 @@ import os
...
@@ -13,6 +13,12 @@ import os
import
re
import
re
import
pprint
import
pprint
import
traceback
import
traceback
class
Restart
(
Exception
):
"""Causes a debugger to be restarted for the debugged python program."""
pass
# Create a custom safe Repr instance and increase its maxstring.
# Create a custom safe Repr instance and increase its maxstring.
# The default of 30 truncates error messages too easily.
# The default of 30 truncates error messages too easily.
_repr
=
Repr
()
_repr
=
Repr
()
...
@@ -608,6 +614,18 @@ class Pdb(bdb.Bdb, cmd.Cmd):
...
@@ -608,6 +614,18 @@ class Pdb(bdb.Bdb, cmd.Cmd):
return
1
return
1
do_n
=
do_next
do_n
=
do_next
def
do_run
(
self
,
arg
):
"""Restart program by raising an exception to be caught in the main debugger
loop. If arguments were given, set them in sys.argv."""
if
arg
:
import
shlex
argv0
=
sys
.
argv
[
0
:
1
]
sys
.
argv
=
shlex
.
split
(
arg
)
sys
.
argv
[:
0
]
=
argv0
raise
Restart
do_restart
=
do_run
def
do_return
(
self
,
arg
):
def
do_return
(
self
,
arg
):
self
.
set_return
(
self
.
curframe
)
self
.
set_return
(
self
.
curframe
)
return
1
return
1
...
@@ -1012,6 +1030,15 @@ command with a 'global' command, e.g.:
...
@@ -1012,6 +1030,15 @@ command with a 'global' command, e.g.:
(Pdb) global list_options; list_options = ['-l']
(Pdb) global list_options; list_options = ['-l']
(Pdb)"""
(Pdb)"""
def
help_run
(
self
):
print
"""run [args...]
Restart the debugged python program. If a string is supplied, it is
splitted with "shlex" and the result is used as the new sys.argv.
History, breakpoints, actions and debugger options are preserved.
"restart" is an alias for "run"."""
help_restart
=
help_run
def
help_quit
(
self
):
def
help_quit
(
self
):
self
.
help_q
()
self
.
help_q
()
...
@@ -1204,9 +1231,8 @@ def main():
...
@@ -1204,9 +1231,8 @@ def main():
# Note on saving/restoring sys.argv: it's a good idea when sys.argv was
# Note on saving/restoring sys.argv: it's a good idea when sys.argv was
# modified by the script being debugged. It's a bad idea when it was
# modified by the script being debugged. It's a bad idea when it was
# changed by the user from the command line. The best approach would be to
# changed by the user from the command line. There is a "restart" command which
# have a "restart" command which would allow explicit specification of
# allows explicit specification of command line arguments.
# command line arguments.
pdb
=
Pdb
()
pdb
=
Pdb
()
while
1
:
while
1
:
try
:
try
:
...
@@ -1214,6 +1240,9 @@ def main():
...
@@ -1214,6 +1240,9 @@ def main():
if
pdb
.
_user_requested_quit
:
if
pdb
.
_user_requested_quit
:
break
break
print
"The program finished and will be restarted"
print
"The program finished and will be restarted"
except
Restart
:
print
"Restarting"
,
mainpyfile
,
"with arguments:"
print
"
\t
"
+
" "
.
join
(
sys
.
argv
[
1
:])
except
SystemExit
:
except
SystemExit
:
# In most cases SystemExit does not warrant a post-mortem session.
# In most cases SystemExit does not warrant a post-mortem session.
print
"The program exited via sys.exit(). Exit status: "
,
print
"The program exited via sys.exit(). Exit status: "
,
...
...
Misc/NEWS
Dosyayı görüntüle @
8e84c656
...
@@ -170,6 +170,9 @@ Core and builtins
...
@@ -170,6 +170,9 @@ Core and builtins
Library
Library
-------
-------
- Patch #1393667: pdb now has a "run" command which restarts the debugged
Python program, optionally with different arguments.
- Patch #1649190: Adding support for _Bool to ctypes as c_bool.
- Patch #1649190: Adding support for _Bool to ctypes as c_bool.
- Patch #1530482: add pydoc.render_doc() which returns the documentation
- Patch #1530482: add pydoc.render_doc() which returns the documentation
...
...
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