[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)
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

index ec6b24a018314cad3cc3290923f83f9171dece71..ec6878fdb9570f78ed51b4a8ee6bfaf0b3feac05 100644 (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
index 01e5a0de45518bfaa6c2273528239255338cda31..45ba1ed99b4f45fefa89f907292aa2e52395f378 100644 (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
 
This page took 0.030667 seconds and 4 git commands to generate.