public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "aburgess at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug cli/28833] Ctrl-D distorts GDB prompt
Date: Tue, 15 Feb 2022 14:01:53 +0000	[thread overview]
Message-ID: <bug-28833-4717-ZcmXQ65aZm@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28833-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=28833

--- Comment #7 from Andrew Burgess <aburgess at redhat dot com> ---
Indeed.  The problem seems to be that we are not correctly using readline's
callback interface.

In event-top.c:command_line_handler, we print "quit\n" when the 'cmd' variable
is EOF.  This happens when the incoming rl is nullptr.

This is what tries to print the 'quit' on the same line as the prompt, when the
user presses ctrl-d.

If we look at the readline manual, they have an example of using the callback
interface:

  https://tiswww.case.edu/php/chet/readline/readline.html#SEC43

In here, we see, in cb_linehandler, that when the incoming line is nullptr,
they explicitly print a `\n` character.  This isn't an arbitrary choice made
for this example, this is required, as, after seeing the ctrl-d readline emits
the BRACK_PASTE_FINI, which includes the '\r'.  Failing to move to the new line
will lead to any further output overwriting the prompt.

I'm currently trying to figure out if there's a better place where we can print
the 'quit' to work around this problem.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-02-15 14:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28  9:32 [Bug cli/28833] New: " tankut.baris.aktemur at intel dot com
2022-01-28  9:34 ` [Bug cli/28833] " tankut.baris.aktemur at intel dot com
2022-01-28  9:36 ` tankut.baris.aktemur at intel dot com
2022-01-28 16:07 ` tromey at sourceware dot org
2022-02-06 12:14 ` aburgess at redhat dot com
2022-02-07 10:28 ` tankut.baris.aktemur at intel dot com
2022-02-08 10:15 ` aburgess at redhat dot com
2022-02-14 12:14 ` blarsen at redhat dot com
2022-02-15 11:48 ` aburgess at redhat dot com
2022-02-15 12:34 ` schwab@linux-m68k.org
2022-02-15 14:01 ` aburgess at redhat dot com [this message]
2022-02-16 17:06 ` aburgess at redhat dot com
2022-02-17  7:01 ` tankut.baris.aktemur at intel dot com
2022-02-27 11:21 ` brobecker at gnat dot com
2022-03-06 10:05 ` brobecker at gnat dot com
2022-03-07 15:14 ` aburgess at redhat dot com
2022-03-16 20:44 ` cvs-commit at gcc dot gnu.org
2022-04-22 17:51 ` cvs-commit at gcc dot gnu.org
2022-04-22 17:51 ` cvs-commit at gcc dot gnu.org
2022-04-22 17:51 ` cvs-commit at gcc dot gnu.org
2022-04-22 17:53 ` aburgess at redhat dot com

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=bug-28833-4717-ZcmXQ65aZm@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).