From: Tom de Vries Date: Fri, 20 Mar 2026 09:13:28 +0000 (+0100) Subject: [gdb/testsuite, Tcl 9.0] Avoid non-UTF-8 GDB IO (part 1) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcd41a3d4808d37ff827dc055dd2b32e7be47078;p=thirdparty%2Fbinutils-gdb.git [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 /* The following line contains a character that is non-utf-8. This is a critical part of the test as Python 3 can't convert this into a string using its default mechanism. */ 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 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33948 --- diff --git a/gdb/testsuite/gdb.python/py-source-styling.exp b/gdb/testsuite/gdb.python/py-source-styling.exp index 05fd077022b..12d43e63ea8 100644 --- a/gdb/testsuite/gdb.python/py-source-styling.exp +++ b/gdb/testsuite/gdb.python/py-source-styling.exp @@ -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 \