From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 614263858D20; Tue, 15 Feb 2022 14:01:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 614263858D20 From: "aburgess at redhat dot com" To: gdb-prs@sourceware.org Subject: [Bug cli/28833] Ctrl-D distorts GDB prompt Date: Tue, 15 Feb 2022 14:01:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: cli X-Bugzilla-Version: 11.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: aburgess at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Feb 2022 14:01:53 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28833 --- Comment #7 from Andrew Burgess --- 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' varia= ble 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 callba= ck 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 em= its 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 p= rint the 'quit' to work around this problem. --=20 You are receiving this mail because: You are on the CC list for the bug.=