]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Set interactive-mode to on
authorTom de Vries <tdevries@suse.de>
Tue, 17 Jun 2025 06:28:50 +0000 (08:28 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 17 Jun 2025 06:28:50 +0000 (08:28 +0200)
With MSYS2 and test-case gdb.ada/assign_1.exp, we get:
...
(gdb) dir^M
Reinitialize source path to empty? (y or n) \
  [answered Y; input not from terminal]^M^M
Source directories searched: $cdir;$cwd^M^M
(gdb)
...

GDB automatically answers the query, because interactive-mode is off:
...
(gdb) show interactive-mode^M
Debugger's interactive mode is auto (currently off).^M^M
...

The correct value is on, because GDB was started in a terminal.

For some reason, the auto value of interactive-mode is off instead.  According
to this patch [1], gdb doesn't recognize the pipes used by DejaGnu testsuite
as an interactive setup.

Fix this by adding "set interactive-mode on" to INTERNAL_GDBFLAGS, such that
we get:
...
(gdb) dir^M
Reinitialize source path to empty? (y or n) y^M
Source directories searched: $cdir;$cwd^M^M
(gdb)
...
and no longer need fixes like commit be740e7cc62 ("testsuite: skip
confirmation in 'gdb_reinitialize_dir'")

The fix is essentially the same as in aforementioned patch.

For consistency, we apply the fix for all platforms.

Co-Authored-By: Pierre Muller <muller@sourceware.org>
Approved-By: Tom Tromey <tom@tromey.com>
[1] https://sourceware.org/legacy-ml/gdb-patches/2013-09/msg00940.html

gdb/testsuite/lib/gdb.exp

index d9f53d2fd93dc9322db367d5609cc8c1320981c9..3f1cd55d7273a0a9ecdd870213cb450e8843ecb8 100644 (file)
@@ -269,6 +269,9 @@ if ![info exists INTERNAL_GDBFLAGS] {
     }
 
     set INTERNAL_GDBFLAGS [append_gdb_data_directory_option $INTERNAL_GDBFLAGS]
+
+    # Handle the case that "interactive-mode auto" reports off.
+    append INTERNAL_GDBFLAGS { -iex "set interactive-mode on"}
 }
 
 # The variable gdb_prompt is a regexp which matches the gdb prompt.