public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tui/30636] New: [gdb/tui] Secondary prompt overwritten
@ 2023-07-14 11:23 vries at gcc dot gnu.org
  2023-07-14 12:47 ` [Bug tui/30636] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-14 11:23 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30636
           Summary: [gdb/tui] Secondary prompt overwritten
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tui
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider this gdb session:
...
$ gdb -q
(gdb) define foo
Type commands for definition of "foo".
End with a line saying just "end".
>bar
>end
(gdb) show user
User command "foo":
  bar

(gdb) 
...

Now let's try the same in TUI:
...
(gdb) define foo   
Type commands for definition of "foo".
End with a line saying just "end".
(gdb) show user
User command "foo":
  bar

(gdb) 
...

The secondary prompt lines are not terminated with a \n, and are consequently
overwritten.

With this tentative patch:
...
diff --git a/gdb/top.c b/gdb/top.c
index 90ddc5f5ea7..f9b967c5c64 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,9 @@ gdb_readline_wrapper_line (gdb::unique_xmalloc_ptr<char>
&&line)
   saved_after_char_processing_hook = after_char_processing_hook;
   after_char_processing_hook = NULL;

+  if (tui_active)
+    tui_inject_newline_into_command_window ();
+
   /* 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
...
we get instead:
...
(gdb) define foo
Type commands for definition of "foo".
End with a line saying just "end".
>bar
>end
(gdb) show user
User command "foo":
  bar

(gdb) 
...

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tui/30636] [gdb/tui] Secondary prompt overwritten
  2023-07-14 11:23 [Bug tui/30636] New: [gdb/tui] Secondary prompt overwritten vries at gcc dot gnu.org
@ 2023-07-14 12:47 ` vries at gcc dot gnu.org
  2023-07-26 11:32 ` cvs-commit at gcc dot gnu.org
  2023-07-26 11:33 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-14 12:47 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2023-July/200892.html

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tui/30636] [gdb/tui] Secondary prompt overwritten
  2023-07-14 11:23 [Bug tui/30636] New: [gdb/tui] Secondary prompt overwritten vries at gcc dot gnu.org
  2023-07-14 12:47 ` [Bug tui/30636] " vries at gcc dot gnu.org
@ 2023-07-26 11:32 ` cvs-commit at gcc dot gnu.org
  2023-07-26 11:33 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-26 11:32 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=87c9b0289d73382cc72adb84d221b0a8ceb33ef8

commit 87c9b0289d73382cc72adb84d221b0a8ceb33ef8
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Jul 26 13:31:53 2023 +0200

    [gdb/tui] Fix secondary prompt

    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, but
    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=30636

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tui/30636] [gdb/tui] Secondary prompt overwritten
  2023-07-14 11:23 [Bug tui/30636] New: [gdb/tui] Secondary prompt overwritten vries at gcc dot gnu.org
  2023-07-14 12:47 ` [Bug tui/30636] " vries at gcc dot gnu.org
  2023-07-26 11:32 ` cvs-commit at gcc dot gnu.org
@ 2023-07-26 11:33 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-26 11:33 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.1
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-26 11:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-14 11:23 [Bug tui/30636] New: [gdb/tui] Secondary prompt overwritten vries at gcc dot gnu.org
2023-07-14 12:47 ` [Bug tui/30636] " vries at gcc dot gnu.org
2023-07-26 11:32 ` cvs-commit at gcc dot gnu.org
2023-07-26 11:33 ` vries at gcc dot gnu.org

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).