[gdb/testsuite] Add Term::get_string_with_attrs in tuiterm

While reading a gdb.log for test-case gdb.tui/main-2.exp, I noticed that this
line was somewhat hard to read:
...
screen line 6: '<fg:cyan><intensity:bold>|<fg:default><intensity:normal>B+>    21 <reverse:1>  return 0;<reverse:0>                                                         <fg:cyan><intensity:bold>|<fg:default><intensity:normal>'
...
because of the border attributes.

Then I realized that the test-case is only interested in the text between the
borders, so I added a proc Term::get_string_with_attrs that allows me to drop
the borders, getting us instead:
...
screen line 6: 'B+>    21 <reverse:1>  return 0;<reverse:0>                                                         '
...

Tested on aarch64-linux.
diff --git a/gdb/testsuite/gdb.tui/main-2.exp b/gdb/testsuite/gdb.tui/main-2.exp
index 2b0fb6b..71ad03b 100644
--- a/gdb/testsuite/gdb.tui/main-2.exp
+++ b/gdb/testsuite/gdb.tui/main-2.exp
@@ -41,7 +41,7 @@
 set line "  return 0;"
 set nr [gdb_get_line_number $line]
 
-set screen_line [Term::get_line_with_attrs 6]
+set screen_line [Term::get_string_with_attrs 6 1 79]
 verbose -log "screen line 6: '$screen_line'"
 gdb_assert { [regexp "$nr <reverse:1>$line<reverse:0>" $screen_line] } \
     "highlighted line in middle of source window"
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 8ea8ebe..cc8e852 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -1009,10 +1009,10 @@
 	return $res
     }
 
-    # Return the text of screen line N.  Lines are 0-based.  If C is given,
-    # stop before column C.  Columns are also zero-based.  If ATTRS, annotate
-    # with attributes.
-    proc get_line_1 {n c attrs} {
+    # Return the text of screen line N.  Lines are 0-based.  Start at column
+    # X.  If C is non-empty, stop before column C.  Columns are also
+    # zero-based.  If ATTRS, annotate with attributes.
+    proc get_string {n x c {attrs 0}} {
 	variable _rows
 	# This can happen during resizing, if the cursor seems to
 	# temporarily be off-screen.
@@ -1024,7 +1024,6 @@
 	variable _cols
 	variable _chars
 	set c [_default $c $_cols]
-	set x 0
 	if { $attrs } {
 	    _reset_attrs line_attrs
 	}
@@ -1044,6 +1043,20 @@
 	return $result
     }
 
+    # Return the text of screen line N.  Lines are 0-based.  Start at column
+    # X.  If C is non-empty, stop before column C.  Columns are also
+    # zero-based. Annotate with attributes.
+    proc get_string_with_attrs { n x c } {
+	return [get_string $n $x $c 1]
+    }
+
+    # Return the text of screen line N.  Lines are 0-based.  If C is
+    # non-empty, stop before column C.  Columns are also zero-based. If
+    # ATTRS, annotate with attributes.
+    proc get_line_1 {n c attrs} {
+	return [get_string $n 0 $c $attrs]
+    }
+
     # Return the text of screen line N, without attributes.  Lines are
     # 0-based.  If C is given, stop before column C.  Columns are also
     # zero-based.