diff options
| author | Tom de Vries <tdevries@suse.de> | 2026-03-25 08:03:01 +0100 |
|---|---|---|
| committer | Tom de Vries <tdevries@suse.de> | 2026-03-25 08:03:01 +0100 |
| commit | 7e9614552f205e417366357562afbd21b8d07c29 (patch) | |
| tree | 74caf5db29c710bccea87666385a2e431d794535 /gdb/python/python.c | |
| parent | c220f3ab8c093f17be53192f41fc2da77caf919f (diff) | |
| download | binutils-7e9614552f205e417366357562afbd21b8d07c29.tar.gz binutils-7e9614552f205e417366357562afbd21b8d07c29.tar.bz2 binutils-7e9614552f205e417366357562afbd21b8d07c29.zip | |
[gdb/remote] Use sevenbit_strings == true in escape_buffer
With Fedora RH, using Tcl 9.0.2, I run into:
...
(gdb) break -q main^M
[remote] Sending packet: $qXfer:auxv:read::0,1000#6b^M
[remote] Packet received: l!\000\000\000\000\000\000\000\000 ERROR: \
i_read(spawn_id fd=9): invalid or incomplete multibyte or wide character
...
UNRESOLVED: gdb.server/bkpt-other-inferior.exp: inf 2: set breakpoint
...
For reference, on openSUSE Leap 16.0, with Tcl 8.6.15 the initial part of the
problematic string looks like:
...
[remote] Packet received: l!\000\000\000\000\000\000\000\000`ü÷ÿ\177\000...
...
With Tcl 9.0, something (dejagnu/expect/gdb testsuite infrastructure)
has problems with gdb IO containing non-utf-8 chars.
Having said that, I don't think having chars like 'ü' in the debug output is
particularly helpful.
Fix this by forcing sevenbit_strings to true in escape_buffer, getting us
instead:
...
[remote] Packet received: \
l!\000\000\000\000\000\000\000\000`\374\367\377\177\000...
...
This also fixes test-case gdb.python/py-send-packet.exp, where we run into a
similar problem with the "Sending packet:" line.
Tested on x86_64-linux, with Tcl 9.0.2 and 8.6.15.
A v1 submitted was submitted here [2].
Changes in v2 [3]:
- use c_isprint instead of std::isprint
- use string_appendf instead of std::ostringstream
Changes in v3:
- Rather than re-implementing escape_buffer, change it to use
sevenbit_strings == true.
- update $subject to indicate new approach
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34012
Approved-By: Tom Tromey <tom@tromey.com>
[1] https://sourceware.org/gdb/current/onlinedocs/gdb.html/General-Query-Packets.html#index-qXfer-packet
[2] v1 https://sourceware.org/pipermail/gdb-patches/2026-March/226110.html
[3] v2 https://sourceware.org/pipermail/gdb-patches/2026-March/226119.html
Diffstat (limited to 'gdb/python/python.c')
0 files changed, 0 insertions, 0 deletions
