[gdb/testsuite, Tcl 9.0] Avoid non-UTF-8 GDB IO (part 1)

When running test-case gdb.python/py-source-styling.exp with Tcl 9.0, I get:
...
python gdb.execute('list 26')^M
<SNIP>/* The following line contains a character that is non-utf-8.  This is a
<SNIP>   critical part of the test as Python 3 can't convert this into a string
<SNIIP>  using its default mechanism.  */
<SNIP>FAIL: $exp: test_source_cache_style_tracking: \
  python gdb.execute('list 26') (timeout)
ERROR: i_read(spawn_id fd=9): invalid or incomplete multibyte or wide character
    while executing
"expect {
-i exp9 -timeout 10
        -re ".*A problem internal to GDB has been detected" {
            fail "$message (GDB internal error)"
            gdb_internal_error..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $body" POSIX EILSEQ {invalid or incomplete multibyte or wide \
  character} i_read(spawn_id fd=9)
: invalid or incomplete multibyte or wide character
Couldn't send python gdb.execute('list 26', to_string=False, styling=True) to GDB.
...

I have tried a fix similar to the previous commit in default_gdb_spawn:
...
+    if {[tcl_version_at_least 9 0 0]} {
+	set fd [exp_open -leaveopen -i $res]
+	fconfigure $fd -encoding utf-8 -profile replace
+    }
+
...
but that doesn't seem to work.

Work around this by skipping the part that runs into this problem.

Approved-By: Tom Tromey <tom@tromey.com>

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33948
1 file changed