From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 56E6F3857806 for ; Tue, 18 Jul 2023 11:36:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 56E6F3857806 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689680169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FNuhTO/EoDwe4x74iWT1a4Y9NL1kfKKo5jOa0nWlq9E=; b=TVE2Nh+zRJqDZdloY23hl69buUw0YrLNGeSoNi8laoov5dQuIjYYXjTzdcJSvzyFjZB7zX 1naIWQ8hgtmx3IoSqZg4Ktw+ZuIZMVrPDAPkeOaOV06CfaROjhTmbhWLD9wSM7XhQ/tMSN xjaIA6lKmh7kow9r0x7EkbUA14AUqGw= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-98-41B8-M-rNqWbSiZNPtaPjQ-1; Tue, 18 Jul 2023 07:36:08 -0400 X-MC-Unique: 41B8-M-rNqWbSiZNPtaPjQ-1 Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-345fe8d0a30so29106475ab.0 for ; Tue, 18 Jul 2023 04:36:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689680167; x=1690284967; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FNuhTO/EoDwe4x74iWT1a4Y9NL1kfKKo5jOa0nWlq9E=; b=XYC5IFvFaswHSmI6BR/jg4GVdKrNFj2K4m0nI/8eaiBpqEKlrubnhcGB9RMUBxxYKt +Oz4bgvvTuNiz9mxBG0fOIiU0s2WXa4qvM9LYtojsjJfnnsfmvx70SBw8EVnr1J3ZQfn nIU85HfW7nPFhPLCpI5veRe4ZqHkQoM60V5NFNMcD8BWc11HSCo8J9GITVea+bdEG9J+ 3XPPVO2CS9R11jqw31TWZl8fxVCDI0naEWjJzsH8BYYmT/VBYqLpEFBLhQ0VTTt+4sYw WMTIpP/PkRSJtbi1//pa5viCvQAP+0B9cg8p8rruLB7ug4vZdtnBna1rKylb4x+tTpVk 0qig== X-Gm-Message-State: ABy/qLZ09w4YfbGXubH32U8kILABiyUHD41rDjywHW0GVlYHVTuss0a9 GlyBLFgUxeOjXTXQ9BqdnVMbyQSscNy3FwO97qVMvM2+PYTgK6PiihKiWEsgQ76ruqNIh+U0C9X uBaMUHkiGJIBy1UsHGUq/x+OTdlcM496Uim08aw== X-Received: by 2002:a05:6e02:1526:b0:347:a008:4b4 with SMTP id i6-20020a056e02152600b00347a00804b4mr2603178ilu.21.1689680167469; Tue, 18 Jul 2023 04:36:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlGV6mHbZAIiZSKdi9qdP60nODkNF2Guqwy5jaljqQ8Airt62emFnh99Y7kVyj674RD9/Lo9q6/8an/liFkWkKs= X-Received: by 2002:a05:6e02:1526:b0:347:a008:4b4 with SMTP id i6-20020a056e02152600b00347a00804b4mr2603163ilu.21.1689680167189; Tue, 18 Jul 2023 04:36:07 -0700 (PDT) MIME-Version: 1.0 References: <20230714124713.22550-1-tdevries@suse.de> In-Reply-To: <20230714124713.22550-1-tdevries@suse.de> From: Alexandra Petlanova Hajkova Date: Tue, 18 Jul 2023 13:35:56 +0200 Message-ID: Subject: Re: [PATCH] [gdb/tui] Fix secondary prompt To: Tom de Vries Cc: gdb-patches@sourceware.org, Tom Tromey X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000265a360600c1520a" X-Spam-Status: No, score=-19.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000265a360600c1520a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jul 14, 2023 at 2:47=E2=80=AFPM Tom de Vries via Gdb-patches < gdb-patches@sourceware.org> wrote: > With CLI, a session defining a command looks like: > ... > (gdb) define foo > Type commands for definition of "foo". > End with a line saying just "end". > >bar > >end > (gdb) > ... > > With TUI however, we get the same secondary prompts, and type the same, b= ut > are left with: > ... > (gdb) define foo > Type commands for definition of "foo". > End with a line saying just "end". > (gdb) > ... > > Fix this by calling tui_inject_newline_into_command_window in > gdb_readline_wrapper_line, as is done in tui_command_line_handler. > > Tested on x86_64-linux. > > PR tui/30636 > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30636 > --- > gdb/testsuite/gdb.tui/secondary-prompt.exp | 38 ++++++++++++++++++++++ > gdb/top.c | 6 ++++ > 2 files changed, 44 insertions(+) > create mode 100644 gdb/testsuite/gdb.tui/secondary-prompt.exp > > diff --git a/gdb/testsuite/gdb.tui/secondary-prompt.exp > b/gdb/testsuite/gdb.tui/secondary-prompt.exp > new file mode 100644 > index 00000000000..99fedaa3e47 > --- /dev/null > +++ b/gdb/testsuite/gdb.tui/secondary-prompt.exp > @@ -0,0 +1,38 @@ > +# Copyright 2023 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > + > +require allow_tui_tests > + > +tuiterm_env > + > +Term::clean_restart 24 80 > + > +if {![Term::enter_tui]} { > + unsupported "TUI not supported" > + return > +} > + > +# Define a macro. > +send_gdb "define foo\n" > +send_gdb "bar\n" > +send_gdb "end\n" > + > +# Wait for the last secondary prompt to appear, followed by the gdb > prompt. > +Term::wait_for ">end" > + > +# Regression test for PR tui/30636. Make sure the secondary prompts are > not > +# overwritten. > +Term::check_region_contents "secondary prompt not overwritten" 0 19 80 2= \ > + "^>bar *\r\n>end *$" > diff --git a/gdb/top.c b/gdb/top.c > index 90ddc5f5ea7..2322e55f1db 100644 > --- a/gdb/top.c > +++ b/gdb/top.c > @@ -77,6 +77,7 @@ > > #if defined(TUI) > # include "tui/tui.h" > +# include "tui/tui-io.h" > #endif > > #ifndef O_NOCTTY > @@ -958,6 +959,11 @@ gdb_readline_wrapper_line > (gdb::unique_xmalloc_ptr &&line) > saved_after_char_processing_hook =3D after_char_processing_hook; > after_char_processing_hook =3D NULL; > > +#if defined(TUI) > + if (tui_active) > + tui_inject_newline_into_command_window (); > +#endif > + > /* Prevent parts of the prompt from being redisplayed if annotations > are enabled, and readline's state getting out of sync. We'll > reinstall the callback handler, which puts the terminal in raw > > base-commit: 9d9f26d8b1a15561af02370f15be0af0d56ac5fa > -- > 2.35.3 > I can confirm this change causes no regressions and the gdb.tui/secondary-prompt.exp test passes for ppc64le Fedora Rawhide. --000000000000265a360600c1520a--