]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
New '--binary-output' command line option, fix gdb.mi/ testing on Windows
authorPedro Alves <pedro@palves.net>
Mon, 8 Sep 2025 19:10:22 +0000 (20:10 +0100)
committerPedro Alves <pedro@palves.net>
Sat, 20 Sep 2025 20:18:48 +0000 (21:18 +0100)
commit46cb3bf60eff8501b2ccf73b543adc9a4687754c
tree034416eef57ebec6b89a60db335fd9976bb310b4
parenta93d6e0f85e221871cfedc0423fa1554b3bcb06b
New '--binary-output' command line option, fix gdb.mi/ testing on Windows

MI testcases currently all fail on native Windows with:

 Running /c/gdb/src/gdb/testsuite/gdb.mi/mi-simplerun.exp ...
 ERROR: (timeout) GDB never initialized after 10 seconds.

This is because when GDB is started in MI mode, it prints info to the
terminal before -iex options are processed.  I.e., before the "maint
set console-translation-mode binary" command in

 gdb -nw -nx -q -iex "set height 0" -iex "set width 0" \
    -iex "set interactive-mode on" \
    -iex "maint set console-translation-mode binary" \
    -i=mi

... is processed.  This results in GDB printing early output with
\r\r\n, like can be easily seen by passing --debug to runtest:

  expect: does "=thread-group-added,id="i1"\r\r\n=cmd-param-changed,param="width",value="4294967295"\r\r\n=cmd-param-changed,param="interactive-mode",value="on"\r\r\n(gdb) \r\n" (spawn_id exp10) match regular expression "~"GNU.*\r\n~".*[(]gdb[)] \r\n$"? Gate "~"GNU*\r\n~"*gdb? \r\n"? gate=no

Fix this by adding a new Windows-only --binary-output command line
option to GDB, which is processed much earlier than -iex, and making
the testsuite pass that instead of "maint set console-translation-mode
binary".

Remove "maint set console-translation-mode" completely, since the only
reason it existed was for the testsuite, and it was never included in
any release.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Tom de Vries <tdevries@suse.de>
Change-Id: I4632707bb7c8ca573cffff9641ddeb33a0e150af
gdb/NEWS
gdb/doc/gdb.texinfo
gdb/main.c
gdb/mingw-hdep.c
gdb/terminal.h
gdb/testsuite/lib/gdb.exp