public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tui/30388] New: [gdb/tui, TERM=ansi] first char of prompt in status line
@ 2023-04-25  9:45 vries at gcc dot gnu.org
  2023-04-25 10:08 ` [Bug tui/30388] " vries at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-25  9:45 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30388
           Summary: [gdb/tui, TERM=ansi] first char of prompt in status
                    line
           Product: gdb
           Version: 13.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tui
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider:
...
$ gdb -q -iex "set tui border-kind ascii" -tui
...

This gets us the expected lower border of src window, status line and prompt:
...
+----------------------------------------+
No process In:               L??   PC: ?? 
(gdb) 
...

With TERM=ansi, we have instead:
...
+----------------------------------------+
No process In:               L??   PC: ??(
gdb) 
...

This seems to have something to do with the status line window.

If I do:
...
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 01d243ba9a1..5a860310856 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -1167,7 +1167,6 @@ initialize_layouts ()

   layout = new tui_layout_split ();
   layout->add_window (SRC_NAME, 2);
-  layout->add_window (STATUS_NAME, 0);
   layout->add_window (CMD_NAME, 1);
   add_layout_command (SRC_NAME, layout);


...
I get the expected:
...
+----------------------------------------+
(gdb) 
...

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

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

* [Bug tui/30388] [gdb/tui, TERM=ansi] first char of prompt in status line
  2023-04-25  9:45 [Bug tui/30388] New: [gdb/tui, TERM=ansi] first char of prompt in status line vries at gcc dot gnu.org
@ 2023-04-25 10:08 ` vries at gcc dot gnu.org
  2023-04-25 10:19 ` vries at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-25 10:08 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
This seems to help in some cases, but not all:
...
-  waddstr (handle.get (), string.c_str ());
+  waddnstr (handle.get (), string.c_str (), width - 1);
...

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

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

* [Bug tui/30388] [gdb/tui, TERM=ansi] first char of prompt in status line
  2023-04-25  9:45 [Bug tui/30388] New: [gdb/tui, TERM=ansi] first char of prompt in status line vries at gcc dot gnu.org
  2023-04-25 10:08 ` [Bug tui/30388] " vries at gcc dot gnu.org
@ 2023-04-25 10:19 ` vries at gcc dot gnu.org
  2023-04-25 10:52 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-25 10:19 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> With TERM=ansi, we have instead:
> ...
> +----------------------------------------+
> No process In:               L??   PC: ??(
> gdb) 
> ...

Good to note: ^L fixes this.

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

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

* [Bug tui/30388] [gdb/tui, TERM=ansi] first char of prompt in status line
  2023-04-25  9:45 [Bug tui/30388] New: [gdb/tui, TERM=ansi] first char of prompt in status line vries at gcc dot gnu.org
  2023-04-25 10:08 ` [Bug tui/30388] " vries at gcc dot gnu.org
  2023-04-25 10:19 ` vries at gcc dot gnu.org
@ 2023-04-25 10:52 ` vries at gcc dot gnu.org
  2023-04-25 10:53 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-25 10:52 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
            Version|13.1                        |HEAD

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 0a750187c26..4769a7706d1 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -183,10 +183,13 @@ tui_locator_window::make_status_line () const

   std::string string_val = string.release ();

-  if (string.size () < status_size)
-    string_val.append (status_size - string.size (), ' ');
-  else if (string.size () > status_size)
-    string_val.erase (status_size, string.size ());
+  size_t len = string_val.size ()
+  if (len < status_size)
+    string_val.append (status_size - len, ' ');
+  else if (len > status_size)
+    string_val.erase (status_size, len);
+
+  gdb_assert (string_val.size () == status_size);

   return string_val;
 }
...

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

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

* [Bug tui/30388] [gdb/tui, TERM=ansi] first char of prompt in status line
  2023-04-25  9:45 [Bug tui/30388] New: [gdb/tui, TERM=ansi] first char of prompt in status line vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-04-25 10:52 ` vries at gcc dot gnu.org
@ 2023-04-25 10:53 ` vries at gcc dot gnu.org
  2023-04-25 11:30 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-25 10:53 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |normal

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #3)
> Tentative patch:

EWRONGPR, that was for PR30389.

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

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

* [Bug tui/30388] [gdb/tui, TERM=ansi] first char of prompt in status line
  2023-04-25  9:45 [Bug tui/30388] New: [gdb/tui, TERM=ansi] first char of prompt in status line vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-04-25 10:53 ` vries at gcc dot gnu.org
@ 2023-04-25 11:30 ` vries at gcc dot gnu.org
  2023-04-25 13:07 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-25 11:30 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> This seems to help in some cases, but not all:
> ...
> -  waddstr (handle.get (), string.c_str ());
> +  waddnstr (handle.get (), string.c_str (), width - 1);
> ...

This case is fine:
...
$ TERM=ansi gdb -q -eiex "set tui border-kind ascii" -tui 
...
but this case still has the same problem:
...
$ TERM=ansi gdb -q -iex "set tui border-kind ascii" -tui
...

Also works fine with:
...
$ TERM=ansi gdb -q -iex "set tui border-kind ascii" -iex "tui enable"
...
and:
...
$ TERM=ansi gdb -q -eiex "set tui border-kind ascii" -iex "tui enable"
...

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

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

* [Bug tui/30388] [gdb/tui, TERM=ansi] first char of prompt in status line
  2023-04-25  9:45 [Bug tui/30388] New: [gdb/tui, TERM=ansi] first char of prompt in status line vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-04-25 11:30 ` vries at gcc dot gnu.org
@ 2023-04-25 13:07 ` vries at gcc dot gnu.org
  2023-05-04  7:37 ` vries at gcc dot gnu.org
  2023-05-09 13:22 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-04-25 13:07 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> (In reply to Tom de Vries from comment #0)
> > With TERM=ansi, we have instead:
> > ...
> > +----------------------------------------+
> > No process In:               L??   PC: ??(
> > gdb) 
> > ...
> 
> Good to note: ^L fixes this.

Likewise:
...
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 7752701378e..267ddcb2d23 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -645,6 +645,7 @@ tui_redisplay_readline (void)
   TUI_CMD_WIN->start_line -= height - 1;

   wrefresh (w);
+  tui_refresh_all_win ();
   fflush(stdout);
 }

...

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

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

* [Bug tui/30388] [gdb/tui, TERM=ansi] first char of prompt in status line
  2023-04-25  9:45 [Bug tui/30388] New: [gdb/tui, TERM=ansi] first char of prompt in status line vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-04-25 13:07 ` vries at gcc dot gnu.org
@ 2023-05-04  7:37 ` vries at gcc dot gnu.org
  2023-05-09 13:22 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-05-04  7:37 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
I'm close to giving up on this, I've played around quite a bit changing how the
status line is rendered, but the problem keeps reoccuring in different forms
and scenarios.

I'm starting to suspect that we're running into the problem that setting TERM
to something changes the capabilities reported to the application, but not the
behaviour of the terminal emulator itself.  More specifically with xterm we
have the am and xn capabilities set, with ansi just am, but the terminal will
behave the same regardless.

I've a filed a new PR30419 - [gdb/tui] Support tui safe-mode on/off, to work
around this in a more generic fashion, with the idea of avoiding to run into
this
by hiding the last column, as readline does.

But it's possible that we have to classify this PR as not-a-bug: If you lie to
your application about the capabilities or your terminal, you may run into
trouble.

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

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

* [Bug tui/30388] [gdb/tui, TERM=ansi] first char of prompt in status line
  2023-04-25  9:45 [Bug tui/30388] New: [gdb/tui, TERM=ansi] first char of prompt in status line vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-05-04  7:37 ` vries at gcc dot gnu.org
@ 2023-05-09 13:22 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-05-09 13:22 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #8 from Tom de Vries <vries at gcc dot gnu.org> ---
Posted a proposal implementing "set tui hide-last-column on/off/auto" at 
https://sourceware.org/pipermail/gdb-patches/2023-May/199433.html .

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

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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25  9:45 [Bug tui/30388] New: [gdb/tui, TERM=ansi] first char of prompt in status line vries at gcc dot gnu.org
2023-04-25 10:08 ` [Bug tui/30388] " vries at gcc dot gnu.org
2023-04-25 10:19 ` vries at gcc dot gnu.org
2023-04-25 10:52 ` vries at gcc dot gnu.org
2023-04-25 10:53 ` vries at gcc dot gnu.org
2023-04-25 11:30 ` vries at gcc dot gnu.org
2023-04-25 13:07 ` vries at gcc dot gnu.org
2023-05-04  7:37 ` vries at gcc dot gnu.org
2023-05-09 13:22 ` 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).