Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 6/7] [gdb/testsuite] Use TERM=ansiw in tuiterm for bsd
Date: Fri, 18 Jul 2025 15:01:52 +0200	[thread overview]
Message-ID: <20250718130153.24989-7-tdevries@suse.de> (raw)
In-Reply-To: <20250718130153.24989-1-tdevries@suse.de>

TERM=ansi is different on freebsd and linux.  Consequently, many TUI
test-cases (gdb.tui/*.exp and gdb.python/tui*.exp) fail on freebsd.

One of the problems is that send_gdb "<cmd>\r\n" is needed instead of
send_gdb "<cmd>\n".

This is because gdb_send "layout regs\n" translates to
"layout regs<KEY_DOWN>", which evidently missing the carriage return part.

While we can work around this, there are other problems.  There is no color
support, and the cursor keys fail to scroll the source window.

So I went looking for an alternative to TERM=ansi on freebsd, and came across
TERM=ansiw.  Using this didn't work out of the box, but with the fixes in
this series it now does.

I also briefly looked at TERM=ansis, which is interesting because it's
available on both linux and freebsd, but ansiw is a better choice for now.
I've filed PR33179 to document what I learned, with the aim to eventually
follow up and address two test-case failures with TERM=ansis on linux.

Tested on x86_64-freebsd.
---
 gdb/testsuite/lib/tuiterm.exp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 10c5a3d0dce..76351841988 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -92,6 +92,9 @@ namespace eval Term {
 
     # Return 1 if tuiterm has the bw/auto_left_margin enabled.
     proc _have_bw {} {
+	if { [string equal $Term::_TERM "ansiw"] } {
+	    return 1
+	}
 	return 0
     }
 
@@ -890,8 +893,16 @@ namespace eval Term {
     # BODY.
     proc with_tuiterm {rows cols body} {
 	global env stty_init
+	variable _TERM
 	save_vars {env(TERM) env(NO_COLOR) stty_init} {
-	    setenv TERM ansi
+	    if { [ishost *-*-*bsd*] } {
+		setenv TERM ansiw
+	    } else {
+		setenv TERM ansi
+	    }
+	    # Save active TERM variable.
+	    set Term::_TERM $env(TERM)
+
 	    setenv NO_COLOR ""
 	    _setup $rows $cols
 
-- 
2.43.0


  parent reply	other threads:[~2025-07-18 13:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-18 13:01 [PATCH 0/7] [gdb/testsuite] Fix TUI tests for freebsd Tom de Vries
2025-07-18 13:01 ` [PATCH 1/7] [gdb/testsuite] Fix Cursor Horizontal Absolute clipping Tom de Vries
2025-07-18 13:01 ` [PATCH 2/7] [gdb/testsuite] Handle Horizontal Position Absolute in tuiterm Tom de Vries
2025-07-18 13:01 ` [PATCH 3/7] [gdb/testsuite] Log on return in Term::_log_cur Tom de Vries
2025-07-23 18:28   ` Tom Tromey
2025-07-24  7:18     ` Tom de Vries
2025-07-18 13:01 ` [PATCH 4/7] [gdb/testsuite] Handle auto_left_margin in tuiterm Tom de Vries
2025-07-23 18:36   ` Tom Tromey
2025-07-18 13:01 ` [PATCH 5/7] [gdb/testsuite] Fix Term::_csi_m with no args Tom de Vries
2025-07-23 18:30   ` Tom Tromey
2025-07-23 20:34     ` Tom de Vries
2025-07-24  1:17       ` Tom Tromey
2025-07-18 13:01 ` Tom de Vries [this message]
2025-07-23 18:34   ` [PATCH 6/7] [gdb/testsuite] Use TERM=ansiw in tuiterm for bsd Tom Tromey
2025-07-24  9:47     ` Tom de Vries
2025-07-18 13:01 ` [PATCH 7/7] [gdb/testsuite] Add Term::get_string_with_attrs in tuiterm Tom de Vries
2025-07-23 18:36   ` Tom Tromey
2025-07-24 10:07     ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250718130153.24989-7-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox