[pushed] [gdb/testsuite] Fix gdb.base/style.exp with stub-termcap

Tom de Vries tdevries@suse.de
Tue Nov 30 14:36:49 GMT 2021


From: Tom de Vries <tdevries@sdflex.arch.suse.de>

When running test-case gdb.base/style.exp with a gdb build using
stub-termcap.c, we run into:
...
(gdb) PASS: gdb.base/style.exp: all styles enabled: frame when width=20
^M<et width 30^M
(gdb) FAIL: gdb.base/style.exp: all styles enabled: set width 30
...

The problem is that we're trying to issue the command "set width 30" while
width is set to 20, which causes horizontal scrolling.

Fix this by resetting the width to 0 before issuing the "set width 30"
command.

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24582
---
 gdb/testsuite/gdb.base/style.exp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 91d3059612d..5749f7b0d4c 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -169,10 +169,15 @@ proc run_style_tests { } {
 
 	    gdb_test_no_output "set width $width"
 	    gdb_test "frame" $re_styled "frame when width=$width"
-	}
 
-	# Reset width back to 0.
-	gdb_test_no_output "set width 0" ""
+	    # Reset width back to 0.  Doing this in the loop rather than
+	    # after, avoids trying to do "set width 30" while width is 20,
+	    # which causes horizontal scrolling in the case that the fallback
+	    # stub-termcap.c is used:
+	    # ^M<et width 30^M
+	    # (gdb) FAIL: gdb.base/style.exp: all styles enabled: set width 30
+	    gdb_test_no_output "set width 0" ""
+	}
 
 	if {$test_macros} {
 	    set macro_line [gdb_get_line_number "\#define SOME_MACRO"]

base-commit: 9745b5a753e5bbb3796e77f058bdf1b23b82bd89
-- 
2.31.1



More information about the Gdb-patches mailing list