* Document how to exit "python-interactive"
@ 2012-08-23 16:29 Khoo Yit Phang
2012-08-23 16:47 ` Eli Zaretskii
2012-08-23 17:20 ` Pedro Alves
0 siblings, 2 replies; 9+ messages in thread
From: Khoo Yit Phang @ 2012-08-23 16:29 UTC (permalink / raw)
To: gdb-patches; +Cc: Khoo Yit Phang
[-- Attachment #1: Type: text/plain, Size: 141 bytes --]
Hi,
I'd like to update the documentation to explain how to return from "python-interactive" to GDB.
Thanks!
Yit
August 23, 2012
[-- Attachment #2: python-interactive-exit.txt --]
[-- Type: text/plain, Size: 1445 bytes --]
# HG changeset patch
# Parent 3a8ab84de40f6a3b09615bd9f9acef671062c85c
Document how to return from "python-interactive" to GDB.
gdb/ChangeLog:
2012-08-23 Khoo Yit Phang <khooyp@cs.umd.edu>
Document how to return from "python-interactive" to GDB.
* doc/gdb.texinfo (Python Commands): Update documentation.
* python/python.c (_initialize_python): Update documentation.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22515,7 +22515,8 @@
@item python-interactive @r{[}@var{command}@r{]}
@itemx pi @r{[}@var{command}@r{]}
Without an argument, the @code{python-interactive} command can be used
-to start an interactive Python prompt.
+to start an interactive Python prompt. To return to @value{GDBN},
+type @code{EOF} (e.g., @samp{Ctrl-D}) on an empty prompt.
Alternatively, a single-line Python command can be given as an
argument and evaluated. If the command is an expression, the result
diff --git a/gdb/python/python.c b/gdb/python/python.c
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1277,7 +1277,8 @@
python_interactive_command,
#ifdef HAVE_PYTHON
_("\
-Start a Python interactive prompt.\n\
+Start a Python interactive prompt. To return to GDB, type EOF\n\
+(e.g., Ctrl-D) on an empty prompt.\n\
\n\
Alternatively, a single-line Python command can be given as an\n\
argument, and if the command is an expression, the result will be\n\
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Document how to exit "python-interactive"
2012-08-23 16:29 Document how to exit "python-interactive" Khoo Yit Phang
@ 2012-08-23 16:47 ` Eli Zaretskii
2012-08-23 17:02 ` Khoo Yit Phang
2012-08-23 17:20 ` Pedro Alves
1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2012-08-23 16:47 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: gdb-patches, khooyp
> From: Khoo Yit Phang <khooyp@cs.umd.edu>
> Date: Thu, 23 Aug 2012 12:29:17 -0400
> Cc: Khoo Yit Phang <khooyp@cs.umd.edu>
>
> I'd like to update the documentation to explain how to return from "python-interactive" to GDB.
Thanks.
>
> Thanks!
>
> Yit
> August 23, 2012
>
>
> [2:text/plain Hide Save:python-interactive-exit.txt (1kB)]
>
> # HG changeset patch
> # Parent 3a8ab84de40f6a3b09615bd9f9acef671062c85c
> Document how to return from "python-interactive" to GDB.
>
> gdb/ChangeLog:
>
> 2012-08-23 Khoo Yit Phang <khooyp@cs.umd.edu>
>
> Document how to return from "python-interactive" to GDB.
> * doc/gdb.texinfo (Python Commands): Update documentation.
> * python/python.c (_initialize_python): Update documentation.
>
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -22515,7 +22515,8 @@
> @item python-interactive @r{[}@var{command}@r{]}
> @itemx pi @r{[}@var{command}@r{]}
> Without an argument, the @code{python-interactive} command can be used
> -to start an interactive Python prompt.
> +to start an interactive Python prompt. To return to @value{GDBN},
> +type @code{EOF} (e.g., @samp{Ctrl-D}) on an empty prompt.
I think "type the @code{EOF} character" is better.
Also, please use @kbd{Ctrl-D}. Finally, I think "on the empty prompt"
is redundant (and may even be incorrect -- doesn't it work even on a
non-empty line?).
> python_interactive_command,
> #ifdef HAVE_PYTHON
> _("\
> -Start a Python interactive prompt.\n\
> +Start a Python interactive prompt. To return to GDB, type EOF\n\
I think the second sentence should begin on a new line. Don't you get
that line truncated in "apropos" output?
OK with those changes.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Document how to exit "python-interactive"
2012-08-23 16:47 ` Eli Zaretskii
@ 2012-08-23 17:02 ` Khoo Yit Phang
2012-08-23 17:47 ` Khoo Yit Phang
0 siblings, 1 reply; 9+ messages in thread
From: Khoo Yit Phang @ 2012-08-23 17:02 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Khoo Yit Phang, gdb-patches
Hi,
On Aug 23, 2012, at 12:47 PM, Eli Zaretskii wrote:
>> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
>> --- a/gdb/doc/gdb.texinfo
>> +++ b/gdb/doc/gdb.texinfo
>> @@ -22515,7 +22515,8 @@
>> @item python-interactive @r{[}@var{command}@r{]}
>> @itemx pi @r{[}@var{command}@r{]}
>> Without an argument, the @code{python-interactive} command can be used
>> -to start an interactive Python prompt.
>> +to start an interactive Python prompt. To return to @value{GDBN},
>> +type @code{EOF} (e.g., @samp{Ctrl-D}) on an empty prompt.
>
> I think "type the @code{EOF} character" is better.
>
> Also, please use @kbd{Ctrl-D}. Finally, I think "on the empty prompt"
> is redundant (and may even be incorrect -- doesn't it work even on a
> non-empty line?).
Ctrl-D must be on an empty line to signal EOF, at least on Linux and probably other Unix systems. On Windows, EOF is supposed to be Ctrl-Z followed by enter, but I don't know if it needs to be on an empty line. I'll move the "on an empty prompt" into the parentheses to be more accurate.
>> python_interactive_command,
>> #ifdef HAVE_PYTHON
>> _("\
>> -Start a Python interactive prompt.\n\
>> +Start a Python interactive prompt. To return to GDB, type EOF\n\
>
> I think the second sentence should begin on a new line. Don't you get
> that line truncated in "apropos" output?
I hadn't known about "apropos", but the help prints fine since "apropos" appears to print only up to the first period. I'll leave it as is.
If it sounds good, I'll make the changes and check it in.
Thanks!
Yit
August 23, 2012
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Document how to exit "python-interactive"
2012-08-23 16:29 Document how to exit "python-interactive" Khoo Yit Phang
2012-08-23 16:47 ` Eli Zaretskii
@ 2012-08-23 17:20 ` Pedro Alves
2012-08-23 17:39 ` Khoo Yit Phang
1 sibling, 1 reply; 9+ messages in thread
From: Pedro Alves @ 2012-08-23 17:20 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: gdb-patches
On 08/23/2012 05:29 PM, Khoo Yit Phang wrote:
> Hi,
>
> I'd like to update the documentation to explain how to return from "python-interactive" to GDB.
Is it possible to add a convenience python function to the gdb module to exits python-interactive?
ctrl-d also exits gdb when typed at gdb's prompt. So if you type one c-d too much,
you'll quit gdb by mistake (unless you're debugging a program, in which case
gdb at least confirms).
(Related, I set this on my .bashrc , because of hitting ^D at the wrong shell
too many times:
# Don't use ^D to exit
set -o ignoreeof
)
--
Pedro Alves
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Document how to exit "python-interactive"
2012-08-23 17:20 ` Pedro Alves
@ 2012-08-23 17:39 ` Khoo Yit Phang
2012-08-23 17:55 ` Pedro Alves
0 siblings, 1 reply; 9+ messages in thread
From: Khoo Yit Phang @ 2012-08-23 17:39 UTC (permalink / raw)
To: Pedro Alves; +Cc: Khoo Yit Phang, gdb-patches
Hi,
On Aug 23, 2012, at 1:20 PM, Pedro Alves wrote:
> On 08/23/2012 05:29 PM, Khoo Yit Phang wrote:
>> Hi,
>>
>> I'd like to update the documentation to explain how to return from "python-interactive" to GDB.
>
> Is it possible to add a convenience python function to the gdb module to exits python-interactive?
Yes, I can redefine "exit" and "quit" interpreter built-ins to return to GDB, rather than exiting GDB (the latter is still possible via "sys.exit"). How does that sound?
Yit
August 23, 2012
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Document how to exit "python-interactive"
2012-08-23 17:02 ` Khoo Yit Phang
@ 2012-08-23 17:47 ` Khoo Yit Phang
2012-08-23 18:04 ` Eli Zaretskii
0 siblings, 1 reply; 9+ messages in thread
From: Khoo Yit Phang @ 2012-08-23 17:47 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: Eli Zaretskii, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 201 bytes --]
Hi,
Here's the updated patch. I made one other minor change from "Python interactive prompt" to "interactive Python prompt" for consistency. Does it look good?
Thanks!
Yit
August 23, 2012
[-- Attachment #2: python-interactive-exit.txt --]
[-- Type: text/plain, Size: 1473 bytes --]
# HG changeset patch
# Parent 3a8ab84de40f6a3b09615bd9f9acef671062c85c
Document how to return from "python-interactive" to GDB.
gdb/ChangeLog:
2012-08-23 Khoo Yit Phang <khooyp@cs.umd.edu>
Document how to return from "python-interactive" to GDB.
* doc/gdb.texinfo (Python Commands): Update documentation.
* python/python.c (_initialize_python): Update documentation.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22515,7 +22515,8 @@
@item python-interactive @r{[}@var{command}@r{]}
@itemx pi @r{[}@var{command}@r{]}
Without an argument, the @code{python-interactive} command can be used
-to start an interactive Python prompt.
+to start an interactive Python prompt. To return to @value{GDBN},
+type the @code{EOF} character (e.g., @kbd{Ctrl-D} on an empty prompt).
Alternatively, a single-line Python command can be given as an
argument and evaluated. If the command is an expression, the result
diff --git a/gdb/python/python.c b/gdb/python/python.c
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1277,7 +1277,8 @@
python_interactive_command,
#ifdef HAVE_PYTHON
_("\
-Start a Python interactive prompt.\n\
+Start an interactive Python prompt. To return to GDB, type the EOF\n\
+character (e.g., Ctrl-D on an empty prompt).\n\
\n\
Alternatively, a single-line Python command can be given as an\n\
argument, and if the command is an expression, the result will be\n\
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Document how to exit "python-interactive"
2012-08-23 17:39 ` Khoo Yit Phang
@ 2012-08-23 17:55 ` Pedro Alves
0 siblings, 0 replies; 9+ messages in thread
From: Pedro Alves @ 2012-08-23 17:55 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: gdb-patches
On 08/23/2012 06:38 PM, Khoo Yit Phang wrote:
> Hi,
>
> On Aug 23, 2012, at 1:20 PM, Pedro Alves wrote:
>
>> On 08/23/2012 05:29 PM, Khoo Yit Phang wrote:
>>> Hi,
>>>
>>> I'd like to update the documentation to explain how to return from "python-interactive" to GDB.
>>
>> Is it possible to add a convenience python function to the gdb module to exits python-interactive?
>
> Yes, I can redefine "exit" and "quit" interpreter built-ins to return to GDB, rather than exiting GDB (the latter is still possible via "sys.exit"). How does that sound?
Sounds great to me.
--
Pedro Alves
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Document how to exit "python-interactive"
2012-08-23 17:47 ` Khoo Yit Phang
@ 2012-08-23 18:04 ` Eli Zaretskii
2012-08-23 18:30 ` Khoo Yit Phang
0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2012-08-23 18:04 UTC (permalink / raw)
To: Khoo Yit Phang; +Cc: khooyp, gdb-patches
> From: Khoo Yit Phang <khooyp@cs.umd.edu>
> Date: Thu, 23 Aug 2012 13:47:35 -0400
> Cc: Eli Zaretskii <eliz@gnu.org>, gdb-patches@sourceware.org
>
> Here's the updated patch. I made one other minor change from "Python interactive prompt" to "interactive Python prompt" for consistency. Does it look good?
Almost.
> -Start a Python interactive prompt.\n\
> +Start an interactive Python prompt. To return to GDB, type the EOF\n\
> +character (e.g., Ctrl-D on an empty prompt).\n\
I still think the first line should have only one sentence. This is
how we write doc strings everywhere else.
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Document how to exit "python-interactive"
2012-08-23 18:04 ` Eli Zaretskii
@ 2012-08-23 18:30 ` Khoo Yit Phang
0 siblings, 0 replies; 9+ messages in thread
From: Khoo Yit Phang @ 2012-08-23 18:30 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Khoo Yit Phang, gdb-patches
Hi,
On Aug 23, 2012, at 2:04 PM, Eli Zaretskii wrote:
>> -Start a Python interactive prompt.\n\
>> +Start an interactive Python prompt. To return to GDB, type the EOF\n\
>> +character (e.g., Ctrl-D on an empty prompt).\n\
>
> I still think the first line should have only one sentence. This is
> how we write doc strings everywhere else.
Alright, I'll make the change and check it in.
Thanks!
Yit
August 23, 2012
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-08-23 18:30 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-23 16:29 Document how to exit "python-interactive" Khoo Yit Phang
2012-08-23 16:47 ` Eli Zaretskii
2012-08-23 17:02 ` Khoo Yit Phang
2012-08-23 17:47 ` Khoo Yit Phang
2012-08-23 18:04 ` Eli Zaretskii
2012-08-23 18:30 ` Khoo Yit Phang
2012-08-23 17:20 ` Pedro Alves
2012-08-23 17:39 ` Khoo Yit Phang
2012-08-23 17:55 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox