Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>, gdb-patches@sourceware.org
Subject: Re: Discrepancy between Python and Guile wrt exiting the interpreter
Date: Thu, 23 Jan 2020 17:21:00 -0000	[thread overview]
Message-ID: <9684975c-324f-b26b-de87-6d37c0d8d08a@redhat.com> (raw)
In-Reply-To: <83a76l10r6.fsf@gnu.org>

On 1/18/20 11:07 AM, Eli Zaretskii wrote:
> If you invoke the Guile interpreter from GDB:
> 
>   (gdb) gr
> 
> then typing ,q followed by Enter exits the Guile interpreter back to
> GDB.  However, if the Python interpreter is started:
> 
>   (gdb) pi
> 
> then typing quit() and Enter exits GDB, not just the Python
> interpreter.  Why do these two interpreters behave differently in this
> context?  Is there some other Python command to exit the interpreter?
> (I know about Ctrl-D, but I'm asking about commands.)
> 

Note that these commands are not direct equivalents.  The guile equivalent
to "pi" which is short for "python" would be "guile", or "gu", and with
that command you get the same behavior as "pi", in the sense that ",q"
doesn't bail you out, you have to type some command and finish with
either Ctrl-D or Ctrl-C to abort.

"gr" is an alias for "guile-repl", and with that command, it's the Guile
repl that implements the ",q", not GDB.  With the "python" and "guile"
commands, it's GDB that implements the secondary prompt handling and
command line reading (the ">", etc.).  Compare guile_repl_command and
guile_command.

I think that calling quit() in the Python interpreter ends up being the
the equivalent of doing:

 (gdb) guile
 > (primitive-exit)
 Ctrl-D

Thanks,
Pedro Alves


  parent reply	other threads:[~2020-01-23 17:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-18 14:46 Eli Zaretskii
2020-01-19 16:11 ` Simon Marchi
2020-01-19 16:42   ` Eli Zaretskii
2020-01-19 17:20     ` Simon Marchi
2020-01-19 19:13       ` Eli Zaretskii
2020-01-21 19:53         ` Tom Tromey
2020-01-21 19:57           ` Eli Zaretskii
2020-01-23 17:21 ` Pedro Alves [this message]
2020-01-23 17:37   ` Simon Marchi
2020-01-23 17:50     ` Pedro Alves
2020-01-23 17:39       ` Pedro Alves
2020-01-24 10:26         ` Eli Zaretskii
2020-01-23 18:20   ` Eli Zaretskii
2020-01-23 18:30     ` Pedro Alves
2020-01-23 18:46       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9684975c-324f-b26b-de87-6d37c0d8d08a@redhat.com \
    --to=palves@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox