]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite, Tcl 9.0] Avoid non-UTF-8 GDB IO (part 1)
authorTom de Vries <tdevries@suse.de>
Fri, 20 Mar 2026 09:13:28 +0000 (10:13 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 20 Mar 2026 09:13:28 +0000 (10:13 +0100)
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

gdb/testsuite/gdb.python/py-source-styling.exp

index 05fd077022bf075ea68604cdd4428c0014be6bbd..12d43e63ea84aefe0e3f25c146f110e2eb52062c 100644 (file)
@@ -149,6 +149,12 @@ proc_with_prefix test_source_cache_style_tracking {} {
            false
     }
 
+    # With Tcl 9.0, something (dejagnu/expect/gdb testsuite infrastructure)
+    # has problems with gdb IO containing non-utf-8 chars.  Work around this by
+    # requiring Tcl 8.6 for the following tests.  PR testsuite/33987 is open to
+    # come up with a better solution.
+    require {expr {$::tcl_version == 8.6}}
+
     # The same again, but this time the output is sent directly to
     # stdout.
     check_source_listing_styling \