public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tui/28482] New: [tui] nexting through hello world results in duplicate lines in source window
@ 2021-10-21  8:16 vries at gcc dot gnu.org
  2021-10-21  8:23 ` [Bug tui/28482] " vries at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-21  8:16 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28482
           Summary: [tui] nexting through hello world results in duplicate
                    lines in source window
           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: ---

Created attachment 13730
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13730&action=edit
Screen shot

Test-case setup:
...
$ cat -n hello.c
     1  #include <stdio.h>
     2  #include <stdlib.h>
     3
     4  int
     5  main (void)
     6  {
     7    void *p = malloc (10);
     8    printf ("hello: %p\n", p);
     9    return 0;
    10  }
$ gcc hello.c -g
...

gdb session:
...
$ gdb a.out
(gdb) tui enable
(gdb) start
(gdb) n
(gdb) n
...

Resulting source window:
...
     6  {
     7    void *p = malloc (10);
>    8    printf ("hello: %p\n", p);
     9    printf ("hello: %p\n", p);
>   10    return 0;
...

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

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

* [Bug tui/28482] [tui] nexting through hello world results in duplicate lines in source window
  2021-10-21  8:16 [Bug tui/28482] New: [tui] nexting through hello world results in duplicate lines in source window vries at gcc dot gnu.org
@ 2021-10-21  8:23 ` vries at gcc dot gnu.org
  2021-10-21  8:26 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-21  8:23 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
I switched off the reverse mode point highlighting:
...
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index afd51e95980..f0bf76b15be 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -239,13 +239,17 @@ tui_source_window_base::show_source_line (int lineno)
   struct tui_source_element *line;

   line = &m_content[lineno];
+#if 0
   if (line->is_exec_point)
     tui_set_reverse_mode (m_pad.get (), true);
+#endif

   wmove (m_pad.get (), lineno, 0);
   tui_puts (line->line.c_str (), m_pad.get ());
+#if 0
   if (line->is_exec_point)
     tui_set_reverse_mode (m_pad.get (), false);
+#endif
 }

 /* See tui-winsource.h.  */
...
and got instead:
...
     6  {
     7    void *p = malloc (10);
>    8    printf ("hello: %p\n", p);
     9    return 0;
>   10  }
...
which fixes the duplicate line, but the old '>' marker is left, and the new one
is in the wrong place.  After another next, we have:
...
     6  {
     7    void *p = malloc (10);
>    8    printf ("hello: %p\n", p);
     9    return 0;
    10  }
>   11
...

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

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

* [Bug tui/28482] [tui] nexting through hello world results in duplicate lines in source window
  2021-10-21  8:16 [Bug tui/28482] New: [tui] nexting through hello world results in duplicate lines in source window vries at gcc dot gnu.org
  2021-10-21  8:23 ` [Bug tui/28482] " vries at gcc dot gnu.org
@ 2021-10-21  8:26 ` vries at gcc dot gnu.org
  2021-10-21  9:29 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-21  8:26 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Interestingly, when changing the order of "tui enable" and "start", everything
works as expected.  Both with and without patch.

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

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

* [Bug tui/28482] [tui] nexting through hello world results in duplicate lines in source window
  2021-10-21  8:16 [Bug tui/28482] New: [tui] nexting through hello world results in duplicate lines in source window vries at gcc dot gnu.org
  2021-10-21  8:23 ` [Bug tui/28482] " vries at gcc dot gnu.org
  2021-10-21  8:26 ` vries at gcc dot gnu.org
@ 2021-10-21  9:29 ` vries at gcc dot gnu.org
  2021-10-21  9:39 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-21  9:29 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Two more things I found out:

If I use enter to repeat the first next, rather than typing n again, problem
doesn't happen.

Apparently there's a command refresh, with keyboard shortcut ^L that fixes
this. This is where I found it (
https://stackoverflow.com/questions/38803783/how-to-automatically-refresh-gdb-in-tui-mode
). Apparently this problem is so big, that people try to automate this ...

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

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

* [Bug tui/28482] [tui] nexting through hello world results in duplicate lines in source window
  2021-10-21  8:16 [Bug tui/28482] New: [tui] nexting through hello world results in duplicate lines in source window vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-10-21  9:29 ` vries at gcc dot gnu.org
@ 2021-10-21  9:39 ` vries at gcc dot gnu.org
  2021-10-21 11:35 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-21  9:39 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Well, this fixes my problem:
...
$ git diff
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 52519aecf17..53e5388fbe1 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -185,6 +185,7 @@ tui_before_prompt (const char *current_gdb_prompt)
   tui_refresh_frame_and_register_information ();
   from_stack = false;
   from_source_symtab = false;
+  tui_refresh_all_win ();
 }

 /* Observer for the normal_stop notification.  */
...

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

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

* [Bug tui/28482] [tui] nexting through hello world results in duplicate lines in source window
  2021-10-21  8:16 [Bug tui/28482] New: [tui] nexting through hello world results in duplicate lines in source window vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-10-21  9:39 ` vries at gcc dot gnu.org
@ 2021-10-21 11:35 ` vries at gcc dot gnu.org
  2021-10-21 13:09 ` vries at gcc dot gnu.org
  2023-05-24 14:13 ` vries at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-21 11:35 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Hmm, I wonder if this is a duplicate of PR 14332 - "Output from inferior
confuses gdbtui".

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

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

* [Bug tui/28482] [tui] nexting through hello world results in duplicate lines in source window
  2021-10-21  8:16 [Bug tui/28482] New: [tui] nexting through hello world results in duplicate lines in source window vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-10-21 11:35 ` vries at gcc dot gnu.org
@ 2021-10-21 13:09 ` vries at gcc dot gnu.org
  2023-05-24 14:13 ` vries at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-21 13:09 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2021-October/182689.html

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

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

* [Bug tui/28482] [tui] nexting through hello world results in duplicate lines in source window
  2021-10-21  8:16 [Bug tui/28482] New: [tui] nexting through hello world results in duplicate lines in source window vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-10-21 13:09 ` vries at gcc dot gnu.org
@ 2023-05-24 14:13 ` vries at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: vries at gcc dot gnu.org @ 2023-05-24 14:13 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

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

*** This bug has been marked as a duplicate of bug 14332 ***

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

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

end of thread, other threads:[~2023-05-24 14:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21  8:16 [Bug tui/28482] New: [tui] nexting through hello world results in duplicate lines in source window vries at gcc dot gnu.org
2021-10-21  8:23 ` [Bug tui/28482] " vries at gcc dot gnu.org
2021-10-21  8:26 ` vries at gcc dot gnu.org
2021-10-21  9:29 ` vries at gcc dot gnu.org
2021-10-21  9:39 ` vries at gcc dot gnu.org
2021-10-21 11:35 ` vries at gcc dot gnu.org
2021-10-21 13:09 ` vries at gcc dot gnu.org
2023-05-24 14:13 ` 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).