[gdb/testsuite] Fix scrolling in gdb.dwarf2/multidictionary.exp
authorTom de Vries <tdevries@suse.de>
Tue, 2 Jun 2020 12:20:25 +0000 (14:20 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 2 Jun 2020 12:20:25 +0000 (14:20 +0200)
commit621eacdfb42f9deba559ea0bada70f6ca2367f5f
treeb8f992f1f4d90e9259291ca15d03b946ed2bcc8b
parent0bee4d1c08523419016db14c3706f922ffc6f753
[gdb/testsuite] Fix scrolling in gdb.dwarf2/multidictionary.exp

Consider a gdb_load patch to call the gdb_file_cmd twice:
...
 proc gdb_load { arg } {
     if { $arg != "" } {
+       set res [gdb_file_cmd $arg]
+       if { $res != 0 } {
+           return $res
+       }
        return [gdb_file_cmd $arg]
     }
     return 0
 }
...

With this patch, I run into:
...
(gdb) kill^M
The program is not being run.^M
(gdb) ^M</outputs/gdb.dwarf2/multidictionary/multidictionary^M
<.dwarf2/multidictionary/multidictionary"? (y or n)
ERROR: Couldn't load outputs/gdb.dwarf2/multidictionary/multidictionary \
  into gdb (timeout).
p 1^M
Please answer y or n.^M
<.dwarf2/multidictionary/multidictionary"? (y or n) n^M
Not confirmed.^M
(gdb) UNRESOLVED: gdb.dwarf2/multidictionary.exp: GDB is alive \
  (got interactive prompt)
...

The problem is that the second file command results in a prompt, which is
normally handled by gdb_file_cmd, but not recognized because the initial part
of the prompt is scrolled out.

This in turn is caused by using gdb_spawn_with_cmdline_opts without a
subsequent "set width 0".

Fix this by avoiding gdb_spawn_with_cmdline_opts, and forcing -readline by
temporarily modifying GDBFLAGS instead.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-02  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/multidictionary.exp: Don't use
gdb_spawn_with_cmdline_opts.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/multidictionary.exp