[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.
This commit is contained in:
Tom de Vries
2020-06-02 14:20:25 +02:00
parent 0bee4d1c08
commit 621eacdfb4
2 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2020-06-02 Tom de Vries <tdevries@suse.de>
* gdb.dwarf2/multidictionary.exp: Don't use
gdb_spawn_with_cmdline_opts.
2020-06-01 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.cp/step-and-next-inline.exp (do_test): Skip all tests in the

View File

@ -147,12 +147,9 @@ if {[build_executable $testfile.exp $testfile [list $asm_file $srcfile] {}] \
}
# We force the DIEs above to be read in via "-readnow".
gdb_spawn_with_cmdline_opts "-readnow"
set test "initial prompt"
gdb_test_multiple "" $test {
-re ".*$gdb_prompt $" {
pass "$test"
}
save_vars { GDBFLAGS } {
set GDBFLAGS "$GDBFLAGS -readnow"
clean_restart
}
gdb_load $binfile